睡眠サイクル計算機
90分の睡眠サイクルに基づいた最適な就寝時刻または起床時刻を見つけます。
睡眠サイクル計算機は、身体の自然な90分の睡眠サイクルに合わせて就寝時間や起床時間を計画するのに役立ちます。睡眠中、脳は浅い睡眠、深い徐波睡眠、REM(夢)睡眠を含む段階を循環します。1つの完全なサイクルは約90分で、深い睡眠の中間ではなくサイクルの終わりに目覚めることで、眠くなく休まった状態で起きられます。
起床したい時刻または就寝予定時刻を入力します。ツールは完全な睡眠サイクルの終わりに当たる就寝時刻または起床時刻を計算し、通常眠りにつくのに15分かかることを考慮します。4、5、6、7、8サイクルの結果が表示されます。
ほとんどの成人は7〜9時間の睡眠、つまり5〜6の完全なサイクルが必要です。推奨時間眠っても定期的に疲れて目覚める場合、問題はタイミングかもしれません。就寝時間を20〜30分調整することで顕著な差が生まれることがあります。
よくある質問
コード実装
from datetime import datetime, timedelta
CYCLE_MINUTES = 90 # average sleep cycle length
SLEEP_LATENCY_MINUTES = 15 # average time to fall asleep
def wake_times(bedtime_str, num_cycles=6, latency_minutes=SLEEP_LATENCY_MINUTES):
"""
Given a bedtime string ("HH:MM"), return suggested wake times
for 3 to num_cycles complete sleep cycles.
"""
bedtime = datetime.strptime(bedtime_str, "%H:%M")
results = []
for cycles in range(3, num_cycles + 1):
sleep_duration = timedelta(
minutes=latency_minutes + cycles * CYCLE_MINUTES
)
wake = bedtime + sleep_duration
results.append({
"cycles": cycles,
"sleep_hours": round((cycles * CYCLE_MINUTES) / 60, 1),
"wake_time": wake.strftime("%H:%M"),
})
return results
def bedtime_for_wake(wake_time_str, num_cycles=6, latency_minutes=SLEEP_LATENCY_MINUTES):
"""
Given a target wake time, suggest when to go to bed for
3 to num_cycles complete sleep cycles.
"""
wake = datetime.strptime(wake_time_str, "%H:%M")
results = []
for cycles in range(3, num_cycles + 1):
sleep_duration = timedelta(
minutes=latency_minutes + cycles * CYCLE_MINUTES
)
bedtime = wake - sleep_duration
results.append({
"cycles": cycles,
"sleep_hours": round((cycles * CYCLE_MINUTES) / 60, 1),
"bedtime": bedtime.strftime("%H:%M"),
})
return results
# Example 1: bedtime → wake times
print("If you go to bed at 23:00, wake up at:")
for w in wake_times("23:00"):
print(f" {w['cycles']} cycles ({w['sleep_hours']}h) → wake at {w['wake_time']}")
# Example 2: target wake time → bedtimes
print("\nTo wake up at 07:00, go to bed at:")
for b in bedtime_for_wake("07:00"):
print(f" {b['cycles']} cycles ({b['sleep_hours']}h) → bed at {b['bedtime']}")Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.