LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.pipe.tasks.functors.ConvertPixelToArcseconds Class Reference
Inheritance diagram for lsst.pipe.tasks.functors.ConvertPixelToArcseconds:
lsst.pipe.tasks.functors.ComputePixelScale lsst.pipe.tasks.functors.LocalWcs lsst.pipe.tasks.functors.Functor

Public Member Functions

def __init__ (self, col, colCD_1_1, colCD_1_2, colCD_2_1, colCD_2_2, **kwargs)
 
def name (self)
 
def columns (self)
 
def pixelScaleArcseconds (self, cd11, cd12, cd21, cd22)
 
def computeDeltaRaDec (self, x, y, cd11, cd12, cd21, cd22)
 
def computeSkySeperation (self, ra1, dec1, ra2, dec2)
 
def getSkySeperationFromPixel (self, x1, y1, x2, y2, cd11, cd12, cd21, cd22)
 
def noDup (self)
 
def multilevelColumns (self, data, columnIndex=None, returnTuple=False)
 
def __call__ (self, data, dropna=False)
 
def difference (self, data1, data2, **kwargs)
 
def fail (self, df)
 
def shortname (self)
 

Public Attributes

 col
 
 colCD_1_1
 
 colCD_1_2
 
 colCD_2_1
 
 colCD_2_2
 
 filt
 
 dataset
 

Static Public Attributes

string name = "PixelScale"
 

Detailed Description

Convert a value in units pixels squared  to units arcseconds squared.

Definition at line 1315 of file functors.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.pipe.tasks.functors.ConvertPixelToArcseconds.__init__ (   self,
  col,
  colCD_1_1,
  colCD_1_2,
  colCD_2_1,
  colCD_2_2,
**  kwargs 
)

Definition at line 1319 of file functors.py.

1325  **kwargs):
1326  self.col = col
1327  super().__init__(colCD_1_1,
1328  colCD_1_2,
1329  colCD_2_1,
1330  colCD_2_2,
1331  **kwargs)
1332 

Member Function Documentation

◆ __call__()

def lsst.pipe.tasks.functors.Functor.__call__ (   self,
  data,
  dropna = False 
)
inherited

Definition at line 340 of file functors.py.

340  def __call__(self, data, dropna=False):
341  try:
342  df = self._get_data(data)
343  vals = self._func(df)
344  except Exception:
345  vals = self.fail(df)
346  if dropna:
347  vals = self._dropna(vals)
348 
349  return vals
350 

◆ columns()

def lsst.pipe.tasks.functors.ConvertPixelToArcseconds.columns (   self)
Columns required to perform calculation

Reimplemented from lsst.pipe.tasks.functors.ComputePixelScale.

Definition at line 1338 of file functors.py.

1338  def columns(self):
1339  return [self.col,
1340  self.colCD_1_1,
1341  self.colCD_1_2,
1342  self.colCD_2_1,
1343  self.colCD_2_2]
1344 

◆ computeDeltaRaDec()

def lsst.pipe.tasks.functors.LocalWcs.computeDeltaRaDec (   self,
  x,
  y,
  cd11,
  cd12,
  cd21,
  cd22 
)
inherited
Compute the distance on the sphere from x2, y1 to x1, y1.

Parameters
----------
x : `pandas.Series`
    X pixel coordinate.
y : `pandas.Series`
    Y pixel coordinate.
cd11 : `pandas.Series`
    [1, 1] element of the local Wcs affine transform.
cd11 : `pandas.Series`
    [1, 1] element of the local Wcs affine transform.
cd12 : `pandas.Series`
    [1, 2] element of the local Wcs affine transform.
cd21 : `pandas.Series`
    [2, 1] element of the local Wcs affine transform.
cd22 : `pandas.Series`
    [2, 2] element of the local Wcs affine transform.

Returns
-------
raDecTuple : tuple
    RA and dec conversion of x and y given the local Wcs. Returned
    units are in radians.

Definition at line 1183 of file functors.py.

1183  def computeDeltaRaDec(self, x, y, cd11, cd12, cd21, cd22):
1184  """Compute the distance on the sphere from x2, y1 to x1, y1.
1185 
1186  Parameters
1187  ----------
1188  x : `pandas.Series`
1189  X pixel coordinate.
1190  y : `pandas.Series`
1191  Y pixel coordinate.
1192  cd11 : `pandas.Series`
1193  [1, 1] element of the local Wcs affine transform.
1194  cd11 : `pandas.Series`
1195  [1, 1] element of the local Wcs affine transform.
1196  cd12 : `pandas.Series`
1197  [1, 2] element of the local Wcs affine transform.
1198  cd21 : `pandas.Series`
1199  [2, 1] element of the local Wcs affine transform.
1200  cd22 : `pandas.Series`
1201  [2, 2] element of the local Wcs affine transform.
1202 
1203  Returns
1204  -------
1205  raDecTuple : tuple
1206  RA and dec conversion of x and y given the local Wcs. Returned
1207  units are in radians.
1208 
1209  """
1210  return (x * cd11 + y * cd12, x * cd21 + y * cd22)
1211 

◆ computeSkySeperation()

def lsst.pipe.tasks.functors.LocalWcs.computeSkySeperation (   self,
  ra1,
  dec1,
  ra2,
  dec2 
)
inherited
Compute the local pixel scale conversion.

Parameters
----------
ra1 : `pandas.Series`
    Ra of the first coordinate in radians.
dec1 : `pandas.Series`
    Dec of the first coordinate in radians.
ra2 : `pandas.Series`
    Ra of the second coordinate in radians.
dec2 : `pandas.Series`
    Dec of the second coordinate in radians.

Returns
-------
dist : `pandas.Series`
    Distance on the sphere in radians.

Definition at line 1212 of file functors.py.

1212  def computeSkySeperation(self, ra1, dec1, ra2, dec2):
1213  """Compute the local pixel scale conversion.
1214 
1215  Parameters
1216  ----------
1217  ra1 : `pandas.Series`
1218  Ra of the first coordinate in radians.
1219  dec1 : `pandas.Series`
1220  Dec of the first coordinate in radians.
1221  ra2 : `pandas.Series`
1222  Ra of the second coordinate in radians.
1223  dec2 : `pandas.Series`
1224  Dec of the second coordinate in radians.
1225 
1226  Returns
1227  -------
1228  dist : `pandas.Series`
1229  Distance on the sphere in radians.
1230  """
1231  deltaDec = dec2 - dec1
1232  deltaRa = ra2 - ra1
1233  return 2 * np.arcsin(
1234  np.sqrt(
1235  np.sin(deltaDec / 2) ** 2
1236  + np.cos(dec2) * np.cos(dec1) * np.sin(deltaRa / 2) ** 2))
1237 

◆ difference()

def lsst.pipe.tasks.functors.Functor.difference (   self,
  data1,
  data2,
**  kwargs 
)
inherited
Computes difference between functor called on two different ParquetTable objects

Definition at line 351 of file functors.py.

351  def difference(self, data1, data2, **kwargs):
352  """Computes difference between functor called on two different ParquetTable objects
353  """
354  return self(data1, **kwargs) - self(data2, **kwargs)
355 

◆ fail()

def lsst.pipe.tasks.functors.Functor.fail (   self,
  df 
)
inherited

Definition at line 356 of file functors.py.

356  def fail(self, df):
357  return pd.Series(np.full(len(df), np.nan), index=df.index)
358 

◆ getSkySeperationFromPixel()

def lsst.pipe.tasks.functors.LocalWcs.getSkySeperationFromPixel (   self,
  x1,
  y1,
  x2,
  y2,
  cd11,
  cd12,
  cd21,
  cd22 
)
inherited
Compute the distance on the sphere from x2, y1 to x1, y1.

Parameters
----------
x1 : `pandas.Series`
    X pixel coordinate.
y1 : `pandas.Series`
    Y pixel coordinate.
x2 : `pandas.Series`
    X pixel coordinate.
y2 : `pandas.Series`
    Y pixel coordinate.
cd11 : `pandas.Series`
    [1, 1] element of the local Wcs affine transform.
cd11 : `pandas.Series`
    [1, 1] element of the local Wcs affine transform.
cd12 : `pandas.Series`
    [1, 2] element of the local Wcs affine transform.
cd21 : `pandas.Series`
    [2, 1] element of the local Wcs affine transform.
cd22 : `pandas.Series`
    [2, 2] element of the local Wcs affine transform.

Returns
-------
Distance : `pandas.Series`
    Arcseconds per pixel at the location of the local WC

Definition at line 1238 of file functors.py.

