API Reference
Abstract types
ThermalPhysiology.AbstractTPCModel — Type
AbstractTPCModelRoot abstract type for all thermal performance curve models. Subtypes dispatch on thermal_performance or temperature_correction.
ThermalPhysiology.AbstractArrheniusModel — Type
AbstractArrheniusModel <: AbstractTPCModelAbstract type for Arrhenius-family temperature-correction models. These return a dimensionless correction factor equal to 1 at T_ref. Parameters are stored in Kelvin (TA, Tref). DEBtool convention.
ThermalPhysiology.AbstractPhenomenologicalModel — Type
AbstractPhenomenologicalModel <: AbstractTPCModelAbstract type for phenomenological TPC shape models. Parameters are typically in °C (T_opt, CTmax). Return absolute or relative performance.
ThermalPhysiology.AbstractTDTModel — Type
AbstractTDTModelAbstract type for thermal death time models. Subtypes dispatch on survival_time. Kept separate from TPC types because correction factors and survival times are distinct quantities.
Primary dispatch functions
ThermalPhysiology.thermal_performance — Function
thermal_performance(model, T) → Float64Return the thermal performance (absolute or relative rate) at temperature T for an AbstractPhenomenologicalModel.
T may be a Unitful temperature quantity or a bare Float64 (°C assumed).
ThermalPhysiology.temperature_correction — Function
temperature_correction(model, T) → Float64Return the dimensionless temperature-correction factor at temperature T for an AbstractArrheniusModel. The factor equals 1.0 at the model's reference temperature T_ref.
T may be a Unitful temperature quantity or a bare Float64 (°C assumed).
ThermalPhysiology.survival_time — Function
survival_time(model, T) → Float64Return the median time to knockdown (minutes) at constant temperature T for an AbstractTDTModel.
T may be a Unitful temperature quantity or a bare Float64 (°C assumed).
Arrhenius-family structs
ThermalPhysiology.ArrheniusModel — Type
ArrheniusModel(; T_A, T_ref)One-parameter temperature-correction model. Returns a dimensionless correction factor equal to 1 at T_ref.
temperature_correction(m, T) = exp(T_A/T_ref - T_A/T)Parameters stored in Kelvin. Convenience constructor arrhenius accepts Unitful quantities or bare values.
ThermalPhysiology.SharpSchoolHighModel — Type
SharpSchoolHighModel(; T_A, T_ref, T_H, T_AH, rate_at_reference)Sharpe-Schoolfield model with high-temperature enzyme deactivation.
rate(T) = rate_at_reference * exp(T_A/T_ref - T_A/T) /
(1 + exp(T_AH/T_H - T_AH/T))Formula from Schoolfield, Sharpe & Magnuson (1981).
ThermalPhysiology.SharpSchoolLowModel — Type
SharpSchoolLowModel(; T_A, T_ref, T_L, T_AL, rate_at_reference)Sharpe-Schoolfield model with low-temperature enzyme suppression.
ThermalPhysiology.SharpSchoolFullModel — Type
SharpSchoolFullModel(; T_A, T_ref, T_L, T_AL, T_H, T_AH, rate_at_reference)Schoolfield (1981) full model with both low- and high-temperature enzyme deactivation. rate_at_reference is the rate in the absence of enzyme inactivation at Tref (i.e. assumes Tref is in the central Arrhenius zone).
rate(T) = rate_at_reference * (T/T_ref) * exp(T_A/T_ref - T_A/T) /
(1 + exp(T_AL*(1/T - 1/T_L)) + exp(T_AH*(1/T_H - 1/T)))The (T/T_ref) pre-factor comes from collision-frequency theory and is part of the original Schoolfield et al. (1981) Eq. (4); it is also present in rTPC's sharpeschoolfull_1981.R. At biological temperatures it accounts for ~5–10% variation.
Low term exp(T_AL*(1/T - 1/T_L)) is large at T < TL (cold suppression); high term `exp(TAH*(1/TH - 1/T))` is large at T > TH (heat denaturation).
For the DEBtool-normalised variant (no T/Tref, actual rate at Tref guaranteed), use SharpSchoolDEBModel.
References: Schoolfield, Sharpe & Magnuson (1981) J Theor Biol 88:719; sharpeschoolfull_1981.R in rTPC; ArrFunc5 in Rezende dynamic.landscape1.R.
ThermalPhysiology.SharpSchoolDEBModel — Type
SharpSchoolDEBModel(; T_A, T_ref, T_L, T_AL, T_H, T_AH, rate_at_reference)DEBtool-normalised Sharpe-Schoolfield model. rate_at_reference is the actual observed rate at Tref — the correction is applied in both numerator and denominator, so `temperaturecorrection(m, Tref) == rateatreference` for any Tref.
rate(T) = rate_at_reference * exp(T_A/T_ref - T_A/T) *
(1 + exp(T_AL/T_ref - T_AL/T_L) + exp(T_AH/T_H - T_AH/T_ref)) /
(1 + exp(T_AL/T - T_AL/T_L) + exp(T_AH/T_H - T_AH/T))This is tempcorr in DEBtool_J and the form used in NicheMapR for CTE calculations. Use this variant when fitting to rate data collected at a known reference temperature or when computing constant temperature equivalents within DEB.
Reference: Kooijman (2010) DEB Theory §2.6; DEBtool_J tempcorr.m.
ThermalPhysiology.JohnsonLewinModel — Type
JohnsonLewinModel(; T_A, T_ref, T_H, T_AH, rate_at_reference)Original Johnson-Lewin (1946) enzyme-kinetics model. Equivalent to the high-deactivation Sharpe-Schoolfield form but historically distinct.
Phenomenological TPC structs
ThermalPhysiology.UniversalTPCModel — Type
UniversalTPCModel(; T_opt, E, maximum_performance)Universal thermal performance curve (Arnoldi et al. 2025, PNAS). Two-parameter model: y(x) = exp(x) * (1 - x) where x = (T - T_opt) / E.
T_opt: optimal temperature (stored in K internally)E: thermal breadth (K); related to Arrhenius temperature byE = T_ref² / T_Amaximum_performance: peak rate at T_opt
The UTPC thermal breadth connects to TDT z-value: z = E * log(10).
ThermalPhysiology.DeutschModel — Type
DeutschModel(; maximum_rate, optimal_temperature, critical_thermal_maximum, width_parameter)Modified Deutsch (2008, PNAS) thermal performance curve. Gaussian rise below Topt; quadratic decline above Topt to CTmax.
T < T_opt: rate = maximum_rate * exp(-((T - T_opt) / (2*width_parameter))^2)
T > T_opt: rate = maximum_rate * (1 - ((T - T_opt) / (T_opt - CTmax))^2)ThermalPhysiology.Briere1Model — Type
Briere1Model(; rate_constant, minimum_temperature, maximum_temperature)Briere 1 (1999) thermal performance curve. rate = rate_constant * T * (T - T_min) * sqrt(T_max - T) for Tmin < T < Tmax.
ThermalPhysiology.Briere2Model — Type
Briere2Model(; rate_constant, minimum_temperature, maximum_temperature, shape_parameter)Briere 2 (1999) — generalised form with shape exponent. rate = rate_constant * T * (T - T_min) * (T_max - T)^(1/shape_parameter)
ThermalPhysiology.GaussianModel — Type
GaussianModel(; maximum_rate, optimal_temperature, width_parameter)Symmetric Gaussian TPC. rate = maximum_rate * exp(-0.5 * ((T - T_opt) / width_parameter)^2)
ThermalPhysiology.Thomas2012Model — Type
Thomas2012Model(; rate_constant, shape_parameter, optimal_temperature)Thomas et al. (2012) thermal performance curve. rate = rate_constant * (T - T_opt + b) * (T - T_opt - b) * (-1) where b is a shape parameter. Returns 0 outside the performance range.
ThermalPhysiology.Thomas2017Model — Type
Thomas2017Model(; maximum_rate, optimal_temperature, width_parameter, skewness)Thomas et al. (2017) asymmetric TPC: skewed-Gaussian form.
ThermalPhysiology.PawarModel — Type
PawarModel(; rate_at_reference, activation_energy, deactivation_energy,
peak_temperature, reference_temperature)Pawar et al. (2018) metabolic TPC: Arrhenius rise with high-T deactivation, parameterised in biologically meaningful terms.
ThermalPhysiology.Lactin2Model — Type
Lactin2Model(; rate_constant, maximum_temperature, delta_temperature, intercept)Lactin 2 (1995) thermal performance curve. rate = exp(rate_constant * T) - exp(rate_constant * T_max - (T_max - T) / delta_T) + intercept
TDT structs
ThermalPhysiology.LogLinearTDTModel — Type
LogLinearTDTModel(; z_value, reference_ctmax, reference_duration, incipient_temperature)Log-linear thermal death time model (Jørgensen et al. 2021, Sci Reports).
Survival time at constant temperature T: t(T) = referenceduration * 10^((referencectmax - T) / z_value)
Parameters:
z_value: °C for 10× change in knockdown time (= -1/slope of log10(t) ~ T)reference_ctmax: sCTmax atreference_duration(°C)reference_duration: exposure duration definingreference_ctmax(min)incipient_temperature: Tc* below which thermal injury is negligible (°C)
Rezende's Tmax (mean τ = 1 min) relates by: Tmax = referencectmax + z * log10(referenceduration).
ThermalPhysiology.ToleranceLandscape — Type
ToleranceLandscape(; z_value, temperature_maximum, mean_assay_temperature, survival_curve)Semi-parametric thermal tolerance landscape (Rezende et al. 2014, Funct Ecol; Rezende et al. 2020, Science 369, 1242–1245).
Built from individual-level knockdown data via fit_tolerance_landscape. Stores the full empirical survival probability curve S(τ) collapsed to the mean assay temperature using z-shifting.
Individual vs. population framing: dynamic_survival tracks the survival probability of one individual moving through S(τ) as heat exposure accumulates. The state variable can move in both directions: down under heat stress, up during recovery (via recovery_model). This contrasts with accumulated_injury (Jørgensen), which is monotone and population-level.
Fields:
z_value: °C for 10× change in knockdown timetemperature_maximum: T_max, temperature at which mean τ = 1 min (°C)mean_assay_temperature: T_mean, mean assay temperature for S(τ) curve (°C)survival_curve: n×2 matrix [timeminutes, survivalfraction (0–1)]
TPC properties
ThermalPhysiology.optimal_temperature — Function
optimal_temperature(m) → Float64 (K)Temperature at which thermal_performance is maximised. Analytic for UniversalTPCModel; numerical via Roots.jl for others. Returns Inf for monotone models (e.g. ArrheniusModel).
ThermalPhysiology.critical_thermal_maximum — Function
critical_thermal_maximum(m; threshold=0.0) → Unitful temperatureTemperature above the optimum where thermal_performance falls to threshold.
ThermalPhysiology.critical_thermal_minimum — Function
critical_thermal_minimum(m; threshold=0.0) → Unitful temperatureTemperature below the optimum where thermal_performance falls to threshold.
ThermalPhysiology.thermal_breadth — Function
thermal_breadth(m; threshold=0.0) → Unitful temperature differenceTemperature range over which thermal_performance exceeds threshold. = CTmax - CTmin.
ThermalPhysiology.maximum_rate — Function
maximum_rate(m) → Float64Peak thermal performance (at optimal_temperature).
ThermalPhysiology.q10 — Function
q10(m, T; delta=10.0) → Float64Temperature coefficient: ratio of performance at T+delta to T. delta is in °C (or K — equivalent for differences).
TDT properties
ThermalPhysiology.lethal_temperature — Function
lethal_temperature(m, duration; T_search=(273.0, 373.0)) → Float64 (°C)Temperature at which survival_time equals duration (minutes). Inverse of survival_time.
ThermalPhysiology.median_lethal_temperature — Function
median_lethal_temperature(m, duration) → Float64 (°C)Temperature at which 50% of individuals die after duration minutes. Alias for lethal_temperature.
ThermalPhysiology.z_value — Function
z_value(m) → Float64Temperature increment for 10-fold change in survival time. Direct field for LogLinearTDTModel; derived from Arrhenius temperature for others.
ThermalPhysiology.thermal_death_slope — Function
thermal_death_slope(m) → Float64Slope b of the TDT curve in log10-time/°C units (= 1/z).
ThermalPhysiology.ctmax_at_duration — Function
ctmax_at_duration(m, duration_minutes)Static sCTmax corresponding to a given exposure duration.
ThermalPhysiology.temperature_maximum — Function
temperature_maximum(m::LogLinearTDTModel) → Float64Temperature (°C) at which the mean knockdown time equals 1 minute (Rezende parameterisation).
T_max = reference_ctmax + z_value × log10(reference_duration)TDT fluctuating-temperature functions
ThermalPhysiology.accumulated_injury — Function
accumulated_injury(m, T_series, dt_minutes)Cumulative thermal injury under a fluctuating temperature series (Jørgensen 2021 Eq. 3). Injury per step = dt / survival_time(T) when T ≥ incipienttemperature, else 0. Injury = 1.0 corresponds to lethal dose. Returns a cumulative vector of length `length(Tseries)`.
ThermalPhysiology.time_to_failure — Function
time_to_failure(m, T_series, dt_minutes; critical_injury=1.0)Time (minutes) at which accumulated injury reaches critical_injury. Returns Inf if the organism survives the entire series.
ThermalPhysiology.dynamic_ctmax — Function
dynamic_ctmax(m, ramp_rate_per_min; start_temperature=m.incipient_temperature)Predict the dynamic CTmax (knockdown temperature in a ramping assay) from TDT parameters. Reference: Jørgensen et al. 2021 Eq. 7a; TDT_from_Static.R.
ThermalPhysiology.static_ctmax_from_dynamic — Function
static_ctmax_from_dynamic(m, dctmax, ramp_rate_per_min; start_temperature=m.incipient_temperature)Recover static sCTmax from a dynamic CTmax measurement and ramp rate. Reference: Jørgensen et al. 2021 Eq. 7b.
ToleranceLandscape functions
ThermalPhysiology.dynamic_survival — Function
dynamic_survival(tl, T_series; dt_minutes=1.0, recovery_model=nothing)Predict individual survival probability under a fluctuating temperature series using the Rezende (2020) iterative curve-shifting algorithm.
At each time step:
- Compute
shift = 10^((T_mean - T_i) / z)— scales time axis for current temperature - Find current time-equivalent position in the shifted S(τ) and advance by
dt_minutes - Read new survival fraction via linear interpolation
- If
recovery_modelis provided, addthermal_performance(recovery_model, T_i) * dt_minutesand clamp to 1.0 (matchesArrFunc5recovery indynamic.landscape1.R)
Returns a vector of survival fractions (0–1) at each time step.
Reference: dynamic.landscape() in Thermal landscape functions.R (lines 76–89); dynamic.landscape1() in dynamic.lansdcape1.R.
ThermalPhysiology.daily_mortality — Function
daily_mortality(tl, T_series_24h; dt_minutes=1.0, recovery_model=nothing)Fraction of individuals that die during one day's temperature exposure.
ThermalPhysiology.cumulative_survival — Function
cumulative_survival(tl, T_series_per_day; dt_minutes=1.0, recovery_model=nothing)Cumulative survival probability over multiple days (Rezende 2020 Eq. S9). T_series_per_day is a vector of 24-h temperature vectors (one per day). Full overnight recovery is assumed between days; pass recovery_model for within-day partial recovery via dynamic_survival.
Constant temperature equivalent
ThermalPhysiology.constant_temperature_equivalent — Function
constant_temperature_equivalent(m, T_series) → Unitful temperatureThe single constant temperature that produces the same mean thermal response as the time series T_series. Used in DEBtool parameter estimation when body temperatures fluctuate (Kearney NicheMapR vignette, getCTE).
Algorithm:
- Compute thermal response at each T →
responses = f.(m, T_series) - Average →
mean_response - Root-find
T_eqsuch thatf(m, T_eq) = mean_response
Analytic solution for ArrheniusModel; numerical for all others.
References:
- Kearney NicheMapR vignette,
getCTEfunction - Jensen's inequality: for convex f, CTE > arithmetic mean temperature
ThermalPhysiology.mean_correction_factor — Function
mean_correction_factor(m, T_series) → Float64Mean Arrhenius temperature-correction factor over T_series.
ThermalPhysiology.mean_thermal_performance — Function
mean_thermal_performance(m, T_series) → Float64Mean thermal performance over T_series.
Cross-family conversions
ThermalPhysiology.tdt_from_tpc — Function
tdt_from_tpc(m::UniversalTPCModel; reference_duration=60.0, incipient_temperature)Convert UTPC parameters to a LogLinearTDTModel. UTPC thermal breadth E and TDT z-value are linked: z = E × log(10).
ThermalPhysiology.thermal_breadth_from_tdt — Function
thermal_breadth_from_tdt(m::LogLinearTDTModel)UTPC thermal breadth E from TDT z-value: E = z / log(10).
Curve fitting
ThermalPhysiology.fit_thermal_performance_curve — Function
fit_thermal_performance_curve(ModelType, temperatures, rates; initial_parameters=nothing)Fit a TPC model to data using nonlinear least squares (LsqFit.jl).
Returns a fitted instance of ModelType. temperatures and rates are plain vectors (°C assumed for temperatures). initial_parameters is an ordered vector matching the struct field order; estimated from data heuristics if nothing.
fit_thermal_performance_curve(SharpSchoolFullModel, temperatures, rates; ...)
fit_thermal_performance_curve(SharpSchoolDEBModel, temperatures, rates; ...)Fit a Sharpe-Schoolfield model using NLS (LsqFit.jl) with graphical initial parameter estimates from the Arrhenius plot (Schoolfield, Sharpe & Magnuson 1981, Figure 2).
Keyword arguments:
T_ref: reference temperature (Unitful quantity or bare Kelvin); default298.15u"K"(25 °C).initial_parameters: manual override[T_A, T_L, T_AL, T_H, T_AH, rate_at_reference]; ifnothing, estimated from the graphical method.log_transform: fit in log-space (minimise sum of squared log-residuals); defaulttrue. This matches the Schoolfield et al. (1981) Marquardt fit and is appropriate when rates span orders of magnitude. Setfalsefor absolute residuals (use withweights).weights: weight vector for LsqFit (only used whenlog_transform=false).
ThermalPhysiology.fit_thermal_death_time_curve — Function
fit_thermal_death_time_curve(data::StaticKnockdownData; reference_duration=60.0,
incipient_temperature=nothing)Fit a LogLinearTDTModel to group-summary knockdown data via linear regression on log10(t) ~ T (TDTfromStatic.R, lines 68–71).
Returns a LogLinearTDTModel. If incipient_temperature is nothing, defaults to minimum(temperatures) - 5.0.
fit_thermal_death_time_curve(data::DynamicKnockdownData; reference_duration=60.0,
incipient_temperature=nothing, initial_z=2.5)Fit a LogLinearTDTModel from dynamic CTmax measurements (Jørgensen 2021 Eq. 7a).
- ≥3 ramp rates: NLS via LsqFit.jl
- 2 ramp rates: Roots.jl (multiroot)
- 1 ramp rate: algebraic inverse of Eq. 7a (requires reference_ctmax guess = mean dCTmax - 1°C)
ThermalPhysiology.fit_tolerance_landscape — Function
fit_tolerance_landscape(data::IndividualKnockdownData; n_bins=1000)Build a ToleranceLandscape from individual-level knockdown data (Rezende et al. 2014, Funct Ecol; corresponds to tolerance.landscape() in the R reference code).
Algorithm:
- Linear regression:
log10(time) ~ temperatureto estimatez_value(slope = -1/z) andtemperature_maximum(T at log10(t) = 0, i.e. t = 1 min). - Compute mean assay temperature
T_mean = mean(temperatures). - Z-shift each individual knockdown time to
T_mean:shifted_time = t * 10^((T - T_mean) / z_value) - Sort shifted times; compute empirical survival fractions S(τ).
- Store as
n_bins-rowsurvival_curvematrix via linear interpolation for consistency.
Returns ToleranceLandscape.
ThermalPhysiology.IndividualKnockdownData — Type
IndividualKnockdownData(; temperatures, knockdown_times)Individual-level knockdown data: one entry per organism. Required for fit_tolerance_landscape.
temperatures: assay temperature per individual (°C)knockdown_times: time to knockdown per individual (min)
ThermalPhysiology.StaticKnockdownData — Type
StaticKnockdownData(; temperatures, knockdown_times)Group-summary TDT data: one mean/median knockdown time per assay temperature. Sufficient for fit_thermal_death_time_curve.
temperatures: assay temperatures (°C)knockdown_times: mean/median time to failure per temperature (min)
ThermalPhysiology.DynamicKnockdownData — Type
DynamicKnockdownData(; ramp_rates, dynamic_ctmax_values, start_temperature)Dynamic CTmax measurements at various ramp rates.
ramp_rates: heating rates (°C/min)dynamic_ctmax_values: knockdown temperature at each ramp rate (°C)start_temperature: temperature at which ramp begins (°C)
Registry
ThermalPhysiology.THERMAL_REGISTRY — Constant
THERMAL_REGISTRY :: Dict{Symbol, ThermalModelEntry}Global registry of all thermal models provided by ThermalPhysiology.jl. Keys are Symbol names (e.g. :arrhenius, :utpc, :log_linear_tdt).
Use model_names to list keys and thermal_models to retrieve entries, optionally filtered by :arrhenius, :phenomenological, or :tdt family.
ThermalPhysiology.model_names — Function
model_names(; family=nothing) → Vector{Symbol}Return all registered model keys, optionally filtered by family (:arrhenius, :phenomenological, :tdt, or nothing for all).
ThermalPhysiology.thermal_models — Function
thermal_models(; family=nothing) → Dict{Symbol, ThermalModelEntry}Return registry entries, optionally filtered by family.
Unit utilities
ThermalPhysiology.ea_to_ta — Function
ea_to_ta(E_a) → T_AConvert activation energy in eV to Arrhenius temperature in K: T_A = E_a / k_B. Accepts Unitful quantities or bare Float64 (assumed eV).
ThermalPhysiology.ta_to_ea — Function
ta_to_ea(T_A) → E_aConvert Arrhenius temperature in K to activation energy in eV: E_a = T_A × k_B. Accepts Unitful quantities or bare Float64 (assumed K).