PyTracerLab.model.units module

Base classes for model units.

class PyTracerLab.model.units.DMUnit(mtt: float, DP: float)[source]

Bases: PyTracerLab.model.units.Unit

Dispersion Model (DM) unit.

Parameters:
  • mtt (float) – Mean travel time.

  • DP (float) – Dispersion parameter. Represents the inverse of the Peclet number. Also represents the ratio of the dispersion coefficient to the velocity and outlet / sampling position

  • PREFIX (str) – Prefix for local parameter names. Helper for GUI.

  • PARAMS (List[Dict[str, Any]]) – List of (default) parameter definitions. Helper for GUI.

  • Note (The parameter key for the mean travel time (mtt) is used in the)

  • and (GUI explicitly. The GUI assumes the parameter is given in years)

  • it. (internally converts)

DP: float
PARAMS = [{'bounds': (1.0, 10000.0), 'default': 10.0, 'key': 'mtt', 'label': 'Mean Travel Time'}, {'bounds': (0.0001, 10.0), 'default': 1.0, 'key': 'DP', 'label': 'Dispersion Param.'}]
PREFIX = 'dm'
get_impulse_response(tau: numpy.ndarray, dt: float, lambda_: float, prod: bool = False) numpy.ndarray[source]

DM impulse response with decay.

The continuous-time DM response (without decay) is h(τ) = (1/mtt) * 1 / (sqrt(K)) * exp((1 - τ / mtt)^2 / K) with K = 4 pi DP / mtt). We also apply an exponential decay term exp(-λ τ).

Parameters:
  • tau (ndarray) – Non-negative time axis (same spacing as simulation time grid).

  • dt (float) – Time step size of the discretization.

  • lambda (float) – Decay constant (1 / time units of tau).

  • prod (bool, optional) – If True, calculate production response (used to simulate 3He production from 3H decay).

Returns:

Impulse response evaluated at tau.

Return type:

ndarray

mtt: float
param_values() Dict[str, float][source]

Get parameter values.

Returns:

Mapping from local parameter name to value.

Return type:

Dict[str, float]

set_param_values(values: Dict[str, float]) None[source]

Set one or more local parameter values.

Parameters:

values (Dict[str, float]) – Mapping from local parameter name to new value. Keys not present are ignored.

class PyTracerLab.model.units.EMUnit(mtt: float)[source]

Bases: PyTracerLab.model.units.Unit

Exponential Model (EM) unit.

Parameters:
  • mtt (float) – Mean travel time.

  • PREFIX (str) – Prefix for local parameter names. Helper for GUI.

  • PARAMS (List[Dict[str, Any]]) – List of (default) parameter definitions. Helper for GUI.

  • Note (The parameter key for the mean travel time (mtt) is used in the)

  • and (GUI explicitly. The GUI assumes the parameter is given in years)

  • it. (internally converts)

PARAMS = [{'bounds': (0.0, 10000.0), 'default': 10.0, 'key': 'mtt', 'label': 'Mean Travel Time'}]
PREFIX = 'em'
get_impulse_response(tau: numpy.ndarray, dt: float, lambda_: float, prod: bool = False) numpy.ndarray[source]

EM impulse response with decay.

The continuous-time EPM response (without decay) is h(τ) = (1/mtt) * exp(-τ / mtt). We also apply an exponential decay term exp(-λ τ).

Parameters:
  • tau (ndarray) – Non-negative time axis (same spacing as simulation time grid).

  • dt (float) – Time step size of the discretization.

  • lambda (float) – Decay constant (1 / time units of tau).

  • prod (bool, optional) – If True, calculate production response (used to simulate 3He production from 3H decay).

Returns:

Impulse response evaluated at tau.

Return type:

ndarray

mtt: float
param_values() Dict[str, float][source]

Get parameter values.

Returns:

Mapping from local parameter name to value.

Return type:

Dict[str, float]

set_param_values(values: Dict[str, float]) None[source]

Set one or more local parameter values.

Parameters:

values (Dict[str, float]) – Mapping from local parameter name to new value. Keys not present are ignored.

