Files
patriothacks/fixtures/hannay19-model-spec.md

1.8 KiB

Hannay19 circadian model — exact equations and parameters

Source: Hannay, K.M., Booth, V., & Forger, D.B. (2019). "Macroscopic Models for Human Circadian Rhythms." Journal of Biological Rhythms, 34(6), 658-671. DOI: 10.1177/0748730419878298

Reference implementation verified against the real, Hannay-coauthored circadian package (PyPI: circadian; GitHub: Arcascope/circadian, circadian/models.py, class Hannay19), fetched and confirmed 2026-11-17.

State (3 variables)

  • R : amplitude
  • Psi : phase
  • n : light-adaptation variable

Default parameters

tau=23.84, K=0.06358, gamma=0.024, Beta1=-0.09318, A1=0.3855, A2=0.1977, BetaL1=-0.0026, BetaL2=-0.957756, sigma=0.0400692, G=33.75, alpha_0=0.05, delta=0.0075, p=1.5, I0=9325.0, cbt_to_dlmo=7.0

Default initial condition (midnight, 16L/8D schedule)

[R, Psi, n] = [0.82041911, 1.71383697, 0.52318122]

Derivative (RHS of the ODE), given light intensity light (lux):

alpha = alpha_0 * light^p / (light^p + I0) Bhat = G * (1 - n) * alpha

A1_term_amp = A1 * 0.5 * Bhat * (1 - R^4) * cos(Psi + BetaL1) A2_term_amp = A2 * 0.5 * Bhat * R * (1 - R^8) * cos(2*Psi + BetaL2) LightAmp = A1_term_amp + A2_term_amp

A1_term_phase = A1 * Bhat * 0.5 * (R^3 + 1/R) * sin(Psi + BetaL1) A2_term_phase = A2 * Bhat * 0.5 * (1 + R^8) * sin(2*Psi + BetaL2) LightPhase = sigma * Bhat - A1_term_phase - A2_term_phase

dR/dt = -gammaR + Kcos(Beta1)/2 * R * (1 - R^4) + LightAmp dPsi/dt = 2*pi/tau + K/2 * sin(Beta1) * (1 + R^4) + LightPhase dn/dt = 60 * (alpha * (1 - n) - delta * n)

Integration

Explicit RK4. Phase (circadian clock reading) = atan2(sin(Psi), cos(Psi)). Amplitude = R. DLMO (dim-light-melatonin-onset) marker = time where phase crosses pi, minus cbt_to_dlmo hours.

This is the complete, real equation set — port directly to JS for todo 44; no further derivation or external fetch needed.