Model
- class glotaran.model.model.Model(*, megacomplex_types: dict[str, type[Megacomplex]], default_megacomplex_type: str | None = None, dataset_group_models: dict[str, DatasetGroupModel] = None)[source]
Bases:
object
A base class for global analysis models.
Attributes Summary
The default megacomplex used by this model.
Deprecated use
Scheme.global_dimensions['<dataset_name>']
insteadAlias for glotaran.model.megacomplex.
The megacomplex types used by this model.
Deprecated use
Scheme.model_dimensions['<dataset_name>']
insteadThe model_items types used by this model.
Methods Summary
Creates a model from a dictionary.
Create a Model instance from the specs defined in a file.
Formats the model as Markdown string.
Returns true if e.g.
Returns a list with all problems in the model and missing parameters if specified.
Returns True if the number problems in the model is 0, else False
Returns a string listing all problems in the model and missing parameters if specified.
Methods Documentation
- property dataset_group_models: dict[str, DatasetGroupModel]
- classmethod from_dict(model_dict: dict[str, Any], *, megacomplex_types: dict[str, type[Megacomplex]] | None = None, default_megacomplex_type: str | None = None) Model [source]
Creates a model from a dictionary.
- get_dataset_groups() dict[str, DatasetGroup] [source]
- property global_dimension
Deprecated use
Scheme.global_dimensions['<dataset_name>']
instead
- property global_megacomplex: dict[str, Megacomplex]
Alias for glotaran.model.megacomplex. Needed internally.
- loader(format_name: str = None, **kwargs: Any) Model
Create a Model instance from the specs defined in a file.
- Parameters
file_name (StrOrPath) – File containing the model specs.
format_name (str) – Format the file is in, if not provided it will be inferred from the file extension.
**kwargs (Any) – Additional keyword arguments passes to the
load_model
implementation of the project io plugin.
- Returns
Model instance created from the file.
- Return type
- markdown(parameters: Optional[glotaran.parameter.parameter_group.ParameterGroup] = None, initial_parameters: Optional[glotaran.parameter.parameter_group.ParameterGroup] = None, base_heading_level: int = 1) glotaran.utils.ipython.MarkdownStr [source]
Formats the model as Markdown string.
Parameters will be included if specified.
- Parameters
parameter (ParameterGroup) – Parameter to include.
initial_parameters (ParameterGroup) – Initial values for the parameters.
base_heading_level (int) –
Base heading level of the markdown sections.
E.g.:
If it is 1 the string will start with ‘# Model’.
If it is 3 the string will start with ‘### Model’.
- property model_dimension
Deprecated use
Scheme.model_dimensions['<dataset_name>']
instead
- need_index_dependent() bool [source]
Returns true if e.g. clp_relations with intervals are present.
- problem_list(parameters: ParameterGroup | None = None) list[str] [source]
Returns a list with all problems in the model and missing parameters if specified.
- Parameters
parameter – The parameter to validate.
- valid(parameters: Optional[glotaran.parameter.parameter_group.ParameterGroup] = None) bool [source]
Returns True if the number problems in the model is 0, else False
- Parameters
parameter – The parameter to validate.
- validate(parameters: Optional[glotaran.parameter.parameter_group.ParameterGroup] = None, raise_exception: bool = False) glotaran.utils.ipython.MarkdownStr [source]
Returns a string listing all problems in the model and missing parameters if specified.
- Parameters
parameter – The parameter to validate.