Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed Oct 23, 2024
1 parent 8aed878 commit 558c952
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/source/model_library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ Several methods are abstract and will need implementations:
It's likely that a few other methods might require overriding:

- ``_model_to_filename``
- ``_model_to_exptype``
- ``_assign_member_to_model``

Consult the docstrings (and base implementations) for more details.
Expand Down
29 changes: 25 additions & 4 deletions src/stpipe/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,25 @@ def _to_group_id(self, model_or_filename, index):
return f"exposure{index + 1:04d}"

def _model_to_exptype(self, model):
"""
Compute "exptype" from a model using the DataModel interface.
This will be called for every model in the library:
- when the library is created from a list of models
- when _save is called
In both cases the models are all in memory and this method
can use the in memory DataModel to determine the "exptype"
(likely ``model.meta.exptype``).
Parameters
----------
model : DataModel
Returns
-------
exptype : str
Exposure type (for example "SCIENCE").
"""
return getattr(model.meta, "exptype", "SCIENCE")

@property
Expand Down Expand Up @@ -854,10 +873,12 @@ def _model_to_group_id(self, model):
"""
Compute a "group_id" from a model using the DataModel interface.
This will be called for every model in the library ONLY when
the library is created from a list of models. In this case the
models are all in memory and this method can use the in memory
DataModel to determine the "group_id" (likely `model.meta.group_id`).
This will be called for every model in the library:
- when the library is created from a list of models
- when _save is called
In both cases the models are all in memory and this method
can use the in memory DataModel to determine the "group_id"
(likely ``model.meta.group_id``).
If no "group_id" can be determined `NoGroupID` should be
raised (to allow the library to assign a unique "group_id").
Expand Down

0 comments on commit 558c952

Please sign in to comment.