amici.numpy
C++ object views
This module provides views on C++ objects for efficient access.
Functions
|
Evaluate a symbolic expression based on the given simulation outputs. |
Classes
|
Interface class for C++ Exp Data objects that avoids possibly costly copies of member data. |
|
Interface class for C++ |
|
Interface class to expose |
- class amici.numpy.ExpDataView(edata)[source]
Interface class for C++ Exp Data objects that avoids possibly costly copies of member data.
NOTE: This currently assumes that the underlying
ExpData
does not change after instantiating anExpDataView
.- __init__(edata)[source]
Constructor
- Parameters:
edata (
amici.amici.ExpDataPtr
|amici.amici.ExpData
) – pointer to the ExpData instance
- get(k[, d]) D[k] if k in D, else d. d defaults to None.
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- values() an object providing a view on D's values
- class amici.numpy.ReturnDataView(rdata)[source]
Interface class for C++
amici.ReturnData
objects that avoids possibly costly copies of member data.- __init__(rdata)[source]
Constructor
- Parameters:
rdata (
amici.amici.ReturnDataPtr
|amici.amici.ReturnData
) – pointer to theReturnData
instance
- by_id(entity_id, field=None, model=None)[source]
Get the value of a given field for a named entity.
- Parameters:
entity_id (
str
) – The ID of the model entity that is to be extracted fromfield
(e.g. a state ID).field (
str
) – The requested field, e.g. ‘x’ for model states. This is optional if field would be one of{'x', 'y', 'w'}
model (
amici.amici.Model
) – The model from which this ReturnDataView was generated. This is optional if this ReturnData was generated withsolver.getReturnDataReportingMode() == amici.RDataReporting.full
.
- Return type:
numpy.array
- get(k[, d]) D[k] if k in D, else d. d defaults to None.
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- values() an object providing a view on D's values
- class amici.numpy.SwigPtrView(swigptr)[source]
Interface class to expose
std::vector<double>
and scalar members of swig wrapped C++ objects as numpy array attributes and fields. This class is memory efficient as copies of the underlying C++ objects is only created when respective fields are accessed for the first time. Cached copies are used for all subsequent calls.- Variables:
_swigptr – pointer to the C++ object
_field_names – names of members that will be exposed as numpy arrays
_field_dimensions – dimensions of numpy arrays
_cache – dictionary with cached values
- get(k[, d]) D[k] if k in D, else d. d defaults to None.
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- values() an object providing a view on D's values
- amici.numpy.evaluate(expr, rdata)[source]
Evaluate a symbolic expression based on the given simulation outputs.
- Parameters:
expr (
str
|sympy.core.expr.Expr
) – A symbolic expression, e.g. a sympy expression or a string that can be sympified. Can include state variable, expression, and observable IDs, depending on whether the respective data is available in the simulation results. Parameters are not yet supported.rdata (
amici.numpy.ReturnDataView
) – The simulation results.
- Return type:
numpy.array
- Returns:
The evaluated expression for the simulation output timepoints.