PyTracerLab.model.units module¶
Base classes for model units.
- class PyTracerLab.model.units.DMUnit(mtt: float, DP: float)[source]¶
Bases:
PyTracerLab.model.units.UnitDispersion 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)
- 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)withK = 4 pi DP (τ / mtt). We also apply an exponential decay termexp(-λ τ).- Parameters:
- Returns:
Impulse response evaluated at
tau.- Return type:
ndarray
- class PyTracerLab.model.units.EMUnit(mtt: float)[source]¶
Bases:
PyTracerLab.model.units.UnitExponential 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 termexp(-λ τ).- Parameters:
- Returns:
Impulse response evaluated at
tau.- Return type:
ndarray
- class PyTracerLab.model.units.EPMUnit(mtt: float, eta: float)[source]¶
Bases:
PyTracerLab.model.units.UnitExponential Piston-Flow Model (EPM) unit.
- Parameters:
mtt (float) – Mean travel time.
eta (float) – Ratio of total volume to the exponential reservoir (>= 1).
eta=1reduces to a pure exponential model;eta>1adds 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'¶
- 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/η)and0otherwise. We also apply an exponential decay termexp(-λ τ).- Parameters:
- Returns:
Impulse response evaluated at
tau.- Return type:
ndarray
- class PyTracerLab.model.units.ExEPMUnit(mtt: float, exp_part: float, piston_part: float)[source]¶
Bases:
PyTracerLab.model.units.UnitExplicit 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'¶
- 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/η)and0otherwise. We also apply an exponential decay termexp(-λ τ).- Parameters:
- Returns:
Impulse response evaluated at
tau.- Return type:
ndarray
- class PyTracerLab.model.units.PMUnit(mtt: float)[source]¶
Bases:
PyTracerLab.model.units.UnitPiston-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)to1/dtto preserve unit mass in the discrete sum.- Parameters:
- Returns:
Impulse response evaluated at
tau.- Return type:
ndarray
- class PyTracerLab.model.units.Unit[source]¶
Bases:
abc.ABCAbstract 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.
- normalize_response(h: numpy.ndarray, dt: float) numpy.ndarray[source]¶
Normalize impulse response to unit area for conservation of mass.