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-27169: Use FilterLabel in Exposure/ExposureInfo #332

Merged
merged 6 commits into from Dec 9, 2020

Conversation

kfindeisen
Copy link
Member

@kfindeisen kfindeisen commented Nov 26, 2020

This PR adds support for a filterLabel component in both Gen 2 and Gen 3, and removes some special handling of Filter that is not necessary when writing the ExposureInfo format introduced on lsst/afw#551. As in lsst/daf_butler#446, the filterLabel component is a temporary backwards-compatibility measure, to be removed once we no longer need to also support Filter.

This PR also updates one of the raw-file tests to use FilterLabel, because the backwards-compatibility code introduced in lsst/afw#551 cannot easily handle prior filter conventions for both raw exposures and calexps, and the calexp conventions are more widely used.

Copy link
Member

@timj timj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gen2 looks fine although I haven't really looked at it.

The gen3 code will need testing in ci_hsc_gen3 in multiprocessing mode and with composite disassembly enabled (something we don't do by default). I don't really understand why we want disassembly to create a filter and filterLabel component or why we want to be able to assemble a disassembled Exposure that has both filter and filterLabel defined.

python/lsst/obs/base/exposureAssembler.py Show resolved Hide resolved
python/lsst/obs/base/exposureAssembler.py Outdated Show resolved Hide resolved
python/lsst/obs/base/exposureAssembler.py Show resolved Hide resolved
Copy link
Collaborator

@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.

This looks good: thanks for all the detailed "deprecate in X" comments.

# obs_test does not have physical filters, so include a fallback
exposureFilter = exp.getFilterLabel()
filterName = exposureFilter.physicalLabel if exposureFilter.hasPhysicalLabel() \
else exposureFilter.bandLabel
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm torn on whether this should be an x=if y else z or if y:\nx=...\nelse:\n. Since it's long enough to need a new line anyway, I don't know that this is an improvement. I never quite know myself what to do in this kind of case.

Copy link
Member Author

@kfindeisen kfindeisen Dec 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer conditional expressions when I want to make it clear that something is getting assigned, and it's just a question of what. This is especially true in languages that can't enforce that a variable is set exactly once.

python/lsst/obs/base/cameraMapper.py Show resolved Hide resolved
python/lsst/obs/base/exposureAssembler.py Outdated Show resolved Hide resolved
@kfindeisen
Copy link
Member Author

kfindeisen commented Dec 8, 2020

@timj, sorry to bother you again, but I'd appreciate it if you could take a look at the delegation-based code. This version passes ci_hsc_gen3 with forced decomposition.

Copy link
Member

@timj timj 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 changing it. Looks good to me.

python/lsst/obs/base/formatters/filter.py Outdated Show resolved Hide resolved
This change simplifies the component code by reducing special-casing.
This code is backwards-compatible with old Exposure files.

This change also updates tests/data/calexp.fits to use the current
ExposureInfo format, to avoid spurious round-trip errors from the
input and output version numbers not matching.
The Filter component remains for backward-compatibility (in parallel
with Exposure::getFilter()). Both will be deprecated on DM-27170
and removed on DM-27177; keeping them in sync simplifies things
for users.
The Filter component remains for backward-compatibility (in parallel
with Exposure::getFilter()). Both will be deprecated on DM-27170
and removed on DM-27177; keeping them in sync simplifies things
for users.
These tests specifically require the physical filter, but changes in
afw mean that Filter.getName() only returns the physical filter if
there are no other names for it.
@kfindeisen kfindeisen merged commit d10a12c into master Dec 9, 2020
@kfindeisen kfindeisen deleted the tickets/DM-27169 branch December 9, 2020 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants