petab.v1.models.model
PEtab model abstraction
Functions
|
Create a PEtab model instance from the given model |
Classes
|
Base class for wrappers for any PEtab-supported model type |
- class petab.v1.models.model.Model[source]
Bases:
ABCBase class for wrappers for any PEtab-supported model type
- abstractmethod static from_file(filepath_or_buffer: Any, model_id: str, base_path: str | Path = None) Model[source]
Load the model from the given path/URL
- Parameters:
filepath_or_buffer – Absolute or relative path/URL to the model file. If relative, it is interpreted relative to base_path, if given.
base_path – Base path for relative paths in the model file.
model_id – Model ID
- Returns:
A
Modelinstance holding the given model
- abstractmethod get_free_parameter_ids_with_values() Iterable[tuple[str, float]][source]
Get free model parameters along with their values
- Returns:
Iterator over tuples of (parameter_id, parameter_value)
- abstractmethod get_parameter_ids() Iterable[str][source]
Get all parameter IDs from this model
- Returns:
Iterator over model parameter IDs
- abstractmethod get_parameter_value(id_: str) float[source]
Get a parameter value
- Parameters:
id – ID of the parameter whose value is to be returned
- Raises:
ValueError – If no parameter with the given ID exists
- Returns:
The value of the given parameter as specified in the model
- abstractmethod get_valid_ids_for_condition_table() Iterable[str][source]
Get IDs of all model entities that are allowed to occur as columns in the PEtab conditions table.
- Returns:
Iterator over model entity IDs
- abstractmethod get_valid_parameters_for_parameter_table() Iterable[str][source]
Get IDs of all parameters that are allowed to occur in the PEtab parameters table
- Returns:
Iterator over parameter IDs
- abstractmethod has_entity_with_id(entity_id) bool[source]
Check if there is a model entity with the given ID
- Parameters:
entity_id – ID to check for
- Returns:
True, if there is an entity with the given ID,Falseotherwise
- abstractmethod is_state_variable(id_: str) bool[source]
Check whether the given ID corresponds to a model state variable
- abstractmethod is_valid() bool[source]
Validate this model
- Returns:
True if the model is valid, False if there are errors in this model
- abstract property model_id
- abstractmethod symbol_allowed_in_observable_formula(id_: str) bool[source]
Check if the given ID is allowed to be used in observable and noise formulas
- Returns:
True, if allowed,Falseotherwise
- abstractmethod to_file(filename: str | Path | None = None)[source]
Save the model to the given file
- Parameters:
filename – Destination filename
- abstract class property type_id
- petab.v1.models.model.model_factory(filepath_or_buffer: Any, model_language: str, model_id: str = None, base_path: str | Path = None) Model[source]
Create a PEtab model instance from the given model
- Parameters:
filepath_or_buffer – Path/URL of the model. Absolute or relative to base_path if given.
base_path – Base path for relative paths in the model file.
model_language – PEtab model language ID for the given model
model_id – PEtab model ID for the given model
- Returns:
A
Modelinstance representing the given model