PyTracerLab.gui.state module

Shared GUI state container used across tabs and controller.

class PyTracerLab.gui.state.AppState(is_monthly: bool = True, is_halfyearly: bool = False, tracer1: str = 'Tritium', tracer2: str | None = None, solver_key: str = 'de', solver_params: Dict[str, dict]=<factory>, use_file_uncertainty: bool = True, uncertainty_mode: str = 'none', sigma_abs: List[float | None] = <factory>, sigma_rel_percent: float | None = None, input_series: Tuple[numpy.ndarray, numpy.ndarray] | None=None, target_series: Tuple[numpy.ndarray, numpy.ndarray] | None=None, input_data: object | None = None, target_data: object | None = None, manual_observations: Dict[datetime.datetime, typing.List[float]]=<factory>, selected_units: List[str] = <factory>, design_units: List[typing.Tuple[str, float]]=<factory>, unit_fractions: Dict[str, float]=<factory>, params: Dict[str, typing.Dict[str, typing.Dict[str, float]]]=<factory>, steady_state_input: float | List[float] = 0.0, tt_results: numpy.ndarray | None = None, tt_mtt_values: numpy.ndarray | None = None, tt_obs_indices: numpy.ndarray | None = None, tt_param_key: str | None = None, last_simulation: object | None = None, last_times: numpy.ndarray | None = None)[source]

Bases: object

Central application state used by GUI components.

Variables:
  • is_monthly (bool) – Whether input/target series are monthly (else yearly).

  • tracer (str) – LEGACY: single-tracer selection kept for backward compatibility.

  • tracer1 (str) – Primary tracer (e.g., "Tritium", "Carbon-14").

  • tracer2 (str | None) – Optional second tracer; if None or "None", runs single-tracer mode.

  • solver_key (str) – Selected solver registry key ("de", "lsq", or "mcmc").

  • solver_params (dict) – Per-solver configuration dictionary.

  • sigma_rel_percent (use_file_uncertainty, uncertainty_mode, sigma_abs,) – Measurement uncertainty settings shared by all solvers, see PyTracerLab.gui.uncertainty.

  • input_series (tuple(ndarray, ndarray) | None) – Timestamps and input values (values always 2D, shape (N, K)).

  • target_series (tuple(ndarray, ndarray) | None) – Timestamps and observation values (optional), on the time grid of the input series (values always 2D, shape (N, K)).

  • input_data (TracerSeries | None) – Input series as read from file by read_series() (incl. tracer names and step).

  • target_data (TracerSeries | None) – Observations as read from file and aligned to the input series (incl. optional uncertainties); None for manual observations.

  • selected_units (list of str) – Unique unit types (legacy support for parameters tab).

  • design_units (list of (str, float)) – Flat list of chosen units and fractions (can repeat unit types).

  • unit_fractions (dict[str, float]) – Per-instance fraction mapping keyed by unique instance prefix.

  • params (dict) – Nested parameter values/bounds/fixed flags per instance prefix.

  • steady_state_input (float | list of float) – Value(s) of the optional steady-state input, i.e. the tracer input before the start of the input series. Provide a scalar for single-tracer runs or one value per tracer for multi-tracer runs.

  • last_simulation (object | None) – Last simulation result or solver payload for plotting.

  • last_times (ndarray | None) – Cached timestamps for plotting (if needed).

clear_tracer_tracer() → None[source]

Reset cached tracer-tracer sweep results.

design_units: List[Tuple[str, float]]
input_data: object | None = None
input_series: Tuple[numpy.ndarray, numpy.ndarray] | None = None
is_halfyearly: bool = False
is_monthly: bool = True
last_simulation: object | None = None
last_times: numpy.ndarray | None = None
manual_observations: Dict[datetime.datetime, List[float]]
params: Dict[str, Dict[str, Dict[str, float]]]
selected_units: List[str]
sigma_abs: List[float | None]
sigma_rel_percent: float | None = None
solver_key: str = 'de'
solver_params: Dict[str, dict]
steady_state_input: float | List[float] = 0.0
target_data: object | None = None
target_series: Tuple[numpy.ndarray, numpy.ndarray] | None = None
tracer1: str = 'Tritium'
tracer2: str | None = None
tt_mtt_values: numpy.ndarray | None = None
tt_obs_indices: numpy.ndarray | None = None
tt_param_key: str | None = None
tt_results: numpy.ndarray | None = None
uncertainty_mode: str = 'none'
unit_fractions: Dict[str, float]
use_file_uncertainty: bool = True