Skip to content

Commit

Permalink
Provide asn_n_members=1 when opening dataset for Step to call `ge…
Browse files Browse the repository at this point in the history
…t_crds_parameters` (#142)
  • Loading branch information
braingram authored Feb 27, 2024
2 parents ee5f1ee + 66012fb commit b622618
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- Remove bundled ``configobj`` package in favor of the ``configobj`` package
bundled into ``astropy``. [#122]
- Fix ``datetime.utcnow()`` DeprecationWarning [#134]
- Provide ``asn_n_members=1`` when opening the ``Step`` dataset for
``get_crds_parameters`` [#142]

0.5.1 (2023-10-02)
==================
Expand Down
12 changes: 6 additions & 6 deletions src/stpipe/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,12 +840,12 @@ def get_config_from_reference(cls, dataset, disable=None, crds_observatory=None)
# If the dataset is not an operable instance of AbstractDataModel,
# log as such and return an empty config object
try:
model = cls._datamodels_open(dataset)
if isinstance(model, Sequence):
# Pull out first model in ModelContainer
model = model[0]
crds_parameters = model.get_crds_parameters()
crds_observatory = model.crds_observatory
with cls._datamodels_open(dataset, asn_n_members=1) as model:
if isinstance(model, Sequence):
# Pull out first model in ModelContainer
model = model[0]
crds_parameters = model.get_crds_parameters()
crds_observatory = model.crds_observatory
except (OSError, TypeError, ValueError):
logger.warning("Input dataset is not an instance of AbstractDataModel.")
disable = True
Expand Down

0 comments on commit b622618

Please sign in to comment.