Skip to content

diegopalencia-research/MARS-OS-Circadian-Kernel-v1.0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MARS-OS: Circadian-Kernel

Biological Drift Architecture for Mars Surface Operations

CI Python Streamlit Tests License: MIT

"The architecture is not the design of space, it is the design of the biological response to the environment."


What is this

MARS-OS (Martian Adaptive Rhythm Synchronization — Operations Support) is a computational framework that quantifies biological time drift in human crews during Mars surface operations, models its cognitive performance impact, and generates photobiological intervention schedules to maintain operational readiness.

The core problem: Mars rotates in 24h 37m. The human circadian system is calibrated to 24h. That 617-second daily mismatch is silent, inevitable, and (without active management) mission-critical. By Sol 10 without intervention, accumulated drift exceeds 6 hours: the documented threshold for mission-critical cognitive impairment.

This is Level 3 of a five-level research architecture on Human Performance and Circadian Systems in Constrained Environments. See RESEARCH_LINE.md.


Repository Structure

mars-os-circadian-kernel/
│
├── mars_os/                        # Python package
│   ├── __init__.py
│   └── circadian_kernel.py         # Core computational engine
│
├── tests/                          # pytest unit suite
│   ├── __init__.py
│   └── test_kernel.py              # 63 tests — 100% pass rate
│
├── db/
│   └── schema.sql                  # PostgreSQL / SQLite schema
│                                   # missions · crew_profiles · sol_states
│                                   # interventions · simulation_runs · views
│
├── docs/
│   └── METHODOLOGY.md              # Model derivation, validation, references
│
├── joss/
│   ├── paper.md                    # JOSS submission paper
│   └── paper.bib
│
├── .github/workflows/
│   └── ci.yml                      # CI: pytest × Python 3.10 / 3.11 / 3.12
│
├── app.py                          # Streamlit dashboard
├── CITATION.cff                    # Software citation (renders on GitHub)
├── RESEARCH_LINE.md                # Full 5-level research architecture
├── LICENSE                         # MIT
├── .gitignore
├── README.md
└── requirements.txt

The Problem: Silent Drift

Parameter Earth Mars Delta
Rotation period 24.000 h 24.617 h +37 min/sol
Drift @ Sol 10 0.0 h 6.17 h Critical threshold
Drift @ Sol 30 0.0 h 18.5 h Severe desynchrony
Primary zeitgeber Solar (24h) Solar (24.617h) Insufficient recalibration

Uncorrected circadian desynchrony produces: 20–40% cognitive throughput reduction, increased EVA decision latency, REM degradation, immune suppression. Documented in NASA HI-SEAS isolation studies and polar overwinter research.


System Architecture

┌────────────────────────────────────────────────────────────┐
│                     MARS-OS KERNEL                         │
│                                                            │
│   INPUT: Sol counter · Chronotype · Correction factor      │
│                         │                                  │
│   VAN DER POL SCN MODEL (Kronauer 1999)                    │
│   dX/dt = Y                                                │
│   dY/dt = μ(1−X²)Y − ω²X + F(t)                            │
│   F(t)  = Mars light-dark forcing at 24.617h               │
│                         │                                  │
│   DRIFT ENGINE                                             │
│   D_eff = D_raw × (1 − c × 0.72)   [max 72%, Lockley 2003]│
│                         │                                  │
│   PERFORMANCE MODEL                                        │
│   PI = 1 / (1 + e^(0.8 × (d mod 6 − 3)))                   │
│   Calibrated to NASA astronaut fatigue data                │
│                         │                                  │
│   OUTPUT: Alert (GREEN/YELLOW/RED) · Light Rx (480nm PRC)  │
└────────────────────────────────────────────────────────────┘
                          │
                          ▼
          ┌──────────────────────────┐
          │   db/schema.sql          │
          │   PostgreSQL / SQLite    │
          │   missions               │
          │   crew_profiles          │
          │   sol_states ← primary   │
          │   interventions          │
          │   simulation_runs        │
          └──────────────────────────┘

Scientific Foundation

1. SCN as a Van der Pol Oscillator

The suprachiasmatic nucleus (SCN) is a self-sustaining limit-cycle oscillator. Its behavior is captured by the Van der Pol equation — a nonlinear ODE where the oscillation amplitude self-regulates and external forcing (zeitgebers) can phase-shift the rhythm. This model was validated for mammalian circadian systems by Kronauer et al. (1999) and remains standard in quantitative chronobiology.

The key physical insight: the SCN is not a simple 24h timer that can be trivially re-set. It is a nonlinear oscillator with a bounded daily entrainment capacity (~1–2h/day maximum phase shift). Mars creates a forcing mismatch that, without intervention, exceeds the system's natural correction bandwidth.

2. 480nm Photobiological Intervention

