睡眠サイクル計算ツール
90分の睡眠サイクルに基づいて最適な睡眠・起床時刻を計算します。
このツールについて
睡眠サイクル計算機は、90分間の睡眠サイクルに基づいて、自然な睡眠パターンを最適化するのに役立ちます。睡眠サイクルは浅い睡眠、深い睡眠、レム睡眠(夢見の睡眠)を順番に経て繰り返す、人体の自然なリズムです。1サイクル全体を完了した後に目覚めると爽快感を感じますが、サイクルの途中で目覚めると、数時間もの間、寝ぼけた状態が続く傾向があります。
このツールを使用するには、希望の就寝時間または起床時間を入力するだけで、その反対の時間が計算されます。たとえば、午前7時に起床する必要がある場合、このツールは90分のサイクルを完成させるために就寝すべき時間を計算し、午後10時30分、午前12時、または午前1時30分などの時間を提案します。夜間の十分な睡眠でも、短時間の仮眠でも、このアプローチはあなたの睡眠を体の自然なリズムに合わせるのに役立ちます。
よくある質問
コード実装
from datetime import datetime, timedelta
SLEEP_CYCLE_MINUTES = 90
FALL_ASLEEP_MINUTES = 14 # Average time to fall asleep
def wake_times_from_bedtime(bedtime: datetime, cycles: int = 5) -> list[datetime]:
"""Given a bedtime, return optimal wake-up times after N full 90-min cycles."""
fall_asleep = bedtime + timedelta(minutes=FALL_ASLEEP_MINUTES)
return [
fall_asleep + timedelta(minutes=SLEEP_CYCLE_MINUTES * i)
for i in range(1, cycles + 1)
]
def bedtimes_from_wake(wake_time: datetime, cycles: int = 5) -> list[datetime]:
"""Given a desired wake time, return bedtimes that allow N full 90-min cycles."""
return [
wake_time - timedelta(minutes=SLEEP_CYCLE_MINUTES * i + FALL_ASLEEP_MINUTES)
for i in range(1, cycles + 1)
]
# Example: bedtime at 11 PM
bedtime = datetime.now().replace(hour=23, minute=0, second=0, microsecond=0)
print(f"Bedtime: {bedtime.strftime('%I:%M %p')}")
print("Best wake times:")
for t in wake_times_from_bedtime(bedtime):
print(f" {t.strftime('%I:%M %p')} ({(t - bedtime).seconds // 60} min)")
# Example: must wake at 7 AM
wake = datetime.now().replace(hour=7, minute=0, second=0, microsecond=0)
print(f"\nWake time: {wake.strftime('%I:%M %p')}")
print("Best bedtimes:")
for t in bedtimes_from_wake(wake):
print(f" {t.strftime('%I:%M %p')}")Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.