Skip to main content

Infer daily rhythm and sleep schedule from message timestamps

Project description

parcae

PyPI License

Blog

Infer daily rhythm and sleep schedule from message timestamps

parcae is a command-line tool and Python library that analyzes nothing but timestamps and infers a user's likely timezone offset and their typical sleep window.

How It Works

parcae models human behavior as a very small Hidden Markov Model with two hidden states:

  • Awake (A)
  • Sleep (S)

The only observation is "was there at least one message in this time bin?". The model is trained globally across many users to learn:

  • how likely people are to send messages while "awake"
  • how unlikely they are to send messages while "asleep"
  • how often they switch between the two states

At inference time, Parcae:

  1. Tries many possible timezone offsets
  2. Picks the offset that makes the timeline most explainable by a "human with one long sleep per day"
  3. Decodes the most likely sleep/awake sequence
  4. Extracts daily sleep blocks
  5. Computes a typical schedule and regularity statistics

Installation

You can install parcae using pipx:

pipx install parcae

Usage

API

from parcae import Parcae

p = Parcae()

timestamps = [
    "2025-09-01T05:43:12+00:00",
    "2025-09-01T18:22:10+00:00",
    ...
]

print(p.analyze(timestamps))

CLI

Parcae expects a CSV file with one user's timestamps:

timestamp
2025-09-01T05:43:12+00:00
2025-09-01T07:58:33+00:00
2025-09-01T18:22:10+00:00
parcae user_timestamps.csv

Examples

+ Parcae analysis

~ inferred timezone: UTC+3

+ typical schedule:
        - sleep: 02:46 -> 11:38  ( 8h 45m)
        - awake: 11:38 -> 02:46

~ based on 30 days of data
~ bin size: 15 minutes

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

parcae-0.1.1.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parcae-0.1.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file parcae-0.1.1.tar.gz.

File metadata

  • Download URL: parcae-0.1.1.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for parcae-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ab27abc9a7e852e1c6bee2d95ae9064f2acc16c0679306c048293918c77c5346
MD5 501081469c99daf8f813396c78954eab
BLAKE2b-256 ae62a677f22c38f51f7f7327688be94f904aa8792b40c1d65e3f5f212b4aacc8

See more details on using hashes here.

File details

Details for the file parcae-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: parcae-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for parcae-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e08bb036ef99fddd6186245c5de52564c56ae32a4f0d65c1efd49cdb86ccef7b
MD5 5b42a2cf0163b01acefa0e9d44bee8c9
BLAKE2b-256 d0ccca559048464c30787ee3e745f25fb791bfc6622077d793541903625331b3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page