Skip to content

Commit

Permalink
Disable subimage access to raws.
Browse files Browse the repository at this point in the history
Gen2 seems to have have always done this incorrectly given that
the flipping that happens in std_raw should have been considered
when interpreting the bounding boxes.  In Gen3 we'll instead refuse
to do it (unless we decide we need it later).

This does slow down a unit test (because we need to read a full file
in it).
  • Loading branch information
TallJimbo committed Dec 17, 2018
1 parent 68fe6fb commit 4d5a006
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions python/lsst/obs/subaru/gen3/hsc/rawFormatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ def makeWcs(self, metadata):
return makeFlippedWcs(wcs, self.FLIP_LR, self.FLIP_TB, center)

def readImage(self, fileDescriptor):
if fileDescriptor.parameters:
# It looks like the Gen2 std_raw code wouldn't have handled
# flipping vs. subimages correctly, so we won't bother to either.
# But we'll make sure no one tries to get a subimage, rather than
# doing something confusing.
raise NotImplementedError("Formatter does not support subimages.")
image = ImageU(fileDescriptor.location.path)
return flipImage(image, self.FLIP_LR, self.FLIP_TB)

Expand Down
5 changes: 2 additions & 3 deletions tests/test_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@ def runIngest(self, files=None):

def runIngestTest(self, files=None):
self.runIngest(files)
parameters = dict(origin=LOCAL, bbox=Box2I(Point2I(0, 0), Point2I(2, 2)))
exposure = self.butler.get("raw", self.dataId, parameters=parameters)
exposure = self.butler.get("raw", self.dataId)
metadata = self.butler.get("raw.metadata", self.dataId)
image = self.butler.get("raw.image", self.dataId, parameters=parameters)
image = self.butler.get("raw.image", self.dataId)
self.assertImagesEqual(exposure.image, image)
self.assertEqual(metadata.toDict(), exposure.getMetadata().toDict())

Expand Down

0 comments on commit 4d5a006

Please sign in to comment.