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.0.tar.gz (6.4 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.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: parcae-0.1.0.tar.gz
  • Upload date:
  • Size: 6.4 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.0.tar.gz
Algorithm Hash digest
SHA256 6e81a3f3d0ef7ff1dbdce1d411b2d72cfc1c8aee17301ede5c87fb7fbe44bdc3
MD5 1a2d76c98565677f6f7490ce8a942114
BLAKE2b-256 f1b96cc50fb19550545cdab72dcfe114680a351906433cdc3cb2938868479a8c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: parcae-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c86cc604e758feb3f9aa4d1a20655f1b9a19624a98266297f69d264cc329f8d
MD5 f4272eb999e0da20bdddbc2248a68d0b
BLAKE2b-256 12272bd7b5b48f3d3aa6fe40da8b6792e83be7fb27f9c757e4d394631c6ee4a5

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