LSST Applications 27.0.0,g0265f82a02+469cd937ee,g02d81e74bb+21ad69e7e1,g1470d8bcf6+cbe83ee85a,g2079a07aa2+e67c6346a6,g212a7c68fe+04a9158687,g2305ad1205+94392ce272,g295015adf3+81dd352a9d,g2bbee38e9b+469cd937ee,g337abbeb29+469cd937ee,g3939d97d7f+72a9f7b576,g487adcacf7+71499e7cba,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+df404f777f,g5a732f18d5+be83d3ecdb,g64a986408d+21ad69e7e1,g858d7b2824+21ad69e7e1,g8a8a8dda67+a6fc98d2e7,g99cad8db69+f62e5b0af5,g9ddcbc5298+d4bad12328,ga1e77700b3+9c366c4306,ga8c6da7877+71e4819109,gb0e22166c9+25ba2f69a1,gb6a65358fc+469cd937ee,gbb8dafda3b+69d3c0e320,gc07e1c2157+a98bf949bb,gc120e1dc64+615ec43309,gc28159a63d+469cd937ee,gcf0d15dbbd+72a9f7b576,gdaeeff99f8+a38ce5ea23,ge6526c86ff+3a7c1ac5f1,ge79ae78c31+469cd937ee,gee10cc3b42+a6fc98d2e7,gf1cff7945b+21ad69e7e1,gfbcc870c63+9a11dc8c8f
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
lsst.meas.astrom.matcher_probabilistic.ConvertCatalogCoordinatesConfig Class Reference
Inheritance diagram for lsst.meas.astrom.matcher_probabilistic.ConvertCatalogCoordinatesConfig:

Public Member Functions

 format_catalogs (self, pd.DataFrame catalog_ref, pd.DataFrame catalog_target, np.array select_ref=None, np.array select_target=None, Callable radec_to_xy_func=None, bool return_converted_columns=False, **kwargs)
 

Static Public Attributes

 column_ref_coord1
 
 column_ref_coord2
 
 column_target_coord1
 
 column_target_coord2
 
 coords_spherical
 
 coords_ref_factor
 
 coords_target_factor
 
 coords_ref_to_convert
 
 mag_zeropoint_ref
 

Detailed Description

Configuration for the MatchProbabilistic matcher.

Definition at line 120 of file matcher_probabilistic.py.

Member Function Documentation

◆ format_catalogs()

lsst.meas.astrom.matcher_probabilistic.ConvertCatalogCoordinatesConfig.format_catalogs ( self,
pd.DataFrame catalog_ref,
pd.DataFrame catalog_target,
np.array select_ref = None,
np.array select_target = None,
Callable radec_to_xy_func = None,
bool return_converted_columns = False,
** kwargs )
Format matched catalogs that may require coordinate conversions.

Parameters
----------
catalog_ref : `pandas.DataFrame`
    A reference catalog for comparison to `catalog_target`.
catalog_target : `pandas.DataFrame`
    A target catalog with measurements for comparison to `catalog_ref`.
select_ref : `numpy.ndarray`, (Nref,)
    A boolean array of len `catalog_ref`, True for valid match candidates.
select_target : `numpy.ndarray`, (Ntarget,)
    A boolean array of len `catalog_target`, True for valid match candidates.
radec_to_xy_func : `typing.Callable`
    Function taking equal-length ra, dec arrays and returning an ndarray of
    - ``x``: current parameter (`float`).
    - ``extra_args``: additional arguments (`dict`).
return_converted_columns : `bool`
    Whether to return converted columns in the `coord1` and `coord2`
    attributes, rather than keep the original values.
kwargs

Returns
-------
compcat_ref, compcat_target : `ComparableCatalog`
    Comparable catalogs corresponding to the input reference and target.

Definition at line 181 of file matcher_probabilistic.py.

190 ):
191 """Format matched catalogs that may require coordinate conversions.
192
193 Parameters
194 ----------
195 catalog_ref : `pandas.DataFrame`
196 A reference catalog for comparison to `catalog_target`.
197 catalog_target : `pandas.DataFrame`
198 A target catalog with measurements for comparison to `catalog_ref`.
199 select_ref : `numpy.ndarray`, (Nref,)
200 A boolean array of len `catalog_ref`, True for valid match candidates.
201 select_target : `numpy.ndarray`, (Ntarget,)
202 A boolean array of len `catalog_target`, True for valid match candidates.
203 radec_to_xy_func : `typing.Callable`
204 Function taking equal-length ra, dec arrays and returning an ndarray of
205 - ``x``: current parameter (`float`).
206 - ``extra_args``: additional arguments (`dict`).
207 return_converted_columns : `bool`
208 Whether to return converted columns in the `coord1` and `coord2`
209 attributes, rather than keep the original values.
210 kwargs
211
212 Returns
213 -------
214 compcat_ref, compcat_target : `ComparableCatalog`
215 Comparable catalogs corresponding to the input reference and target.
216
217 """
218 convert_ref = self.coords_ref_to_convert
219 if convert_ref and not callable(radec_to_xy_func):
220 raise TypeError('radec_to_xy_func must be callable if converting ref coords')
221
222 # Set up objects with frequently-used attributes like selection bool array
223 extras_ref, extras_target = (
224 CatalogExtras(catalog, select=select, coordinate_factor=coord_factor)
225 for catalog, select, coord_factor in zip(
226 (catalog_ref, catalog_target),
227 (select_ref, select_target),
228 (self.coords_ref_factor, self.coords_target_factor),
229 )
230 )
231
232 compcats = []
233
234 # Retrieve coordinates and multiply them by scaling factors
235 for catalog, extras, (column1, column2), convert in (
236 (catalog_ref, extras_ref, (self.column_ref_coord1, self.column_ref_coord2), convert_ref),
237 (catalog_target, extras_target, (self.column_target_coord1, self.column_target_coord2), False),
238 ):
239 coord1, coord2 = (
240 _mul_column(catalog[column], extras.coordinate_factor)
241 for column in (column1, column2)
242 )
243 if convert:
244 xy_ref = radec_to_xy_func(coord1, coord2, self.coords_ref_factor, **kwargs)
245 for idx_coord, column_out in enumerate(self.coords_ref_to_convert.values()):
246 coord = np.array([xy[idx_coord] for xy in xy_ref])
247 catalog[column_out] = coord
248 if convert_ref and return_converted_columns:
249 column1, column2 = self.coords_ref_to_convert.values()
250 coord1, coord2 = catalog[column1], catalog[column2]
251 if isinstance(coord1, pd.Series):
252 coord1 = coord1.values
253 if isinstance(coord2, pd.Series):
254 coord2 = coord2.values
255
256 compcats.append(ComparableCatalog(
257 catalog=catalog, column_coord1=column1, column_coord2=column2,
258 coord1=coord1, coord2=coord2, extras=extras,
259 ))
260
261 return tuple(compcats)
262
263

