spacetelescope / jwst

Python library for science observations from the James Webb Space Telescope
https://jwst-pipeline.readthedocs.io/en/latest/
Other
570 stars 167 forks source link

Evaluate usage of SourceModelContainer and remove it if possible #8742

Closed stscijgbot-jp closed 3 weeks ago

stscijgbot-jp commented 2 months ago

Issue JP-3725 was created on JIRA by Ned Molter:

SourceModelContainer is a data structure that's used to make a MultiExposureModel look like a ModelContainer so that those data could be processed through certain steps in calwebb_spec3, namely exp_to_source and extract_1d.  With the likely changes to ModelContainer in this epic, we need to take another look at whether SourceModelContainer is still useful and whether it should be modified or removed entirely from the pipeline.

stscijgbot-jp commented 3 weeks ago

Comment by Ned Molter on JIRA:

Since we decided to retain ModelContainer in JP-3721, there's seemingly nothing wrong with retaining SourceModelContainer as a convenient way to make MultiExposureModels process through the pipeline where ModelContainer is the expected input type.  The class is pretty minimal already, just allowing conversion from/to a MultiExposureModel and saving as a MultiExposureModel.  Plus, this class is only used internally by the pipeline, unlike ModelContainer (which is the default container for asn-type input for stdatamodels.jwst.datamodels.open).

Therefore, this ticket is being de-scoped, and now covers the removal of the DefaultOrderedDict class from exp_to_source.py.  The DefaultOrderedDict was only used when turning MultiExposureModels into SourceModelContainers, which is why it's relevant to re-evaluating of SourceModelContainer.  This class is no longer necessary as of Python 3.7, which specified that the default dict preserves order; the builtin collections.defaultdict can be used instead.  

stscijgbot-jp commented 3 weeks ago

Comment by Ned Molter on JIRA:

Mostly withdrawn, small change that removed unnecessary DefaultOrderedDict class in #8915