Skip to content
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

Merged
merged 2 commits into from Nov 13, 2020

Conversation

erykoff
Copy link
Contributor

@erykoff erykoff commented Oct 15, 2020

No description provided.

Copy link
Contributor

@parejkoj parejkoj left a 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.

python/lsst/pipe/tasks/postprocess.py Show resolved Hide resolved
python/lsst/pipe/tasks/postprocess.py 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))
Copy link
Contributor

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.

Copy link
Contributor

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.

python/lsst/pipe/tasks/postprocess.py Outdated Show resolved Hide resolved
python/lsst/pipe/tasks/postprocess.py Show resolved Hide resolved

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]
Copy link
Contributor

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.

Copy link
Contributor

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.

python/lsst/pipe/tasks/postprocess.py Outdated Show resolved Hide resolved
@erykoff
Copy link
Contributor Author

erykoff commented Oct 22, 2020

So the tests for this, such as they are, are run in ci_hsc_gen3, which are activated by adding the task to the pipeline in obs_subaru. That seems to be what is being done for the similar transform table tasks, and I was told that's what should be done.

@erykoff erykoff force-pushed the tickets/DM-27164 branch 2 times, most recently from 8e1999f to a62b0c4 Compare November 10, 2020 22:52
@erykoff
Copy link
Contributor Author

erykoff commented Nov 10, 2020

I renamed run to _combineExposureMetadata to signify that this isn't really a true entry point. I think this is consistent with @TallJimbo 's comments: https://lsstc.slack.com/archives/C2JPT1KB7/p1605045131297300?thread_ts=1605042268.283600&cid=C2JPT1KB7

Copy link
Contributor

@parejkoj parejkoj left a 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))
Copy link
Contributor

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]
Copy link
Contributor

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
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)')
Copy link
Contributor

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.

@erykoff erykoff force-pushed the tickets/DM-27164 branch 2 times, most recently from c7598e7 to 3c3664d Compare November 12, 2020 20:54
@erykoff erykoff merged commit 22db31c into master Nov 13, 2020
@erykoff erykoff deleted the tickets/DM-27164 branch November 13, 2020 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants