pykappa.analysis¶
Functions
|
Checks whether the magnitude of the slope of the tail of the series relative to the mean is sufficiently small (below tolerance). |
|
Earliest time from which the remaining series is equilibrated. |
|
Mean of the series from the equilibration point onward. |
|
Computes the magnitude of the slope of the tail of the series. |
Classes
|
Records the history of the values of observables in a system. |
- class pykappa.analysis.Monitor(system)[source]¶
Records the history of the values of observables in a system.
- Parameters:
system (System)
- history¶
Dictionary mapping observable names to their value history.
- Type:
dict[str, list[float | None]]
- history: dict[str, list[float | None]]¶
- measure(observable_name, time=None)[source]¶
Get the value of an observable at a specific time.
- Raises:
AssertionError – If simulation hasn’t reached the specified time.
- Parameters:
observable_name (str)
time (float | None)
- property dataframe: DataFrame¶
Get the history of observable values as a pandas DataFrame.
- Returns:
DataFrame with time and observable columns.
- tail_mean(observable_name, tail_fraction=0.1)[source]¶
Calculate the average value of an observable over a fraction of the tail.
- Parameters:
observable_name (str) – Name of the observable to measure.
tail_fraction (float) – Fraction of the history to consider (from the end).
- Raises:
AssertionError – If there are not enough measurements.
- Return type:
float
- equilibrated(observable_name=None, **equilibration_kwargs)[source]¶
Check if an observable (or all observables) has equilibrated based on whether the slope of recent values is sufficiently small relative to the mean.
- Parameters:
observable_name (str | None) – Name of the observable to check. If None, checks all observables.
tail_fraction – Fraction of the history to consider.
tolerance – Maximum allowed fraction slope deviation from the mean.
- Return type:
bool
- pykappa.analysis.relative_slope(values, times=None, tail_fraction=0.1)[source]¶
Computes the magnitude of the slope of the tail of the series. Time can be provided to account for non-uniform sampling intervals.
- Raises:
AssertionError – If there are not enough measurements to compute the slope.
- Parameters:
values (list[float])
times (list[float] | None)
tail_fraction (float)
- Return type:
float
- pykappa.analysis.equilibrated(values, times=None, tail_fraction=0.1, tolerance=0.01)[source]¶
Checks whether the magnitude of the slope of the tail of the series relative to the mean is sufficiently small (below tolerance). Time can be provided to account for non-uniform sampling intervals.
- Parameters:
values (list[float])
times (list[float] | None)
tail_fraction (float)
tolerance (float)
- Return type:
bool