Skip to content

Commit 712f671

Browse files
authored
Combine observables, sigmas and noise distributions parameters for model import (#2959)
Combine observables, sigmas and noise distributions parameters for model import. Closes #2923.
1 parent edaba18 commit 712f671

23 files changed

+773
-853
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ See also our [versioning policy](https://amici.readthedocs.io/en/latest/versioni
1414
* `ReturnDataView.posteq_status` and `ReturnDataView.preeq_status` now
1515
return `list[SteadyStateStatus]` instead of an `ndarray[int]` of shape
1616
`(1, 3)`.
17+
* The way the observation model is passed to the different import functions
18+
(`sbml2amici`, `pysb2amici`, ...) has changed:
19+
The information previously split across `observables`, `sigmas`,
20+
`noise_distributions`, `event_observables`, `event_sigmas`, and
21+
`event_noise_distributions` dicts is now passed as a single
22+
`observation_model: list[MeasurementChannel]` argument.
23+
* `assignmentRules2observables` has been renamed to
24+
`assignment_rules_to_observables` and now returns `list[MeasurementChannel]`
25+
to be passed to the import functions.
26+
* `assignmentRules2observables` has been renamed to
27+
`assignment_rules_to_observables` and now returns `list[MeasurementChannel]`
28+
to be passed to the import functions.
1729
* `AmiVector::getLength` and `AmiVectorArray::getLength` have been renamed to
1830
`size` to be more consistent with STL containers.
1931
* The following deprecated functionality has been removed:

doc/examples/example_presimulation/ExampleExperimentalConditions.ipynb

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,7 @@
189189
{
190190
"cell_type": "markdown",
191191
"metadata": {},
192-
"source": [
193-
"The SBML model specifies a single observable named `pPROT` which describes the fraction of phosphorylated Protein. We load this observable using [amici.assignmentRules2observables](https://amici.readthedocs.io/en/latest/generated/amici.sbml_import.html#amici.sbml_import.assignmentRules2observables)."
194-
]
192+
"source": "The SBML model specifies a single observable named `pPROT` which describes the fraction of phosphorylated Protein. We load this observable using [amici.assignment_rules_to_observables](https://amici.readthedocs.io/en/latest/generated/amici.sbml_import.html#amici.sbml_import.assignment_rules_to_observables)."
195193
},
196194
{
197195
"cell_type": "code",
@@ -211,7 +209,7 @@
211209
],
212210
"source": [
213211
"# Retrieve model output names and formulae from AssignmentRules and remove the respective rules\n",
214-
"observables = amici.assignmentRules2observables(\n",
212+
"observables = amici.assignment_rules_to_observables(\n",
215213
" sbml_importer.sbml, # the libsbml model object\n",
216214
" filter_function=lambda variable: variable.getName() == \"pPROT\",\n",
217215
")\n",
@@ -236,7 +234,7 @@
236234
" model_name,\n",
237235
" model_output_dir,\n",
238236
" verbose=False,\n",
239-
" observables=observables,\n",
237+
" observation_model=observables,\n",
240238
" constant_parameters=fixedParameters,\n",
241239
")\n",
242240
"# load the generated module\n",
@@ -292,7 +290,7 @@
292290
"# Run simulation using default model parameters and solver options\n",
293291
"model.setTimepoints(np.linspace(0, 60, 60))\n",
294292
"rdata = amici.runAmiciSimulation(model, solver)\n",
295-
"amici.plotting.plotObservableTrajectories(rdata)"
293+
"amici.plotting.plot_observable_trajectories(rdata)"
296294
]
297295
},
298296
{
@@ -324,7 +322,7 @@
324322
"edata = amici.ExpData(rdata, 0.1, 0.0)\n",
325323
"edata.fixedParameters = [0, 2]\n",
326324
"rdata = amici.runAmiciSimulation(model, solver, edata)\n",
327-
"amici.plotting.plotObservableTrajectories(rdata)"
325+
"amici.plotting.plot_observable_trajectories(rdata)"
328326
]
329327
},
330328
{
@@ -356,7 +354,7 @@
356354
"source": [
357355
"edata.fixedParametersPreequilibration = [3, 0]\n",
358356
"rdata = amici.runAmiciSimulation(model, solver, edata)\n",
359-
"amici.plotting.plotObservableTrajectories(rdata)"
357+
"amici.plotting.plot_observable_trajectories(rdata)"
360358
]
361359
},
362360
{
@@ -404,7 +402,7 @@
404402
],
405403
"source": [
406404
"rdata = amici.runAmiciSimulation(model, solver, edata)\n",
407-
"amici.plotting.plotObservableTrajectories(rdata)"
405+
"amici.plotting.plot_observable_trajectories(rdata)"
408406
]
409407
},
410408
{
@@ -449,7 +447,7 @@
449447
"print(edata.fixedParametersPresimulation)\n",
450448
"print(edata.fixedParameters)\n",
451449
"rdata = amici.runAmiciSimulation(model, solver, edata)\n",
452-
"amici.plotting.plotObservableTrajectories(rdata)"
450+
"amici.plotting.plot_observable_trajectories(rdata)"
453451
]
454452
}
455453
],

0 commit comments

Comments
 (0)