Skip to content

Commit

Permalink
Merge pull request #597 from lsst/tickets/DM-32402
Browse files Browse the repository at this point in the history
DM-32402: Update method to merge configs that allows registries.
  • Loading branch information
erykoff committed Nov 8, 2021
2 parents 4927fbd + 1c5b5e5 commit e1af451
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
5 changes: 4 additions & 1 deletion python/lsst/pipe/tasks/makeDiscreteSkyMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ def run(self, wcs_bbox_tuple_list, oldSkyMap=None):
skyMapConfig.raList.extend(oldSkyMap.config.raList)
skyMapConfig.decList.extend(oldSkyMap.config.decList)
skyMapConfig.radiusList.extend(oldSkyMap.config.radiusList)
skyMapConfig.update(**self.config.skyMap.toDict())
configIntersection = {k: getattr(self.config.skyMap, k)
for k in self.config.skyMap.toDict()
if k in skyMapConfig}
skyMapConfig.update(**configIntersection)
circleCenter = lsst.sphgeom.LonLat(circle.getCenter())
skyMapConfig.raList.append(circleCenter[0].asDegrees())
skyMapConfig.decList.append(circleCenter[1].asDegrees())
Expand Down
17 changes: 11 additions & 6 deletions tests/test_isPrimaryFlag.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ def __init__(self, name, bbox, wcs, numPatches):
self.name = name
self.bbox = bbox
self.wcs = wcs
self.numPatchs = numPatches
assert bbox.getWidth()%numPatches == 0
assert bbox.getHeight()%numPatches == 0
self.patchWidth = bbox.getWidth()//numPatches
self.patchHeight = bbox.getHeight()//numPatches
self._numPatches = numPatches
assert bbox.getWidth()%numPatches[0] == 0
assert bbox.getHeight()%numPatches[1] == 0
self.patchWidth = bbox.getWidth()//numPatches[0]
self.patchHeight = bbox.getHeight()//numPatches[1]

def contains(self, coord):
pixel = self.wcs.skyToPixel(coord)
Expand All @@ -98,10 +98,15 @@ def getPatchInfo(self, index):

bbox = Box2I(Point2I(x, y), Extent2I(width, height))

nx, ny = self._numPatches
sequentialIndex = nx*y + x

patchInfo = PatchInfo(
index=index,
innerBBox=bbox,
outerBBox=bbox,
sequentialIndex=sequentialIndex,
tractWcs=self.wcs
)
return patchInfo

Expand Down Expand Up @@ -196,7 +201,7 @@ def testIsScarletPrimaryFlag(self):
# subdivided into 3x3 patches
wcs = self.exposure.getWcs()
tractBBox = Box2I(Point2I(100, 100), Extent2I(900, 900))
skyMap = MockSkyMap([tractBBox], wcs, 3)
skyMap = MockSkyMap([tractBBox], wcs, (3, 3))
tractInfo = skyMap[0]
patchInfo = tractInfo[0, 0]
patchBBox = patchInfo.getInnerBBox()
Expand Down
5 changes: 3 additions & 2 deletions tests/test_makeDiscreteSkyMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

from lsst.utils import getPackageDir
import lsst.utils.tests
from lsst.geom import Extent2I, Box2D
from lsst.geom import Box2D
from lsst.skymap import Index2D
from lsst.daf.persistence import Butler
from lsst.pipe.tasks.makeDiscreteSkyMap import MakeDiscreteSkyMapTask, DiscreteSkyMap

Expand Down Expand Up @@ -75,7 +76,7 @@ def testBasics(self):
self.assertEqual(len(skyMap), 1)
tractInfo = skyMap[0]
self.assertEqual(tractInfo.getId(), 0)
self.assertEqual(tractInfo.getNumPatches(), Extent2I(3, 3))
self.assertEqual(tractInfo.getNumPatches(), Index2D(x=3, y=3))
tractWcs = tractInfo.getWcs()
tractBoxD = Box2D(tractInfo.getBBox())
for skyPoint in coordList:
Expand Down

0 comments on commit e1af451

Please sign in to comment.