LSST Applications g0265f82a02+0e5473021a,g02d81e74bb+0dd8ce4237,g1470d8bcf6+3ea6592b6f,g2079a07aa2+86d27d4dc4,g2305ad1205+5ca4c0b359,g295015adf3+d10818ec9d,g2a9a014e59+6f9be1b9cd,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g3ddfee87b4+703ba97ebf,g487adcacf7+4fa16da234,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+ffa42b374e,g5a732f18d5+53520f316c,g64a986408d+0dd8ce4237,g858d7b2824+0dd8ce4237,g8a8a8dda67+585e252eca,g99cad8db69+d39438377f,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+f1d96605c8,gb0e22166c9+60f28cb32d,gb6a65358fc+0e5473021a,gba4ed39666+c2a2e4ac27,gbb8dafda3b+e5339d463f,gc120e1dc64+da31e9920e,gc28159a63d+0e5473021a,gcf0d15dbbd+703ba97ebf,gdaeeff99f8+f9a426f77a,ge6526c86ff+889fc9d533,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gf18bd8381d+7268b93478,gff1a9f87cc+0dd8ce4237,w.2024.16
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: