Done
Pinned fields
Click on the next to a field label to start pinning.
Details
Details
Assignee
Jim Bosch
Jim BoschReporter
Jim Bosch
Jim BoschLabels
Reviewers
Tim Jenness
Story Points
2
RubinTeam
Data Release Production
Components
Checklist
Checklist
Created February 7, 2021 at 4:59 PM
Updated May 9, 2021 at 6:10 PM
Resolved May 9, 2021 at 6:10 PM
While working on DM-28583, I noticed some structural problems with our FITS image formatters that should probably be out of scope for that ticket, but are worth fixing at some point. DM-28583 will take care of splitting FitsExposureFormatter into a base class and an Exposure specialization (it's really not good substitutability for the Image/Mask/MaskedImage specializations to inherit from the Exposure one), but that will still leave too much Exposure-only stuff (and MaskedImage-only stuff) in the base class.
I also don't think we should be running astro_metadata_translator's fix_headers in this formatter - we absolutely should be in FitsRawExposureFormatter, but after we read (patched) raws and rewrite that (patched) metadata into downstream image-like datasets, we shouldn't need to patch those again on read. That will hopefully make it possible to just delegate directly to afw.image.ExposureFitsReader more often (I'm guessing this is why we can't use its readMetadata and instead write our own (expensive?) stripping here), and reduce confusing differences between what Butler does and what direct FITS I/O does. It also suggests that perhaps FitsRawExposureFormatter should not inherit from FitsExposureFormatter (or even the latter's new base class), which would IMO be a good idea for other reasons - the overall flow between their many methods is quite different, and maintaining inheritance obfuscates both cases.
I'm also a little uncomfortable with the approach I'm (currently) taking on DM-28583 of adding the Reader instance as a Formatter instance attribute in some methods so downstream methods can use it, just because I think that's a bad pattern for how to share state between methods, but it seems to be the only one that really works without major changes to the method structure (maybe going down all the way to Formatter itself). So that issue may be out of scope for this ticket (and I'm not totally sure it's worth worrying about), but it's worth looking for opportunities to fix it as part of any refactor.
Finally, we need to remember that we can't change the names or module paths of any of the concrete (most-derived) Formatter classes as part of any restructuring - those are already baked into data repositories that we don't want to break.
(I'm assigning this to Arch as a "generic middleware ticket", not because I'm asking to do it, let alone do it now.)