growthcurves.parametric module#

Parametric model fitting functions for growth curves.

This module provides functions to fit parametric growth models:

  • Mechanistic models (ODE-based): mech_logistic, mech_gompertz, mech_richards, mech_baranyi

  • Phenomenological models (ln-space): phenom_logistic, phenom_gompertz, phenom_gompertz_modified, phenom_richards

All models operate in linear OD space (not log-transformed).

growthcurves.parametric.fit_mech_baranyi(t, N)[source]#

Fit mechanistic Baranyi-Roberts model (ODE) to growth N.

ODE: dN/dt = μ * A(t) * (1 - N/K) * N where A(t) = exp(μ*t) / (exp(h0) - 1 + exp(μ*t)) OD(t) = N(t)

Assumes input data is baseline-corrected (no additive offset).

Parameters:
  • t – Time array (hours)

  • N – OD values

Returns:

Dict with ‘params’ and ‘model_type’, or None if fitting fails.

growthcurves.parametric.fit_mech_gompertz(t, N)[source]#

Fit mechanistic Gompertz model (ODE) to growth data.

ODE: dN/dt = μ * log(K/N) * N OD(t) = N(t)

Assumes input data is baseline-corrected (no additive offset).

Parameters:
  • t – Time array (hours)

  • N – OD values

Returns:

Dict with ‘params’ and ‘model_type’, or None if fitting fails.

Note

The mechanistic Gompertz model can be numerically challenging to fit due to the logarithmic term in the ODE. If fitting fails or produces poor results, consider using mech_logistic, mech_richards, or phenom_gompertz instead.

growthcurves.parametric.fit_mech_logistic(t, N)[source]#

Fit mechanistic logistic model (ODE) to growth N.

ODE: dN/dt = μ * (1 - N/K) * N OD(t) = N(t)

Assumes input data is baseline-corrected (no additive offset).

Parameters:
  • t – Time array (hours)

  • N – OD values

Returns:

Dict with ‘params’ and ‘model_type’, or None if fitting fails.

growthcurves.parametric.fit_mech_richards(t, N)[source]#

Fit mechanistic Richards model (ODE) to growth N.

ODE: dN/dt = μ * (1 - (N/K)^β) * N OD(t) = N(t)

Assumes input data is baseline-corrected (no additive offset).

Parameters:
  • t – Time array (hours)

  • N – OD values

Returns:

Dict with ‘params’ and ‘model_type’, or None if fitting fails.

growthcurves.parametric.fit_parametric(t, N, method='mech_logistic', **kwargs)[source]#

Fit a growth model to N (mechanistic) or ln(N/N0) (phenomenological).

Parameters:
  • t (Iterable[float]) – Time array (hours)

  • N (Iterable[float]) – OD values

  • method (str, optional) –

    Model type string. Options:

    Mechanistic (ODE):
    • ”mech_logistic”, “mech_gompertz”, “mech_richards”, “mech_baranyi”

    Phenomenological (ln-space):
    • ”phenom_logistic”, “phenom_gompertz”, “phenom_gompertz_modified”, “phenom_richards”

Returns:

Fit result dict or None if fitting fails.

Return type:

Optional[dict]

Raises:

ValueError – Unknown method string.

growthcurves.parametric.fit_phenom_gompertz(t, N)[source]#

Fit phenomenological Gompertz model to ln(OD/OD0) N.

ln(Nt/N0) = A * exp(-exp(μ_max * e * (λ - t) / A + 1))

Parameters:
  • t – Time array (hours)

  • N – OD values

Returns:

Dict with ‘params’ and ‘model_type’, or None if fitting fails.

growthcurves.parametric.fit_phenom_gompertz_modified(t, N)[source]#

Fit phenomenological modified Gompertz model with decay term.

ln(Nt/N0) = A * exp(-exp(μ_max * e * (λ - t) / A + 1)) + A * exp(α * (t - t_shift))

Parameters:
  • t – Time array (hours)

  • N – OD values

Returns:

Dict with ‘params’ and ‘model_type’, or None if fitting fails.

growthcurves.parametric.fit_phenom_logistic(t, N)[source]#

Fit phenomenological logistic model to ln(OD/OD0) data.

ln(Nt/N0) = A / (1 + exp(4 * μ_max * (λ - t) / A + 2))

Parameters:
  • t – Time array (hours)

  • N – OD values

Returns:

Dict with ‘params’ and ‘model_type’, or None if fitting fails.

growthcurves.parametric.fit_phenom_richards(t, N)[source]#

Fit phenomenological Richards model to ln(OD/OD0) N.

ln(Nt/N0)= A * (1 + ν * exp(1 + ν + μ_max * (1 + ν)^(1 + 1/ν) * (λ - t) / A))^(-1/ν)

Parameters:
  • t – Time array (hours)

  • N – OD values

Returns:

Dict with ‘params’ and ‘model_type’, or None if fitting fails.