kammerje / spaceKLIP

Pipeline for reducing JWST high-contrast imaging data. Published in Kammerer et al. 2022 and Carter et al. 2022.
https://ui.adsabs.harvard.edu/abs/2022SPIE12180E..3NK/abstract
MIT License
16 stars 9 forks source link

Replace pysynphot #145

Closed JarronL closed 3 months ago

JarronL commented 6 months ago

With the deprecation of pysynphot in favor of synphot and stsynphot packages, webbpsf_ext no longer uses pysynphot and instead subclasses a number of the synphot/stsynphot to include the pysynphot-like attributes and properties while also having access to all the astropy units information.

JarronL commented 3 months ago

Some notes about the synphot / stsynphot implementation in webbpsf_ext. Because of the prolific use of calls to pysynphot-specific attributes that no longer exist in synphot, it was not practical to replace all pysynphot calls with a drop-in synphot version, because they didn't exist without a major refactor of the webbpsf_ext code. Instead, the more convenient method was to create a "synphot_ext" set of of subclasses that adds back many of the more commonly used pysynphot attributes as shortcuts to call the underlying synphot functions. For example, the wave attribute from pysynphot was heavily used, so now I'm just doing a unit conversion of waveset [astropy units] and extracting the value equivalent to the waveunit attribute. So, these subclasses provide backwards compatibility with pysynphot calls while also being compatible with more modern synphot usage going forward. There are also an extensive number of automated tests through CI workflows (in webbpsf_ext) to ensure that all of the synphot_ext subclasses indeed provide the same results as their equivalent synphot and pysynphot classes. I've had this implementation working for a 3-4 months on my own machines and haven't run into any problems so far.