Skip to content

Commit

Permalink
Merge pull request #578 from lsst/tickets/DM-31849
Browse files Browse the repository at this point in the history
DM-31849: Avoid use of the wrong magic number in source IdFactory creation.
  • Loading branch information
TallJimbo committed Sep 29, 2021
2 parents fc06ea4 + f234ed8 commit 4c23fc0
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 4c23fc0

Please sign in to comment.