Skip to content

Commit

Permalink
Remove HtmIndex20 DIA functor (DM-32046)
Browse files Browse the repository at this point in the history
Pixelization is now done by Apdb, no need to calculate HTM index on
client side. This also removes reference to ap_HTMIndex plugin from
config, it was removed from meas_base.
  • Loading branch information
andy-slac committed Oct 11, 2021
1 parent 4dbbe83 commit 4686e93
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 47 deletions.
1 change: 0 additions & 1 deletion python/lsst/pipe/tasks/drpDiaCalculationPipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class DrpDiaCalculationPipeConfig(

def setDefaults(self):
self.diaCalculation.plugins = ["ap_meanPosition",
"ap_HTMIndex",
"ap_diaObjectFlag",
"ap_meanFlux",
"ap_percentileFlux",
Expand Down
32 changes: 0 additions & 32 deletions python/lsst/pipe/tasks/functors.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@

from lsst.daf.persistence import doImport
from lsst.daf.butler import DeferredDatasetHandle
import lsst.geom as geom
import lsst.sphgeom as sphgeom

from .parquetTable import ParquetTable, MultilevelParquetTable

Expand Down Expand Up @@ -712,36 +710,6 @@ def __call__(self, catalog, **kwargs):
return super().__call__(catalog, **kwargs)


class HtmIndex20(Functor):
"""Compute the level 20 HtmIndex for the catalog.
"""
name = "Htm20"
htmLevel = 20
_radians = True

def __init__(self, ra, decl, **kwargs):
self.pixelator = sphgeom.HtmPixelization(self.htmLevel)
self.ra = ra
self.decl = decl
self._columns = [self.ra, self.decl]
super().__init__(**kwargs)

def _func(self, df):

def computePixel(row):
if self._radians:
sphPoint = geom.SpherePoint(row[self.ra],
row[self.decl],
geom.radians)
else:
sphPoint = geom.SpherePoint(row[self.ra],
row[self.decl],
geom.degrees)
return self.pixelator.index(sphPoint.getVector())

return df.apply(computePixel, axis=1)


def fluxName(col):
if not col.endswith('_instFlux'):
col += '_instFlux'
Expand Down
15 changes: 1 addition & 14 deletions tests/test_functors.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
LocalDipoleMeanFlux, LocalDipoleMeanFluxErr,
LocalDipoleDiffFlux, LocalDipoleDiffFluxErr,
LocalWcs, ComputePixelScale, ConvertPixelToArcseconds,
ConvertPixelSqToArcsecondsSq, Ratio, HtmIndex20)
ConvertPixelSqToArcsecondsSq, Ratio)

ROOT = os.path.abspath(os.path.dirname(__file__))

Expand Down Expand Up @@ -765,19 +765,6 @@ def testRatio(self):
atol=1e-16,
rtol=1e-16))

def testHtm(self):
"""Test that HtmIndxes are created as expected.
"""
parq = self.simulateMultiParquet(self.dataDict)
func = HtmIndex20("coord_ra", "coord_dec")

val = self._funcVal(func, parq)
# Test that the HtmIds come out as the ra/dec in dataDict.
self.assertTrue(np.all(np.equal(
val.values,
[14924528684992, 14924528689697, 14924528501716, 14924526434259,
14924526433879])))


class MyMemoryTestCase(lsst.utils.tests.MemoryTestCase):
pass
Expand Down

0 comments on commit 4686e93

Please sign in to comment.