afw.image.Filter has now been removed; getFilterLabel methods are deprecated

I’ve just merged DM-27177, which makes major changes to how we are handling filter information in Science Pipelines. This follows the deprecation of the Filter class and is about one major version behind the original plan presented in Migrating from afw.image.Filter to FilterLabel.

The changes made by DM-27177 will be visible starting from weekly w_2022_24 (expected tomorrow) as well as the Science Pipelines release 24.

Changes

The lsst.afw.Filter class is being removed, as are the various defineFilters and reset methods needed to manage it. This leaves FilterLabel as the only class for representing filter information in exposures.

getFilter and similarly-named methods on Exposure and ExposureInfo now take and return FilterLabel objects, and are functionally identical to the getFilterLabel (etc.) methods added earlier in the transition. The latter methods are now deprecated, and Science Pipelines code has been migrated to use the new getFilter. Apologies for the zig-zagging naming convention, but this is the last migration step: getFilter is expected to be the final filter-related API.

Likewise, Butler exposure datasets now have a filter component that returns a FilterLabel object, and filterLabel is deprecated. I have tried to migrate Science Pipelines code that used the filterLabel component to filter, but I may have missed a few references.

Backward Compatibility

Unlike the introduction of FilterLabel, the latest changes do not change the class used to store filter information, so existing code that uses FilterLabel will continue to work (possibly with deprecation warnings), and there will be no information lost.

Code that still depended on the old getFilter methods will break.

Finally, if there are any Filter datasets persisted to old Gen 3 Butler repositories, they will no longer be readable (and may confuse query-datast-types). This should not be an issue in practice, as it would only affect exposures written with composite disassembly before we began the migration to FilterLabel. In particular, all the “official” repositories are unaffected, as are old exposures written without disassembly.

Future Work

We are roughly one release behind the schedule presented in Migrating from afw.image.Filter to FilterLabel, but are still aiming for a fast transition (per RFC-748). We expect to remove the getFilterLabel methods and the filterLabel Butler component in Science Pipelines release 25. At that point, the transition to FilterLabel will be complete.

Thank you all for your patience through what has turned out to be a very long migration!

1 Like