Skip to content

feat: expose circadian_modulation and sleep_thresholds on Skeldon23#55

Open
ftavella wants to merge 1 commit into
Arcascope:mainfrom
ftavella:fix/issue-44
Open

feat: expose circadian_modulation and sleep_thresholds on Skeldon23#55
ftavella wants to merge 1 commit into
Arcascope:mainfrom
ftavella:fix/issue-44

Conversation

@ftavella
Copy link
Copy Markdown
Member

Summary

Closes #44

Exposes two functions that were previously inlined inside Skeldon23.integrate as public methods, making them reusable for plotting and post-processing.

Changes

  • Skeldon23.circadian_modulation(trajectory) — returns the circadian modulation of sleep pressure C(t) as a numpy array
  • Skeldon23.sleep_thresholds(trajectory) — returns the tuple (H_plus, H_minus) of circadian-modulated wake and sleep thresholds

Both follow the same interface as cbt() and dlmos(): trajectory defaults to the most recently simulated trajectory and raises ValueError if an invalid object is passed.

Tests

Added tests in test_models.ipynb verifying:

  • circadian_modulation() matches the manually computed formula
  • sleep_thresholds() returns correct H_plus/H_minus values and that H_plus > H_minus everywhere
  • Both methods accept an explicit trajectory argument
  • Both raise ValueError for invalid trajectory input

…rcascope#44)

Extract the circadian modulation C(t) and sleep threshold calculations
that were previously inlined in Skeldon23.integrate into two public
methods:

- circadian_modulation(trajectory): returns C(t) array
- sleep_thresholds(trajectory): returns (H_plus, H_minus) tuple

Both accept an optional trajectory argument (defaults to the last
simulated trajectory), mirror the existing cbt()/dlmos() interface,
and raise ValueError for invalid trajectory inputs.

Also fix pkg_resources import in setup.py for setuptools >= 82.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement separate functions for Skeldon23's sleep thresholds and sleep pressure

1 participant