feat: expose circadian_modulation and sleep_thresholds on Skeldon23#55
Open
ftavella wants to merge 1 commit into
Open
feat: expose circadian_modulation and sleep_thresholds on Skeldon23#55ftavella wants to merge 1 commit into
ftavella wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #44
Exposes two functions that were previously inlined inside
Skeldon23.integrateas public methods, making them reusable for plotting and post-processing.Changes
Skeldon23.circadian_modulation(trajectory)— returns the circadian modulation of sleep pressureC(t)as a numpy arraySkeldon23.sleep_thresholds(trajectory)— returns the tuple(H_plus, H_minus)of circadian-modulated wake and sleep thresholdsBoth follow the same interface as
cbt()anddlmos():trajectorydefaults to the most recently simulated trajectory and raisesValueErrorif an invalid object is passed.Tests
Added tests in
test_models.ipynbverifying:circadian_modulation()matches the manually computed formulasleep_thresholds()returns correctH_plus/H_minusvalues and thatH_plus > H_minuseverywhereValueErrorfor invalid trajectory input