spacetelescope / jwst

Python library for science observations from the James Webb Space Telescope

Home Page:https://jwst-pipeline.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pipeline association handling prevents `in_memory` option for `OutlierDetectionStep`

braingram opened this issue · comments

Running OutlierDetectionStep as part of a pipeline (as is done in calwebb_image3) prevents use of in_memory option.

Near the start of process for calwebb_image3, the input association file is opened with datamodels.open:

with datamodels.open(input_data, asn_exptypes=asn_exptypes) as input_models:

The save_open (in_memory) option is not provided at this point leading to opening of the association (as a ModelContainer) triggering the opening of every file listed in the association. This can be confirmed by opening any association with the same arguments provided above (importantly with save_open set as the default True).

This opened association/ModelContainer is later passed to OutlierDetectionStep:

input_models = self.outlier_detection(input_models)

where the in_memory argument is used:
with datamodels.open(input_data, save_open=self.in_memory) as input_models:

but has no effect as the input to datamodels.open is an already opened ModelContainer which does not use the save_open argument:
elif isinstance(init, self.__class__):

and instead creates references to the already opened models.