Skip to content

Commit

Permalink
fix overwriting same file multiple times when list of list passed in
Browse files Browse the repository at this point in the history
  • Loading branch information
emolter committed Oct 8, 2024
1 parent 8298c38 commit 9eeddb1
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/stpipe/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,16 +993,18 @@ def save_model(
# list of datamodels, e.g. ModelContainer
output_paths = []
for i, m in enumerate(model):
idx = None if len(model) == 1 else i
output_paths.append(
self.save_model(
m,
idx=idx,
suffix=suffix,
force=force,
**components,
# ignore list of lists. individual steps should handle this
if not isinstance(m, Sequence):
idx = None if len(model) == 1 else i
output_paths.append(
self.save_model(
m,
idx=idx,
suffix=suffix,
force=force,
**components,
)
)
)
return output_paths
else:
# JWST SourceModelContainer takes this path
Expand Down

0 comments on commit 9eeddb1

Please sign in to comment.