Skip to content

Commit

Permalink
Adjust MockRefcatDataId to conform with usage in other packages
Browse files Browse the repository at this point in the history
Now takes a region parameter and is exported from testUtils.
  • Loading branch information
timj committed Apr 20, 2023
1 parent 415b42d commit 401675c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions python/lsst/meas/algorithms/testUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#

__all__ = ["plantSources", "makeRandomTransmissionCurve", "makeDefectList",
"MockReferenceObjectLoaderFromFiles"]
"MockReferenceObjectLoaderFromFiles", "MockRefcatDataId"]

import numpy as np
import esutil
Expand Down Expand Up @@ -194,13 +194,11 @@ class MockRefcatDataId:
Parameters
----------
pixelization : `lsst.sphgeom.Pixelization`
Pixelization object.
index : `int`
Pixel index number.
region : `lsst.sphgeom.Region`
The region associated with this mock dataId.
"""
def __init__(self, pixelization, index):
self._region = pixelization.pixel(index)
def __init__(self, region):
self._region = region

@property
def region(self):
Expand Down Expand Up @@ -267,7 +265,7 @@ def _createDataIdsAndRefcats(self, filenames, htmLevel, name):
if len(np.unique(ids)) != 1:
raise RuntimeError(f"File {filename} contains more than one pixel at level {htmLevel}")

dataIds.append(MockRefcatDataId(pixelization, ids[0]))
dataIds.append(MockRefcatDataId(pixelization.pixel(ids[0])))
refCats.append(InMemoryDatasetHandle(cat, name=name))

return dataIds, refCats

0 comments on commit 401675c

Please sign in to comment.