variables¶
SBML ids of the variables of a CellML model.
libcellml connects variables of different components into equivalence sets, which the analyser treats as one variable. SBML has one flat id namespace, so every equivalence set becomes one parameter. The id is the name of the analyser's representative when no other analyser variable has that name, otherwise the name is prefixed with the component. Ids are sanitized to SBML SIds; a sanitized id which is already taken gets a numeric suffix.
VariableIds
¶
SBML ids of the variables of an analysed CellML model.
Assign the ids.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
analyser_model
|
AnalyserModel
|
model of a libcellml analyser without errors. |
required |
reserve
¶
Reserve an SId outside the variables, e.g. for the model or an event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sid
|
str
|
name to sanitize and reserve. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The unique SId, sanitized and made unique among the variable ids |
str
|
and every id reserved before it; added to the used ids. |
lookup
¶
SBML id of a variable given by component and name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_name
|
str
|
name of the component. |
required |
variable_name
|
str
|
name of the variable in that component. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The SBML id. |
Raises:
| Type | Description |
|---|---|
KeyError
|
if the variable is not part of the analysed model. |
id_for
¶
SBML id of a libcellml variable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variable
|
Any
|
libcellml variable with a parent component. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The SBML id. |
Raises:
| Type | Description |
|---|---|
KeyError
|
if the variable is not part of the analysed model. |
is_voi_key
¶
Whether a variable is the variable of integration or equivalent to it.
sanitize_id
¶
Make a string a valid SBML SId.
Invalid characters become _; a leading digit or an empty string gets a
_ prefix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
CellML name. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The SId. |
unique_sid
¶
Make an SId unique among the used ones by appending a numeric suffix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sid
|
str
|
sanitized id. |
required |
used
|
set[str]
|
ids taken so far; the returned id is added to it. |
required |
Returns:
| Type | Description |
|---|---|
str
|
|
variable_key
¶
(component name, variable name) of a variable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variable
|
Any
|
libcellml variable with a parent component. |
required |
Returns:
| Type | Description |
|---|---|
tuple[str, str]
|
The key. |
equivalence_set
¶
The variable and every variable connected to it, transitively.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variable
|
Any
|
libcellml variable. |
required |
Returns:
| Type | Description |
|---|---|
list[Any]
|
The variables of the equivalence set, the given one first. |
analyser_variables
¶
Analyser variables of a model other than the voi and the states.
libcellml lists them by type; they are returned as constants, computed constants, algebraic and external variables, the order of the single variable list of libcellml 0.6 for ODE and algebraic models, so the parameters and their ids come out as before.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
analyser_model
|
AnalyserModel
|
model of a libcellml analyser. |
required |
Returns:
| Type | Description |
|---|---|
list[Any]
|
The analyser variables. |