1238  def getSkySeperationFromPixel(self, x1, y1, x2, y2, cd11, cd12, cd21, cd22):
1239  """Compute the distance on the sphere from x2, y1 to x1, y1.
1240 
1241  Parameters
1242  ----------
1243  x1 : `pandas.Series`
1244  X pixel coordinate.
1245  y1 : `pandas.Series`
1246  Y pixel coordinate.
1247  x2 : `pandas.Series`
1248  X pixel coordinate.
1249  y2 : `pandas.Series`
1250  Y pixel coordinate.
1251  cd11 : `pandas.Series`
1252  [1, 1] element of the local Wcs affine transform.
1253  cd11 : `pandas.Series`
1254  [1, 1] element of the local Wcs affine transform.
1255  cd12 : `pandas.Series`
1256  [1, 2] element of the local Wcs affine transform.
1257  cd21 : `pandas.Series`
1258  [2, 1] element of the local Wcs affine transform.
1259  cd22 : `pandas.Series`
1260  [2, 2] element of the local Wcs affine transform.
1261 
1262  Returns
1263  -------
1264  Distance : `pandas.Series`
1265  Arcseconds per pixel at the location of the local WC
1266  """
1267  ra1, dec1 = self.computeDeltaRaDec(x1, y1, cd11, cd12, cd21, cd22)
1268  ra2, dec2 = self.computeDeltaRaDec(x2, y2, cd11, cd12, cd21, cd22)
1269  # Great circle distance for small separations.
1270  return self.computeSkySeperation(ra1, dec1, ra2, dec2)
1271 
1272 

◆ multilevelColumns()

def lsst.pipe.tasks.functors.Functor.multilevelColumns (   self,
  data,
  columnIndex = None,
  returnTuple = False 
)
inherited
Returns columns needed by functor from multilevel dataset

To access tables with multilevel column structure, the `MultilevelParquetTable`
or `DeferredDatasetHandle` need to be passed either a list of tuples or a
dictionary.

Parameters
----------
data : `MultilevelParquetTable` or `DeferredDatasetHandle`

columnIndex (optional): pandas `Index` object
    either passed or read in from `DeferredDatasetHandle`.

`returnTuple` : bool
    If true, then return a list of tuples rather than the column dictionary
    specification.  This is set to `True` by `CompositeFunctor` in order to be able to
    combine columns from the various component functors.

Definition at line 229 of file functors.py.

229  def multilevelColumns(self, data, columnIndex=None, returnTuple=False):
230  """Returns columns needed by functor from multilevel dataset
231 
232  To access tables with multilevel column structure, the `MultilevelParquetTable`
233  or `DeferredDatasetHandle` need to be passed either a list of tuples or a
234  dictionary.
235 
236  Parameters
237  ----------
238  data : `MultilevelParquetTable` or `DeferredDatasetHandle`
239 
240  columnIndex (optional): pandas `Index` object
241  either passed or read in from `DeferredDatasetHandle`.
242 
243  `returnTuple` : bool
244  If true, then return a list of tuples rather than the column dictionary
245  specification. This is set to `True` by `CompositeFunctor` in order to be able to
246  combine columns from the various component functors.
247 
248  """
249  if isinstance(data, DeferredDatasetHandle) and columnIndex is None:
250  columnIndex = data.get(component="columns")
251 
252  # Confirm that the dataset has the column levels the functor is expecting it to have.
253  columnLevels = self._get_data_columnLevels(data, columnIndex)
254 
255  columnDict = {'column': self.columns,
256  'dataset': self.dataset}
257  if self.filt is None:
258  columnLevelNames = self._get_data_columnLevelNames(data, columnIndex)
259  if "band" in columnLevels:
260  if self.dataset == "ref":
261  columnDict["band"] = columnLevelNames["band"][0]
262  else:
263  raise ValueError(f"'filt' not set for functor {self.name}"
264  f"(dataset {self.dataset}) "
265  "and ParquetTable "
266  "contains multiple filters in column index. "
267  "Set 'filt' or set 'dataset' to 'ref'.")
268  else:
269  columnDict['band'] = self.filt
270 
271  if isinstance(data, MultilevelParquetTable):
272  return data._colsFromDict(columnDict)
273  elif isinstance(data, DeferredDatasetHandle):
274  if returnTuple:
275  return self._colsFromDict(columnDict, columnIndex=columnIndex)
276  else:
277  return columnDict
278 

