KMatrix
- class glotaran.builtin.megacomplexes.decay.k_matrix.KMatrix(*, label: str, matrix: dict[tuple[str, str], Parameter | str])[source]
Bases:
ModelItem
A K-Matrix represents a first order differental system.
Method generated by attrs for class KMatrix.
Attributes Summary
Methods Summary
The A matrix of the KMatrix.
Returns the A Matrix as markdown formatted table.
The A matrix of the KMatrix for a general model.
The A matrix of the KMatrix for a sequential model.
Creates a combined matrix.
Returns the eigenvalues and eigenvectors of the k matrix.
Creates an empty K-Matrix.
The full representation of the KMatrix as numpy array.
A list of all compartments in the Matrix.
Returns true in the KMatrix represents an unibranched model.
Returns the KMatrix as markdown formatted table.
The resulting rates of the matrix.
The reduced representation of the KMatrix as numpy array.
Methods Documentation
- a_matrix(compartments: list[str], initial_concentration: ndarray) ndarray [source]
The A matrix of the KMatrix.
- Parameters:
initial_concentration – The initial concentration.
- a_matrix_as_markdown(compartments: list[str], initial_concentration: ndarray) MarkdownStr [source]
Returns the A Matrix as markdown formatted table.
- Parameters:
initial_concentration – The initial concentration.
- a_matrix_general(compartments: list[str], initial_concentration: ndarray) ndarray [source]
The A matrix of the KMatrix for a general model.
- Parameters:
initial_concentration – The initial concentration.
- a_matrix_sequential(compartments: list[str]) ndarray [source]
The A matrix of the KMatrix for a sequential model.
- Parameters:
initial_concentration – The initial concentration.
- combine(k_matrix: KMatrix) KMatrix [source]
Creates a combined matrix.
When combining k-matrices km1 and km2 (km1.combine(km2)), entries in km1 will be overwritten by corresponding entries in km2.
- Parameters:
k_matrix – KMatrix to combine with.
- Returns:
The combined KMatrix.
- Return type:
combined
- eigen(compartments: list[str]) tuple[ndarray, ndarray] [source]
Returns the eigenvalues and eigenvectors of the k matrix.
- Parameters:
compartments – The compartment order.
- classmethod empty(label: str, compartments: list[str]) KMatrix [source]
Creates an empty K-Matrix. Useful for combining.
- Parameters:
label – Label of the K-Matrix
compartments – A list of all compartments in the model.
- full(compartments: list[str]) ndarray [source]
The full representation of the KMatrix as numpy array.
- Parameters:
compartments – The compartment order.
- is_sequential(compartments: list[str], initial_concentration: ndarray) bool [source]
Returns true in the KMatrix represents an unibranched model.
- Parameters:
initial_concentration – The initial concentration.
- matrix_as_markdown(compartments: list[str] | None = None, fill_parameters: bool = False) MarkdownStr [source]
Returns the KMatrix as markdown formatted table.
- Parameters:
compartments – (default = None) An optional list defining the desired order of compartments.
fill_parameters (bool) – (default = False) If true, the entries will be filled with the actual parameter values instead of labels.
- rates(compartments: list[str], initial_concentration: ndarray) ndarray [source]
The resulting rates of the matrix.
By definition, the eigenvalues of the compartmental model are negative and the rates are the negatives of the eigenvalues, thus the eigenvalues need to be multiplied with
-1
to get rates with the correct sign.