Skip to content

Commit 22210bf

Browse files
committed
Merge branch 'tickets/DM-46523'
2 parents b297ab4 + 32fe277 commit 22210bf

File tree

2 files changed

+8
-42
lines changed

2 files changed

+8
-42
lines changed

python/lsst/pipe/tasks/diff_matched_tract_catalog.py

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@
3535
import astropy.table
3636
import astropy.units as u
3737
import numpy as np
38-
import pandas as pd
3938
from smatch.matcher import sphdist
4039
from typing import Sequence
41-
import warnings
4240

4341

4442
def is_sequence_set(x: Sequence):
@@ -300,25 +298,25 @@ def runQuantum(self, butlerQC, inputRefs, outputRefs):
300298

301299
def run(
302300
self,
303-
catalog_ref: pd.DataFrame | astropy.table.Table,
304-
catalog_target: pd.DataFrame | astropy.table.Table,
305-
catalog_match_ref: pd.DataFrame | astropy.table.Table,
306-
catalog_match_target: pd.DataFrame | astropy.table.Table,
301+
catalog_ref: astropy.table.Table,
302+
catalog_target: astropy.table.Table,
303+
catalog_match_ref: astropy.table.Table,
304+
catalog_match_target: astropy.table.Table,
307305
wcs: afwGeom.SkyWcs = None,
308306
) -> pipeBase.Struct:
309307
"""Load matched reference and target (measured) catalogs, measure summary statistics, and output
310308
a combined matched catalog with columns from both inputs.
311309
312310
Parameters
313311
----------
314-
catalog_ref : `pandas.DataFrame` | `astropy.table.Table`
312+
catalog_ref : `astropy.table.Table`
315313
A reference catalog to diff objects/sources from.
316-
catalog_target : `pandas.DataFrame` | `astropy.table.Table`
314+
catalog_target : `astropy.table.Table`
317315
A target catalog to diff reference objects/sources to.
318-
catalog_match_ref : `pandas.DataFrame` | `astropy.table.Table`
316+
catalog_match_ref : `astropy.table.Table`
319317
A catalog with match indices of target sources and selection flags
320318
for each reference source.
321-
catalog_match_target : `pandas.DataFrame` | `astropy.table.Table`
319+
catalog_match_target : `astropy.table.Table`
322320
A catalog with selection flags for each target source.
323321
wcs : `lsst.afw.image.SkyWcs`
324322
A coordinate system to convert catalog positions to sky coordinates,
@@ -333,19 +331,6 @@ def run(
333331
# Would be nice if this could refer directly to ConfigClass
334332
config: DiffMatchedTractCatalogConfig = self.config
335333

336-
is_ref_pd = isinstance(catalog_ref, pd.DataFrame)
337-
is_target_pd = isinstance(catalog_target, pd.DataFrame)
338-
is_match_ref_pd = isinstance(catalog_match_ref, pd.DataFrame)
339-
is_match_target_pd = isinstance(catalog_match_target, pd.DataFrame)
340-
if is_ref_pd:
341-
catalog_ref = astropy.table.Table.from_pandas(catalog_ref)
342-
if is_target_pd:
343-
catalog_target = astropy.table.Table.from_pandas(catalog_target)
344-
if is_match_ref_pd:
345-
catalog_match_ref = astropy.table.Table.from_pandas(catalog_match_ref)
346-
if is_match_target_pd:
347-
catalog_match_target = astropy.table.Table.from_pandas(catalog_match_target)
348-
349334
# Strip any provenance from tables before merging to prevent
350335
# warnings from conflicts being issued by astropy.utils.merge during
351336
# vstack or hstack calls.
@@ -354,11 +339,6 @@ def run(
354339
DatasetProvenance.strip_provenance_from_flat_dict(catalog_match_ref.meta)
355340
DatasetProvenance.strip_provenance_from_flat_dict(catalog_match_target.meta)
356341

357-
# TODO: Remove pandas support in DM-46523
358-
if is_ref_pd or is_target_pd or is_match_ref_pd or is_match_target_pd:
359-
warnings.warn("pandas usage in MatchProbabilisticTask is deprecated; it will be removed "
360-
" in favour of astropy.table after release 28.0.0", category=FutureWarning)
361-
362342
select_ref = catalog_match_ref['match_candidate']
363343
# Add additional selection criteria for target sources beyond those for matching
364344
# (not recommended, but can be done anyway)

tests/test_diff_matched_tract_catalog.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232
from astropy.table import Table
3333
import numpy as np
34-
import pytest
3534

3635

3736
def _error_format(column):
@@ -150,19 +149,6 @@ def test_DiffMatchedTractCatalogTask(self):
150149
catalog_match_target=self.catalog_match_target,
151150
wcs=self.wcs,
152151
)
153-
# TODO: Remove pandas support in DM-46523
154-
with pytest.warns(FutureWarning):
155-
result_pd = task.run(
156-
catalog_ref=self.catalog_ref.to_pandas(),
157-
catalog_target=self.catalog_target.to_pandas(),
158-
catalog_match_ref=self.catalog_match_ref.to_pandas(),
159-
catalog_match_target=self.catalog_match_target.to_pandas(),
160-
wcs=self.wcs,
161-
)
162-
self.assertListEqual(list(result.cat_matched.columns), list(result_pd.cat_matched.columns))
163-
for column in result.cat_matched.columns:
164-
self.assertListEqual(list(result.cat_matched[column]), list(result_pd.cat_matched[column]))
165-
166152
columns_result = list(result.cat_matched.columns)
167153
columns_expect = list(columns_target) + ["match_distance", "match_distanceErr"]
168154
prefix = DiffMatchedTractCatalogConfig.column_matched_prefix_ref.default

0 commit comments

Comments
 (0)