◆ name()

def lsst.pipe.tasks.functors.ConvertPixelToArcseconds.name (   self)
Full name of functor (suitable for figure labels)

Reimplemented from lsst.pipe.tasks.functors.Functor.

Definition at line 1334 of file functors.py.

1334  def name(self):
1335  return f"{self.col}_asArcseconds"
1336 
table::Key< std::string > name
Definition: Amplifier.cc:116

◆ noDup()

def lsst.pipe.tasks.functors.Functor.noDup (   self)
inherited

Definition at line 148 of file functors.py.

148  def noDup(self):
149  if self._noDup is not None:
150  return self._noDup
151  else:
152  return self._defaultNoDup
153 

◆ pixelScaleArcseconds()

def lsst.pipe.tasks.functors.ComputePixelScale.pixelScaleArcseconds (   self,
  cd11,
  cd12,
  cd21,
  cd22 
)
inherited
Compute the local pixel to scale conversion in arcseconds.

Parameters
----------
cd11 : `pandas.Series`
    [1, 1] element of the local Wcs affine transform in radians.
cd11 : `pandas.Series`
    [1, 1] element of the local Wcs affine transform in radians.
cd12 : `pandas.Series`
    [1, 2] element of the local Wcs affine transform in radians.
cd21 : `pandas.Series`
    [2, 1] element of the local Wcs affine transform in radians.
cd22 : `pandas.Series`
    [2, 2] element of the local Wcs affine transform in radians.

Returns
-------
pixScale : `pandas.Series`
    Arcseconds per pixel at the location of the local WC

Definition at line 1285 of file functors.py.

1285  def pixelScaleArcseconds(self, cd11, cd12, cd21, cd22):
1286  """Compute the local pixel to scale conversion in arcseconds.
1287 
1288  Parameters
1289  ----------
1290  cd11 : `pandas.Series`
1291  [1, 1] element of the local Wcs affine transform in radians.
1292  cd11 : `pandas.Series`
1293  [1, 1] element of the local Wcs affine transform in radians.
1294  cd12 : `pandas.Series`
1295  [1, 2] element of the local Wcs affine transform in radians.
1296  cd21 : `pandas.Series`
1297  [2, 1] element of the local Wcs affine transform in radians.
1298  cd22 : `pandas.Series`
1299  [2, 2] element of the local Wcs affine transform in radians.
1300 
1301  Returns
1302  -------
1303  pixScale : `pandas.Series`
1304  Arcseconds per pixel at the location of the local WC
1305  """
1306  return 3600 * np.degrees(np.sqrt(np.fabs(cd11 * cd22 - cd12 * cd21)))
1307 

◆ shortname()

def lsst.pipe.tasks.functors.Functor.shortname (   self)
inherited
Short name of functor (suitable for column name/dict key)

Reimplemented in lsst.pipe.tasks.functors.Color, and lsst.pipe.tasks.functors.MagDiff.

Definition at line 366 of file functors.py.

366  def shortname(self):
367  """Short name of functor (suitable for column name/dict key)
368  """
369  return self.name
370 
371 

Member Data Documentation

◆ col

lsst.pipe.tasks.functors.ConvertPixelToArcseconds.col

Definition at line 1326 of file functors.py.

◆ colCD_1_1

lsst.pipe.tasks.functors.LocalWcs.colCD_1_1
inherited

Definition at line 1177 of file functors.py.

◆ colCD_1_2

lsst.pipe.tasks.functors.LocalWcs.colCD_1_2
inherited

Definition at line 1178 of file functors.py.

◆ colCD_2_1

lsst.pipe.tasks.functors.LocalWcs.colCD_2_1
inherited

Definition at line 1179 of file functors.py.

◆ colCD_2_2

lsst.pipe.tasks.functors.LocalWcs.colCD_2_2
inherited

Definition at line 1180 of file functors.py.

◆ dataset

lsst.pipe.tasks.functors.Functor.dataset
inherited

Definition at line 144 of file functors.py.

◆ filt

lsst.pipe.tasks.functors.Functor.filt
inherited

Definition at line 143 of file functors.py.

◆ name

string lsst.pipe.tasks.functors.ComputePixelScale.name = "PixelScale"
staticinherited

Definition at line 1276 of file functors.py.


The documentation for this class was generated from the following file: