Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-31849: Avoid use of the wrong magic number in source IdFactory creation. #578

Merged
merged 1 commit into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions python/lsst/pipe/tasks/simpleAssociation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import lsst.geom as geom
import lsst.pex.config as pexConfig
import lsst.pipe.base as pipeBase
from lsst.obs.base import ExposureIdInfo

from .associationUtils import query_disc, eq2xyz, toIndex

Expand Down Expand Up @@ -102,8 +103,8 @@ def run(self, diaSources, tractPatchId, skymapBits):
healPixIndices = []

# Create Id factory and catalog for creating DiaObjectIds.
idFactory = afwTable.IdFactory.makeSource(tractPatchId,
64 - skymapBits)
exposureIdInfo = ExposureIdInfo(tractPatchId, skymapBits)
idFactory = exposureIdInfo.makeSourceIdFactory()
idCat = afwTable.SourceCatalog(
afwTable.SourceTable.make(afwTable.SourceTable.makeMinimalSchema(),
idFactory))
Expand Down
3 changes: 1 addition & 2 deletions tests/test_simpleAssociation.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ def testAddDiaObject(self):
ccdVisit = diaSrc["ccdVisitId"]
diaSourceId = diaSrc["diaSourceId"]
self.diaSources.set_index(["ccdVisitId", "diaSourceId"], inplace=True)
idFactory = afwTable.IdFactory.makeSource(1234,
64 - 16)
idFactory = afwTable.IdFactory.makeSource(1234, afwTable.IdFactory.computeReservedFromMaxBits(16))
idCat = afwTable.SourceCatalog(
afwTable.SourceTable.make(afwTable.SourceTable.makeMinimalSchema(),
idFactory))
Expand Down