LSST Applications 24.1.5,g02d81e74bb+fa3a7a026e,g180d380827+a53a32eff8,g2079a07aa2+86d27d4dc4,g2305ad1205+c0501b3732,g295015adf3+7d3e92f0ec,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g33d1c0ed96+0e5473021a,g3a166c0a6a+0e5473021a,g3ddfee87b4+5dd1654d75,g48712c4677+3bf1020dcb,g487adcacf7+065c13d9cf,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+d7ac436cfb,g5a732f18d5+53520f316c,g64a986408d+fa3a7a026e,g858d7b2824+fa3a7a026e,g8a8a8dda67+585e252eca,g99cad8db69+a5a909b84f,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+4cf350ccb2,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+f991a0b59f,gc120e1dc64+9ccbfdb8be,gc28159a63d+0e5473021a,gcf0d15dbbd+5dd1654d75,gd96a1ce819+42fd0ee607,gdaeeff99f8+f9a426f77a,ge6526c86ff+0d71447b4b,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gff1a9f87cc+fa3a7a026e
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Static Protected Member Functions | Static Protected Attributes | List of all members
lsst.meas.astrom.match_probabilistic_task.MatchProbabilisticTask Class Reference
Inheritance diagram for lsst.meas.astrom.match_probabilistic_task.MatchProbabilisticTask:
lsst.pipe.tasks.match_tract_catalog_probabilistic.MatchTractCatalogProbabilisticTask

Public Member Functions

Set[str] columns_in_ref (self)
 
Set[str] columns_in_target (self)
 
Tuple[pd.DataFrame, pd.DataFrame, Dict[int, str]] match (self, pd.DataFrame catalog_ref, pd.DataFrame catalog_target, np.array select_ref=None, np.array select_target=None, afwGeom.SkyWcs wcs=None, logging.Logger logger=None, int logging_n_rows=None)
 
pipeBase.Struct run (self, pd.DataFrame catalog_ref, pd.DataFrame catalog_target, afwGeom.SkyWcs wcs=None, **kwargs)
 
 __init__ (self, **kwargs)
 

Public Attributes

 matcher
 

Static Public Attributes

 ConfigClass = MatchProbabilisticConfig
 

Static Protected Member Functions

np.array _apply_select_bool (pd.DataFrame catalog, List[str] columns_true, List[str] columns_false, Optional[np.array] selection)
 

Static Protected Attributes

str _DefaultName = "matchProbabilistic"
 

Detailed Description

Run MatchProbabilistic on a reference and target catalog covering the same tract.

Definition at line 42 of file match_probabilistic_task.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.meas.astrom.match_probabilistic_task.MatchProbabilisticTask.__init__ ( self,
** kwargs )

Reimplemented in lsst.pipe.tasks.match_tract_catalog_probabilistic.MatchTractCatalogProbabilisticTask.

Definition at line 209 of file match_probabilistic_task.py.

209 def __init__(self, **kwargs):
210 super().__init__(**kwargs)
211 self.matcher = MatcherProbabilistic(self.config)

Member Function Documentation

◆ _apply_select_bool()

np.array lsst.meas.astrom.match_probabilistic_task.MatchProbabilisticTask._apply_select_bool ( pd.DataFrame catalog,
List[str] columns_true,
List[str] columns_false,
Optional[np.array] selection )
staticprotected
 Apply additional boolean selection columns.

catalog : `pandas.DataFrame`
    The catalog to select from.
columns_true : `list` [`str`]
    Columns that must be True for selection.
columns_false : `list` [`str`]
    Columns that must be False for selection.
selection : `numpy.array`
    A prior selection array. Default all true.

Returns
-------
selection : `numpy.array`
    The final selection array.

Definition at line 49 of file match_probabilistic_task.py.

54 ) -> np.array:
55 """ Apply additional boolean selection columns.
56
57 catalog : `pandas.DataFrame`
58 The catalog to select from.
59 columns_true : `list` [`str`]
60 Columns that must be True for selection.
61 columns_false : `list` [`str`]
62 Columns that must be False for selection.
63 selection : `numpy.array`
64 A prior selection array. Default all true.
65
66 Returns
67 -------
68 selection : `numpy.array`
69 The final selection array.
70
71 """
72 select_additional = (len(columns_true) + len(columns_false)) > 0
73 if select_additional:
74 if selection is None:
75 selection = np.ones(len(catalog), dtype=bool)
76 for column in columns_true:
77 selection &= catalog[column].values
78 for column in columns_false:
79 selection &= ~catalog[column].values
80 return selection
81

