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-27164: Add task to compute and persist VisitSummary tables #417
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bunch of comments.
Thanks for writing the task topic type page from the start!
I don't see a test for this task. I think there's relevant data in testdata_jointcal, although maybe we shouldn't make that a requirement of this package. Unfortunately, I'm not sure we have another useful test dataset with prepackaged source catalogs. Rewriting run()
so that it takes lists of real objects means that you could at least write a test with in-memory datasets (create a handful of WCS, PhotoCalib, etc. and pass them to run()
, then check what you get out). Otherwise, it would be a fair bit more complicated with butler mocks.
I'm trying to decide whether it matters to create a test for a missing component (e.g. a detector in a visit with a missing SkyWcs). I don't think that would actually happen in practice, but I'm not positive.
doc/lsst.pipe.tasks/tasks/lsst.pipe.tasks.postprocess.ConsolidateVisitSummaryTask.rst
Outdated
Show resolved
Hide resolved
doc/lsst.pipe.tasks/tasks/lsst.pipe.tasks.postprocess.ConsolidateVisitSummaryTask.rst
Outdated
Show resolved
Hide resolved
doc/lsst.pipe.tasks/tasks/lsst.pipe.tasks.postprocess.ConsolidateVisitSummaryTask.rst
Outdated
Show resolved
Hide resolved
cat['visit'] = visit | ||
|
||
if not self.isGen3: | ||
bbox = lsst.geom.BoxI(lsst.geom.PointI(0, 0), lsst.geom.PointI(1, 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you do stick with this if gen3
format, just put this inside the if
below, with a comment that this is to speed up reads. But see my comment about reading composites via "_X" below: I don't think this is even necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think this should go into the else:
below, to make it more obvious that it's only for that. Also, maybe call it "gen2_read_bbox" or something, to distinguish it from the one you're going to persist.
|
||
sph_pts = wcs.pixelToSky(lsst.geom.Box2D(bbox).getCorners()) | ||
rec['raCorners'][:] = [sph.getRa().asDegrees() for sph in sph_pts] | ||
rec['decCorners'][:] = [sph.getDec().asDegrees() for sph in sph_pts] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, degrees. If we can't use an inherently unit-full storage type, I'm torn on whether degrees or radians is most appropriate here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replying to myself: it looks like most pipelines code does output degrees when it's a unit-less quantity, so I guess we'll go with that.
So the tests for this, such as they are, are run in |
a1412fb
to
6eeb304
Compare
8e1999f
to
a62b0c4
Compare
I renamed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the cleanups, and sorry it took me so long to get back to this. A handful more comments. I don't need to look at it again unless you think I should.
Please add a note to the either the Task or class docstring (I'm really torn on which is the best place, so I guess "why not both?") that testing of this happens in ci_hsc_gen3. If someone's looking to modify it, they'll want to know where the tests are.
cat['visit'] = visit | ||
|
||
if not self.isGen3: | ||
bbox = lsst.geom.BoxI(lsst.geom.PointI(0, 0), lsst.geom.PointI(1, 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think this should go into the else:
below, to make it more obvious that it's only for that. Also, maybe call it "gen2_read_bbox" or something, to distinguish it from the one you're going to persist.
|
||
sph_pts = wcs.pixelToSky(lsst.geom.Box2D(bbox).getCorners()) | ||
rec['raCorners'][:] = [sph.getRa().asDegrees() for sph in sph_pts] | ||
rec['decCorners'][:] = [sph.getDec().asDegrees() for sph in sph_pts] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replying to myself: it looks like most pipelines code does output degrees when it's a unit-less quantity, so I guess we'll go with that.
rec['psfIxy'] = shape.getIxy() | ||
im = psf.computeKernelImage(bbox.getCenter()) | ||
# See https://github.com/lsst/meas_base/blob/ | ||
# 750bffe6620e565bda731add1509507f5c40c8bb/src/PsfFlux.cc#L112 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note in this comment that this is for "why this is a reasonable way to compute psfArea", otherwise a random github link doesn't make sense. I think it's maybe better to say "see the calculation of measRecord
in meas_base/src/PsfFlux.cc:112", so we aren't relying on a github link, too.
rec.setBBox(bbox) | ||
rec.setVisitInfo(visitInfo) | ||
rec.setWcs(wcs) | ||
rec.setPhotoCalib(photoCalib) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this changed, but why aren't you persisting the Detector
object here (I'll accept the argument that having the detector id trivially available in the outer metadata is useful)? There's a slot for it in ExposureRecord
. I guess for now it's a constant thing, but eventually it has the possibility of changing during the survey.
rec.setBBox(bbox) | ||
rec.setVisitInfo(visitInfo) | ||
rec.setWcs(wcs) | ||
rec.setPhotoCalib(photoCalib) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe have an explicit note here (or in the class docstring? I'm not sure) about why you aren't including the Psf
, ApCorrMap
, ValidPolygon
, and TransmissionCurve
in the output ExposureRecord
? If someone does know what could be stored in it, they might want to add them here. I'm assuming it's a question of storage size for those things, but a note to that effect (probably here and in the docs both, as I think more) would be useful.
schema.addField('raCorners', type='ArrayD', size=4, | ||
doc='Right Ascension of bounding box corners (degrees)') | ||
schema.addField('decCorners', type='ArrayD', size=4, | ||
doc='Declination of bounding box corners (degrees)') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do wish we had a better way to store these corners, but I can't think of one off hand.
c7598e7
to
3c3664d
Compare
3c3664d
to
264d5b7
Compare
No description provided.