class PyTracerLab.model.units.EPMUnit(mtt: float, eta: float)[source]

Bases: PyTracerLab.model.units.Unit

Exponential Piston-Flow Model (EPM) unit.

Parameters:
  • mtt (float) – Mean travel time.

  • eta (float) – Ratio of total volume to the exponential reservoir (>= 1). eta=1 reduces to a pure exponential model; eta>1 adds a piston component.

  • PREFIX (str) – Prefix for local parameter names. Helper for GUI.

  • PARAMS (List[Dict[str, Any]]) – List of (default) parameter definitions. Helper for GUI.

  • Note (The parameter key for the mean travel time (mtt) is used in the)

  • and (GUI explicitly. The GUI assumes the parameter is given in years)

  • it. (internally converts)

PARAMS = [{'bounds': (0.0, 10000.0), 'default': 10.0, 'key': 'mtt', 'label': 'Mean Travel Time'}, {'bounds': (1.0, 2.0), 'default': 1.1, 'key': 'eta', 'label': 'Eta'}]
PREFIX = 'epm'
eta: float
get_impulse_response(tau: numpy.ndarray, dt: float, lambda_: float, prod: bool = False) numpy.ndarray[source]

EPM impulse response with decay.

The continuous-time EPM response (without decay) is h(τ) = (η/mtt) * exp(-η τ / mtt + η - 1) for τ >= mtt*(1 - 1/η) and 0 otherwise. We also apply an exponential decay term exp(-λ τ).

Parameters:
  • tau (ndarray) – Non-negative time axis (same spacing as simulation time grid).

  • dt (float) – Time step size of the discretization.

  • lambda (float) – Decay constant (1 / time units of tau).

  • prod (bool, optional) – If True, calculate production response (used to simulate 3He production from 3H decay).

Returns:

Impulse response evaluated at tau.

Return type:

ndarray

mtt: float
param_values() Dict[str, float][source]

Get parameter values.

Returns:

Mapping from local parameter name to value.

Return type:

Dict[str, float]

set_param_values(values: Dict[str, float]) None[source]

Set one or more local parameter values.

Parameters:

values (Dict[str, float]) – Mapping from local parameter name to new value. Keys not present are ignored.

class PyTracerLab.model.units.ExEPMUnit(mtt: float, exp_part: float, piston_part: float)[source]

Bases: PyTracerLab.model.units.Unit

Explicit xponential Piston-Flow Model (EPM) unit. This model is essentially the same as the EPMUnit, but the EPM ratio (total volume / exponential volume or total area / area receiving recharge) is defined via two parameters instead of one aggregated parameter. Those two parameters are directly related and can never be estimated simultaneously.

Parameters:
  • mtt (float) – Mean travel time.

  • exp_part (float) – Area receiving recharge or exponential volume of the system.

  • piston_part (float) – Area not receiving recharge or piston-flow volume of the system.

  • PREFIX (str) – Prefix for local parameter names. Helper for GUI.

  • PARAMS (List[Dict[str, Any]]) – List of (default) parameter definitions. Helper for GUI.

  • Note (The parameter key for the mean travel time (mtt) is used in the)

  • and (GUI explicitly. The GUI assumes the parameter is given in years)

  • it. (internally converts)

PARAMS = [{'bounds': (0.0, 10000.0), 'default': 10.0, 'key': 'mtt', 'label': 'Mean Travel Time'}, {'bounds': (0.0, 100.0), 'default': 0.5, 'key': 'exp_part', 'label': 'Exponential Part'}, {'bounds': (0.0, 100.0), 'default': 1.0, 'key': 'piston_part', 'label': 'Piston Part'}]
PREFIX = 'epm'
exp_part: float
get_impulse_response(tau: numpy.ndarray, dt: float, lambda_: float, prod: bool = False) numpy.ndarray[source]

ExEPM impulse response with decay.

The continuous-time EPM response (without decay) is h(τ) = (η/mtt) * exp(-η τ / mtt + η - 1) for τ >= mtt*(1 - 1/η) and 0 otherwise. We also apply an exponential decay term exp(-λ τ).

Parameters:
  • tau (ndarray) – Non-negative time axis (same spacing as simulation time grid).

  • dt (float) – Time step size of the discretization.

  • lambda (float) – Decay constant (1 / time units of tau).

  • prod (bool, optional) – If True, calculate production response (used to simulate 3He production from 3H decay).

Returns:

Impulse response evaluated at tau.

Return type:

ndarray

mtt: float
param_values() Dict[str, float][source]

Get parameter values.

Returns:

Mapping from local parameter name to value.

Return type:

Dict[str, float]

piston_part: float
set_param_values(values: Dict[str, float]) None[source]

Set one or more local parameter values.

Parameters:

values (Dict[str, float]) – Mapping from local parameter name to new value. Keys not present are ignored.

class PyTracerLab.model.units.PMUnit(mtt: float)[source]

Bases: PyTracerLab.model.units.Unit

Piston-Flow Model (discrete delta at the mean travel time) with decay.

Parameters:
  • mtt (float) – Mean travel time where all mass is transported as a plug flow.

  • PREFIX (str) – Prefix for local parameter names. Helper for GUI.

  • PARAMS (List[Dict[str, Any]]) – List of (default) parameter definitions. Helper for GUI.

  • Note (The parameter key for the mean travel time (mtt) is used in the)

  • and (GUI explicitly. The GUI assumes the parameter is given in years)

  • it. (internally converts)

PARAMS = [{'bounds': (0.0, 10000.0), 'default': 10.0, 'key': 'mtt', 'label': 'Mean Travel Time'}]
PREFIX = 'pm'
get_impulse_response(tau: numpy.ndarray, dt: float, lambda_: float, prod: bool = False) numpy.ndarray[source]

Discrete delta response on the grid with exponential decay.

The delta is represented by setting the bin at round(mtt/dt) to 1/dt to preserve unit mass in the discrete sum.

Parameters:
  • tau (ndarray) – Non-negative time axis (same spacing as simulation time grid).

  • dt (float) – Time step size of the discretization.

  • lambda (float) – Decay constant (1 / time units of tau).

  • prod (bool, optional) – If True, calculate production response (used to simulate 3He production from 3H decay).

Returns:

Impulse response evaluated at tau.

Return type:

ndarray

mtt: float
param_values() Dict[str, float][source]

Get parameter values.

Returns:

Mapping from local parameter name to value.

Return type:

Dict[str, float]

set_param_values(values: Dict[str, float]) None[source]

Set local parameter value.

Parameters:

values (Dict[str, float]) – Mapping from local parameter name to new value. Keys not present are ignored.

class PyTracerLab.model.units.Unit[source]

Bases: abc.ABC

Abstract base class for a model unit.

Concrete units represent hydrological transport schemata and must expose and accept their local parameter values via a mapping. Units are intentionally unaware of optimization bounds; those live in the Model’s parameter registry.

Notes

  • Implementations must keep local parameter names stable over time so that the Model’s registry stays consistent.

  • Names should be short (e.g., "mtt", "eta").

get_block(h: numpy.ndarray, tau: numpy.ndarray, dt: float, lambda_: float, prod: bool = False) numpy.ndarray[source]

Get 1-dt block response.

abstractmethod get_impulse_response(tau: numpy.ndarray, dt: float, lambda_: float) numpy.ndarray[source]

Evaluate the unit’s impulse response on a time grid.

Parameters:
  • tau (ndarray) – Non-negative time axis (same spacing as simulation time grid).

  • dt (float) – Time step size of the discretization.

  • lambda (float) – Decay constant (1 / time units of tau).

Returns:

Impulse response sampled at tau.

Return type:

ndarray

normalize_response(h: numpy.ndarray, dt: float) numpy.ndarray[source]

Normalize impulse response to unit area for conservation of mass.

abstractmethod param_values() Dict[str, float][source]

Return current local parameter values.

Returns:

Mapping from local parameter name to value.

Return type:

Dict[str, float]

abstractmethod set_param_values(values: Dict[str, float]) None[source]

Set one or more local parameter values.

Parameters:

values (Dict[str, float]) – Mapping from local parameter name to new value. Keys not present are ignored.