◆ columns_in_ref()

Set[str] lsst.meas.astrom.match_probabilistic_task.MatchProbabilisticTask.columns_in_ref ( self)

Definition at line 83 of file match_probabilistic_task.py.

83 def columns_in_ref(self) -> Set[str]:
84 return self.config.columns_in_ref
85

◆ columns_in_target()

Set[str] lsst.meas.astrom.match_probabilistic_task.MatchProbabilisticTask.columns_in_target ( self)

Definition at line 87 of file match_probabilistic_task.py.

87 def columns_in_target(self) -> Set[str]:
88 return self.config.columns_in_target
89

◆ match()

Tuple[pd.DataFrame, pd.DataFrame, Dict[int, str]] lsst.meas.astrom.match_probabilistic_task.MatchProbabilisticTask.match ( self,
pd.DataFrame catalog_ref,
pd.DataFrame catalog_target,
np.array select_ref = None,
np.array select_target = None,
afwGeom.SkyWcs wcs = None,
logging.Logger logger = None,
int logging_n_rows = None )
Match sources in a reference tract catalog with a target catalog.

Parameters
----------
catalog_ref : `pandas.DataFrame`
    A reference catalog to match objects/sources from.
catalog_target : `pandas.DataFrame`
    A target catalog to match reference objects/sources to.
select_ref : `numpy.array`
    A boolean array of the same length as `catalog_ref` selecting the sources that can be matched.
select_target : `numpy.array`
    A boolean array of the same length as `catalog_target` selecting the sources that can be matched.
wcs : `lsst.afw.image.SkyWcs`
    A coordinate system to convert catalog positions to sky coordinates. Only used if
    `self.config.coords_ref_to_convert` is set.
logger : `logging.Logger`
    A Logger for logging.
logging_n_rows : `int`
    Number of matches to make before outputting incremental log message.

Returns
-------
catalog_out_ref : `pandas.DataFrame`
    Reference matched catalog with indices of target matches.
catalog_out_target : `pandas.DataFrame`
    Reference matched catalog with indices of target matches.

Definition at line 90 of file match_probabilistic_task.py.

99 ) -> Tuple[pd.DataFrame, pd.DataFrame, Dict[int, str]]:
100 """Match sources in a reference tract catalog with a target catalog.
101
102 Parameters
103 ----------
104 catalog_ref : `pandas.DataFrame`
105 A reference catalog to match objects/sources from.
106 catalog_target : `pandas.DataFrame`
107 A target catalog to match reference objects/sources to.
108 select_ref : `numpy.array`
109 A boolean array of the same length as `catalog_ref` selecting the sources that can be matched.
110 select_target : `numpy.array`
111 A boolean array of the same length as `catalog_target` selecting the sources that can be matched.
112 wcs : `lsst.afw.image.SkyWcs`
113 A coordinate system to convert catalog positions to sky coordinates. Only used if
114 `self.config.coords_ref_to_convert` is set.
115 logger : `logging.Logger`
116 A Logger for logging.
117 logging_n_rows : `int`
118 Number of matches to make before outputting incremental log message.
119
120 Returns
121 -------
122 catalog_out_ref : `pandas.DataFrame`
123 Reference matched catalog with indices of target matches.
124 catalog_out_target : `pandas.DataFrame`
125 Reference matched catalog with indices of target matches.
126 """
127 if logger is None:
128 logger = self.log
129
130 config = self.config
131
132 if config.column_ref_order is None:
133 flux_tot = np.nansum(catalog_ref.loc[:, config.columns_ref_flux].values, axis=1)
134 catalog_ref['flux_total'] = flux_tot
135 if config.mag_brightest_ref != -np.inf or config.mag_faintest_ref != np.inf:
136 mag_tot = -2.5*np.log10(flux_tot) + config.coord_format.mag_zeropoint_ref
137 select_mag = (mag_tot >= config.mag_brightest_ref) & (
138 mag_tot <= config.mag_faintest_ref)
139 else:
140 select_mag = np.isfinite(flux_tot)
141 if select_ref is None:
142 select_ref = select_mag
143 else:
144 select_ref &= select_mag
145
146 select_ref = self._apply_select_bool(
147 catalog=catalog_ref,
148 columns_true=config.columns_ref_select_true,
149 columns_false=config.columns_ref_select_false,
150 selection=select_ref
151 )
152 select_target = self._apply_select_bool(
153 catalog=catalog_target,
154 columns_true=config.columns_target_select_true,
155 columns_false=config.columns_target_select_false,
156 selection=select_target
157 )
158
159 logger.info('Beginning MatcherProbabilistic.match with %d/%d ref sources selected vs %d/%d target',
160 np.sum(select_ref), len(select_ref), np.sum(select_target), len(select_target))
161
162 catalog_out_ref, catalog_out_target, exceptions = self.matcher.match(
163 catalog_ref,
164 catalog_target,
165 select_ref=select_ref,
166 select_target=select_target,
167 logger=logger,
168 logging_n_rows=logging_n_rows,
169 wcs=wcs,
170 radec_to_xy_func=radec_to_xy,
171 )
172
173 return catalog_out_ref, catalog_out_target, exceptions
174