Member Data Documentation

◆ column_ref_coord1

lsst.meas.astrom.matcher_probabilistic.ConvertCatalogCoordinatesConfig.column_ref_coord1
static
Initial value:
= pexConfig.Field(
dtype=str,
default='ra',
doc='The reference table column for the first spatial coordinate (usually x or ra).',
)

Definition at line 123 of file matcher_probabilistic.py.

◆ column_ref_coord2

lsst.meas.astrom.matcher_probabilistic.ConvertCatalogCoordinatesConfig.column_ref_coord2
static
Initial value:
= pexConfig.Field(
dtype=str,
default='dec',
doc='The reference table column for the second spatial coordinate (usually y or dec).'
'Units must match column_ref_coord1.',
)

Definition at line 128 of file matcher_probabilistic.py.

◆ column_target_coord1

lsst.meas.astrom.matcher_probabilistic.ConvertCatalogCoordinatesConfig.column_target_coord1
static
Initial value:
= pexConfig.Field(
dtype=str,
default='coord_ra',
doc='The target table column for the first spatial coordinate (usually x or ra).'
'Units must match column_ref_coord1.',
)

Definition at line 134 of file matcher_probabilistic.py.

◆ column_target_coord2

lsst.meas.astrom.matcher_probabilistic.ConvertCatalogCoordinatesConfig.column_target_coord2
static
Initial value:
= pexConfig.Field(
dtype=str,
default='coord_dec',
doc='The target table column for the second spatial coordinate (usually y or dec).'
'Units must match column_ref_coord2.',
)

Definition at line 140 of file matcher_probabilistic.py.

◆ coords_ref_factor

lsst.meas.astrom.matcher_probabilistic.ConvertCatalogCoordinatesConfig.coords_ref_factor
static
Initial value:
= pexConfig.Field(
dtype=float,
default=1.0,
doc='Multiplicative factor for reference catalog coordinates.'
'If coords_spherical is true, this must be the number of degrees per unit increment of '
'column_ref_coord[12]. Otherwise, it must convert the coordinate to the same units'
' as the target coordinates.',
)

Definition at line 151 of file matcher_probabilistic.py.

◆ coords_ref_to_convert

lsst.meas.astrom.matcher_probabilistic.ConvertCatalogCoordinatesConfig.coords_ref_to_convert
static
Initial value:
= pexConfig.DictField(
default=None,
optional=True,
keytype=str,
itemtype=str,
dictCheck=lambda x: len(x) == 2,
doc='Dict mapping sky coordinate columns to be converted to pixel columns',
)

Definition at line 167 of file matcher_probabilistic.py.

◆ coords_spherical

lsst.meas.astrom.matcher_probabilistic.ConvertCatalogCoordinatesConfig.coords_spherical
static
Initial value:
= pexConfig.Field(
dtype=bool,
default=True,
doc='Whether column_*_coord[12] are spherical coordinates (ra/dec) or not (pixel x/y)',
)

Definition at line 146 of file matcher_probabilistic.py.

◆ coords_target_factor

lsst.meas.astrom.matcher_probabilistic.ConvertCatalogCoordinatesConfig.coords_target_factor
static
Initial value:
= pexConfig.Field(
dtype=float,
default=1.0,
doc='Multiplicative factor for target catalog coordinates.'
'If coords_spherical is true, this must be the number of degrees per unit increment of '
'column_target_coord[12]. Otherwise, it must convert the coordinate to the same units'
' as the reference coordinates.',
)

Definition at line 159 of file matcher_probabilistic.py.

◆ mag_zeropoint_ref

lsst.meas.astrom.matcher_probabilistic.ConvertCatalogCoordinatesConfig.mag_zeropoint_ref
static
Initial value:
= pexConfig.Field(
dtype=float,
default=31.4,
doc='Magnitude zeropoint for reference catalog.',
)

Definition at line 175 of file matcher_probabilistic.py.


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