@@ -267,11 +267,11 @@ def sbml2amici(
267267 self ,
268268 model_name : str ,
269269 output_dir : str | Path = None ,
270- observables : dict [str , dict [str , str ]] = None ,
271- event_observables : dict [str , dict [str , str ]] = None ,
270+ observables : dict [str , dict [str , str | sp . Expr ]] = None ,
271+ event_observables : dict [str , dict [str , str | sp . Expr ]] = None ,
272272 constant_parameters : Iterable [str ] = None ,
273- sigmas : dict [str , str | float ] = None ,
274- event_sigmas : dict [str , str | float ] = None ,
273+ sigmas : dict [str , str | float | sp . Expr ] = None ,
274+ event_sigmas : dict [str , str | float | sp . Expr ] = None ,
275275 noise_distributions : dict [str , str | Callable ] = None ,
276276 event_noise_distributions : dict [str , str | Callable ] = None ,
277277 verbose : int | bool = logging .ERROR ,
@@ -313,23 +313,53 @@ def sbml2amici(
313313
314314 :param observables:
315315 Observables to be added to the model:
316- ``dictionary( observableId:{'name':observableName
317- (optional), 'formula':formulaString)})``.
316+
317+ .. code-block::
318+
319+ dict(
320+ observableId: {
321+ 'name': observableName, # optional
322+ 'formula': formulaString or sympy expression,
323+ }
324+ )
325+
326+ If the observation function is passed as a string,
327+ it will be passed to :func:`sympy.sympify`.
318328
319329 :param event_observables:
320330 Event observables to be added to the model:
321- ``dictionary( eventObservableId:{'name':eventObservableName
322- (optional), 'event':eventId, 'formula':formulaString)})``
331+
332+ .. code-block::
333+
334+ dict(
335+ eventObservableId: {
336+ 'name': eventObservableName, # optional
337+ 'event':eventId,
338+ 'formula': formulaString or sympy expression,
339+ }
340+ )
341+
342+ If the formula is passed as a string, it will be passed to
343+ :func:`sympy.sympify`.
323344
324345 :param constant_parameters:
325346 list of SBML Ids identifying constant parameters
326347
327348 :param sigmas:
328- dictionary(observableId: sigma value or (existing) parameter name)
349+ Expression for the scale parameter of the noise distribution for
350+ each observable. This can be a numeric value, a sympy expression,
351+ or an expression string that will be passed to
352+ :func:`sympy.sympify`.
353+
354+ ``{observableId: sigma}``
329355
330356 :param event_sigmas:
331- dictionary(eventObservableId: sigma value or (existing) parameter
332- name)
357+ Expression for the scale parameter of the noise distribution for
358+ each observable. This can be a numeric value, a sympy expression,
359+ or an expression string that will be passed to
360+ :func:`sympy.sympify`.
361+
362+ ``{eventObservableId: sigma}``
333363
334364 :param noise_distributions:
335365 dictionary(observableId: noise type).
@@ -1922,8 +1952,8 @@ def get_empty_bolus_value() -> sp.Float:
19221952 @log_execution_time ("processing SBML observables" , logger )
19231953 def _process_observables (
19241954 self ,
1925- observables : dict [str , dict [str , str ]] | None ,
1926- sigmas : dict [str , str | float ],
1955+ observables : dict [str , dict [str , str | sp . Expr ]] | None ,
1956+ sigmas : dict [str , str | float | sp . Expr ],
19271957 noise_distributions : dict [str , str ],
19281958 ) -> None :
19291959 """
@@ -3276,8 +3306,8 @@ def _parse_special_functions_sbml(
32763306
32773307
32783308def _validate_observables (
3279- observables : dict [str , dict [str , str ]] | None ,
3280- sigmas : dict [str , str | float ],
3309+ observables : dict [str , dict [str , str | sp . Expr ]] | None ,
3310+ sigmas : dict [str , str | float | sp . Expr ],
32813311 noise_distributions : dict [str , str ],
32823312 events : bool = False ,
32833313) -> None :
0 commit comments