◆ run()

pipeBase.Struct lsst.meas.astrom.match_probabilistic_task.MatchProbabilisticTask.run ( self,
pd.DataFrame catalog_ref,
pd.DataFrame catalog_target,
afwGeom.SkyWcs wcs = None,
** kwargs )
Match sources in a reference tract catalog with a target catalog.

Parameters
----------
catalog_ref : `pandas.DataFrame`
    A reference catalog to match objects/sources from.
catalog_target : `pandas.DataFrame`
    A target catalog to match reference objects/sources to.
wcs : `lsst.afw.image.SkyWcs`
    A coordinate system to convert catalog positions to sky coordinates.
    Only needed if `config.coords_ref_to_convert` is used to convert
    reference catalog sky coordinates to pixel positions.
kwargs : Additional keyword arguments to pass to `match`.

Returns
-------
retStruct : `lsst.pipe.base.Struct`
    A struct with output_ref and output_target attribute containing the
    output matched catalogs, as well as a dict

Reimplemented in lsst.pipe.tasks.match_tract_catalog_probabilistic.MatchTractCatalogProbabilisticTask.

Definition at line 176 of file match_probabilistic_task.py.

182 ) -> pipeBase.Struct:
183 """Match sources in a reference tract catalog with a target catalog.
184
185 Parameters
186 ----------
187 catalog_ref : `pandas.DataFrame`
188 A reference catalog to match objects/sources from.
189 catalog_target : `pandas.DataFrame`
190 A target catalog to match reference objects/sources to.
191 wcs : `lsst.afw.image.SkyWcs`
192 A coordinate system to convert catalog positions to sky coordinates.
193 Only needed if `config.coords_ref_to_convert` is used to convert
194 reference catalog sky coordinates to pixel positions.
195 kwargs : Additional keyword arguments to pass to `match`.
196
197 Returns
198 -------
199 retStruct : `lsst.pipe.base.Struct`
200 A struct with output_ref and output_target attribute containing the
201 output matched catalogs, as well as a dict
202 """
203 catalog_ref.reset_index(inplace=True)
204 catalog_target.reset_index(inplace=True)
205 catalog_ref, catalog_target, exceptions = self.match(catalog_ref, catalog_target, wcs=wcs, **kwargs)
206 return pipeBase.Struct(cat_output_ref=catalog_ref, cat_output_target=catalog_target,
207 exceptions=exceptions)
208

Member Data Documentation

◆ _DefaultName

str lsst.meas.astrom.match_probabilistic_task.MatchProbabilisticTask._DefaultName = "matchProbabilistic"
staticprotected

Definition at line 46 of file match_probabilistic_task.py.

◆ ConfigClass

lsst.meas.astrom.match_probabilistic_task.MatchProbabilisticTask.ConfigClass = MatchProbabilisticConfig
static

Definition at line 45 of file match_probabilistic_task.py.

◆ matcher

lsst.meas.astrom.match_probabilistic_task.MatchProbabilisticTask.matcher

Definition at line 211 of file match_probabilistic_task.py.


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