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: 23:52 -> 06:34  ( 8h 30m)
        - awake: 06:34 -> 23:52
        - variability: ±175m

+ activity profile (24h):
        ▁▁▁▁▁▁▁▁▅▇▅█▆▁▅▄▅▆▁▇▇▆▆▇
        |     |     |     |     
        00    06    12    18    

+ fingerprint:
        parcae:v1:AAAAAAAAAAAAAAAAAAAAAD0AWQA6AGMAQQAAADoAMAA6AEcAAABWAFUATgBMAFsAd__-D9QPqP12BPEBqwU=

~ 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.2.0.tar.gz (13.2 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.2.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for parcae-0.2.0.tar.gz
Algorithm Hash digest
SHA256 25effdde49a6207ab527288c8bc374e683262738c26075fb26e52eb8f720be92
MD5 80a29f18bec1fbcf07c272fd5adaba9e
BLAKE2b-256 74fb257904b55fa79431c09b647b84e93054c6e820b3cc31f051666d33ae2bb8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: parcae-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9efc002403bc973105c91e8d24efdd8f8f98376038610d69a544cd2b2c0bdcf6
MD5 294d082df4677be8eda456abdf7478d0
BLAKE2b-256 66faf009711c6a909dc797f47b8859987f13369b0c8c889a8745ac5ac0d76d2d

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