Skip to content

Commit

Permalink
Avoid use of the wrong magic number in source IdFactory creation.
Browse files Browse the repository at this point in the history
This should have been addressed as part of DM-17689, but it somehow
escaped.
  • Loading branch information
TallJimbo committed Sep 27, 2021
1 parent 164d271 commit b82e75f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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

0 comments on commit b82e75f

Please sign in to comment.