Tools for the simulation and analysis of circadian rhythms
Project description
Circadian
Install
pip install circadian
How to use
The below shows how to simulate a slam shift schedule for three models and make an actogram plot
# Example run for forger 99 vdp model
from circadian.plots import Actogram
from circadian.models import *
from circadian.lights import *
import matplotlib.pyplot as plt
import numpy as np
ts = np.arange(0.0, 24*100, 0.1)
light_values = np.array([SlamShift(t, Intensity=150.0) for t in ts])
model = Forger99Model()
spm_model = SinglePopModel()
tpm_model = TwoPopulationModel()
initial_conditions_forger = model.initial_conditions_loop(ts, light_est=light_values, num_loops=1)
initial_conditions_spm = spm_model.initial_conditions_loop(ts, light_est=light_values, num_loops=1)
initial_conditions_tpm = tpm_model.initial_conditions_loop(ts, light_est=light_values, num_loops=1)
dlmo = model.integrate_observer(ts=ts, light_est=light_values, u0 = initial_conditions_forger)
dlmo_spm = spm_model.integrate_observer(ts=ts, light_est=light_values, u0 = initial_conditions_spm)
dlmo_tpm = tpm_model.integrate_observer(ts=ts, light_est=light_values, u0 = initial_conditions_tpm)
sol = tpm_model.integrate_model(ts=ts, light_est=light_values, state=initial_conditions_tpm)
acto = Actogram(ts, light_vals=light_values, opacity=1.0)
acto.plot_phasemarker(dlmo, color='blue', label= "DLMO Forger99")
acto.plot_phasemarker(dlmo_spm, color='darkgreen', label = "DLMO SPM" )
acto.plot_phasemarker(dlmo_tpm, color='red', label = "DLMO TPM" )
plt.title("Actogram for a Simulated Shift Worker")
plt.tight_layout()
plt.show()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
circadian-0.0.1.tar.gz
(31.8 kB
view hashes)
Built Distribution
circadian-0.0.1-py3-none-any.whl
(33.4 kB
view hashes)
Close
Hashes for circadian-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b69bb2629e6a254aa7b8ed4ee3cd57ac3a96fec553caed3606a814c9b26d7ff |
|
MD5 | 324eb6e716485643a4afd98ac640bf0e |
|
BLAKE2b-256 | 4fa54c33b30fcecdc2c254845c810a2a40ab2b82ec3e82006054bc5a13acbb57 |