Skip to content

Commit

Permalink
Update changelog and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiserls committed Jul 15, 2023
1 parent ed2bab2 commit eec1dc9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 9 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Added

- Added support for for sbml models to select parameters and species used in the inference
- Added support for evaluating sbml models at multiple time points

### Changed

- Switched from using parameter names to using parameter ids in the sbml model

## [0.4.0]

### Added

- Added a new example model, a 2d heat conduction equation
- Added a function to model to specify more complex parameter domains

### Changed

- Removed old functions from corona model
Expand Down
8 changes: 5 additions & 3 deletions docs/source/examples/sbml_example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ Here's a code snippet to load your own sbml model and to do the parameter infere
central_param = np.array([1.0, 1.0]) # initial guess, evaluation must have nonzero density
param_limits = np.array([[0.0, 2.0], [0.0, 2.0]])
param_names = ['k1', 'k2']
param_ids = ['k1', 'k2']
timepoints = np.array([1.0])
model = SBMLModel('model.xml',
model = SBMLModel(sbml_file='model.xml',
central_param=central_param,
param_limits=param_limits,
param_names=param_names)
timepoints=timepoints,
param_ids=param_ids)
inference(model, 'data.csv')
The attribute :py:attr:`~eulerpi.core.model.SBMLModel.param_names` contains the names of the parameters in the sbml model, for which the inference should be performed.
Expand Down
2 changes: 1 addition & 1 deletion eulerpi/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,9 @@ def data_dim(self):
def __init__(
self,
sbml_file: str,
timepoints: list,
central_param: np.ndarray,
param_limits: np.ndarray,
timepoints: list,
param_ids: Optional[list] = None,
state_ids: Optional[list] = None,
skip_creation: bool = False,
Expand Down
2 changes: 1 addition & 1 deletion eulerpi/examples/sbml/sbml_caffeine_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def __init__(

super().__init__(
sbml_file,
timepoints,
central_param,
param_limits,
timepoints,
param_ids,
**kwargs,
)
Expand Down
6 changes: 3 additions & 3 deletions eulerpi/examples/sbml/sbml_menten_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ def __init__(
sbml_file = importlib.resources.path(
"eulerpi.examples.sbml", "sbml_menten_model.xml"
)
timepoints = np.array([0.5, 1.0, 2.0])
timepoints = np.array([0.5, 1.0])
param_ids = ["Km", "kcat"]
state_ids = ["s1"]

super().__init__(
sbml_file,
timepoints,
central_param,
param_limits,
timepoints,
param_ids,
state_ids=state_ids,
state_ids,
**kwargs,
)

Expand Down
15 changes: 14 additions & 1 deletion tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,20 @@ def get_example_name(example):

@pytest.mark.parametrize("example", Examples(), ids=get_example_name)
def test_model_requirements(example):
"""Test the requirements of the inference for the example models."""
"""Perform a simple sanity check on the model. It tests the following:
- The model has a positive parameter dimension
- The model has a positive data dimension
- The model has a valid combination of parameter and data dimension
- The central parameter has the correct shape
- The parameter limits have the correct shape
- The model can be instantiated
- The model forward pass can be calculated
- The model jacobi matrix can be calculated
- The return values of the forward pass and the jacobi matrix have the correct shape
Args:
example: Tuple of the form (module_location, className, dataFileName) or (module_location, className)
"""

# extract example parameters from tuple
try:
Expand Down

0 comments on commit eec1dc9

Please sign in to comment.