Melanopsin-expressing ipRGCs (intrinsically photosensitive retinal ganglion cells) project directly to the SCN via the retinohypothalamic tract. These cells peak in sensitivity at 480nm blue light. Lockley et al. (2003) demonstrated that narrow-band 480nm exposure produces phase shifts 2.5× more effective than broadband white light at equivalent photon densities, establishing the PRC-based intervention protocol implemented here.

Maximum achievable correction: 72% of raw drift per cycle.

3. Performance Degradation Model

The Performance Index (PI) follows a sigmoid degradation function calibrated against NASA astronaut cognitive performance data. Drift is taken modulo CRITICAL_DRIFT_H (6h) — reflecting the periodic nature of sleep-wake cycles. The mission-critical threshold occurs at approximately Sol 9.7 without intervention.


Quick Start

git clone https://github.com/[your-username]/mars-os-circadian-kernel
cd mars-os-circadian-kernel
pip install -r requirements.txt

# Streamlit dashboard
streamlit run app.py

# CLI
python -m mars_os.circadian_kernel

# Tests
pytest tests/ -v

Use as a module:

from mars_os import MissionConfig, run_mission, to_dataframe

config = MissionConfig(
    duration_sols     = 180,
    chronotype        = "intermediate",
    correction_factor = 0.60,
    base_wake_time_h  = 7.0,
)

states = run_mission(config)
df     = to_dataframe(states)

print(df[["sol", "drift_h", "performance_index", "alert_level"]].head(15))

Database:

# SQLite
sqlite3 mars_os.db < db/schema.sql

# PostgreSQL
psql -d your_database -f db/schema.sql

API Reference

MissionConfig

Parameter Default Description
duration_sols 180 Mission length in sols
chronotype "intermediate" "morning" / "intermediate" / "evening"
correction_factor 0.0 Phototherapy efficacy [0.0–1.0]
base_wake_time_h 7.0 Crew wake time (Mars local, h)

Core functions

Function Returns Description
run_mission(config) List[CircadianState] Full mission assessment
to_dataframe(states) pd.DataFrame Analysis-ready export
compare_scenarios(sols) pd.DataFrame 4-scenario comparison
compute_drift(sol, cf, chrono) float Effective drift (hours)
performance_index(drift_h) float [0,1] Cognitive PI
alert_level(pi) str GREEN / YELLOW / RED
compute_intervention(drift_h) dict 480nm Rx schedule
simulate_scn(sols, mu, offset) (t, x) Van der Pol integration

Database Layer

The schema converts single-run outputs into a persistent, queryable mission data system.

Table Purpose
missions Mission registry
crew_profiles Chronobiological parameters per crew member
sol_states Per-sol PI and drift time series
interventions Administered phototherapy with compliance tracking
simulation_runs Reproducibility metadata

Pre-built views: v_mission_summary · v_crew_alert_timeline · v_intervention_compliance.


Research Line Context

Level Project Environment Status
1 Circadian Productivity Analyzer Earth Planned
2 Circadian Disruption Simulator Aviation / shift work Planned
3 MARS-OS: Circadian-Kernel Mars (24.617h) Active — v1.0
4 Circadian Evolution Scenarios Theoretical Future
5 Cross-Body Comparative Model Earth / Moon / Mars Future

Overarching Question: How does human performance adapt when biological time decouples from environmental time — and how do we engineer the bridge?


Roadmap

  • v1.0 — Van der Pol SCN model · drift engine · sigmoid PI model · 480nm Rx · Streamlit dashboard · PostgreSQL schema · 63-test suite · CI/CD
  • v1.1 — Multi-crew synchrony divergence
  • v1.2 — Melatonin pharmacokinetics
  • v2.0 — ML-based PI prediction from HRV / actigraphy
  • v3.0 — Lunar non-24h extension (~708h cycle)

Citing This Software

@software{palencia_robles_2026_marsos,
  author  = {Palencia Robles, Diego José},
  title   = {MARS-OS: Circadian-Kernel},
  version = {1.0.0},
  year    = {2026},
  url     = {https://github.com/[your-username]/mars-os-circadian-kernel},
  license = {MIT}
}

Author

Diego José Palencia Robles PhD Researcher | Systems Architect Human Performance & Circadian Systems in Constrained Environments Computational Physics · NLP · High-Performance ML


License

MIT — See LICENSE. Scientific use encouraged with attribution.


References

  1. Kronauer, R.E. et al. (1999). J Biol Rhythms 14(6).
  2. Lockley, S.W. et al. (2003). J Clin Endocrinol Metab 88(9).
  3. Barger, L.K. et al. (2014). Lancet Neurol 13(9).
  4. NASA Human Research Program (2019). Sleep, Circadian Rhythms, and Fatigue — Evidence Report.
  5. Monk, T.H. et al. (2001). Chronobiol Int 18(6).

About

Computational framework for circadian drift modeling in Mars surface operations. Van der Pol SCN oscillator · 37 min/sol biological drift · 480nm phototherapy scheduling · Streamlit dashboard.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors