Tibetan calendar toolkit (traditional + reform engines).
Project description
caltib
High-Precision Tibetan Calendrical Math
caltib is a rigorous Python library designed to unify 15th-century historical algorithms with 21st-century astrophysics. It provides a polymorphic framework for evaluating traditional lunisolar calendars alongside modern mathematical reforms.
Live Demonstration
The library can be evaluated directly in the browser without local installation. The web calendar runs completely client-side via WebAssembly: 👉 Launch the caltib Web App
Key Features
- Unified API: Evaluate traditional engines (Phugpa, Mongol, Tsurphu, etc.) and modern reforms (L0–L6) using a single, harmonized interface.
- Progressive Reforms: A tiered sequence of engines advancing from pure-integer mean motion (L0) and fixed-iteration Picard solvers (L1–L3) to strictly reproducible floating-point models (L4–L5) and JPL-powered numerical integration (L6).
- Strict Reproducibility: L0–L5 engines utilize integer sine-tables or Chebyshev minimax polynomials to ensure bit-for-bit consistency across all CPU architectures.
- Localized Physics: Support for geographical location injection to accurately handle spherical sunrise boundaries and civil day-numbering conventions.
- Design & Diagnostics Laboratory: A professional-grade toolkit for designing new calendar parameters via continued fractions and analyzing secular drift over millennia.
Installation
caltib is designed to be lightweight. The core package has zero external dependencies, making it highly suitable for embedded environments or web deployment.
Core: Traditional engines & Reform Tiers L0-L5
pip install caltib
Tools: Diagnostic charting & parameter design (requires NumPy & Matplotlib)
pip install "caltib[tools]"
Ephemeris: JPL DE422 integration & L6 engine (requires Skyfield & jplephem)
pip install "caltib[ephemeris]"
Quickstart
Basic Day Query
from datetime import date
import caltib
# Standard traditional lookup
info = caltib.day_info(date(2026, 2, 21), engine="mongol")
print(f"Mongol Tithi: {info.tibetan.tithi}")
Advanced Localized Reform
from caltib.engines.specs import LOC_MONTREAL
import caltib
# Build an L3 engine localized to Montreal coordinates.
# L3 utilizes fixed-iteration rational Picard solvers and spherical sunrise geometry.
engine = caltib.get_calendar("l3", location=LOC_MONTREAL)
info = engine.day_info(date(2026, 2, 21))
Diagnostics & Design
The library includes a comprehensive diagnostic suite to rigorously analyze calendar accuracy and historical deviations.
- Secular Drift: Track how sidereal calendars decouple from the tropical equinox over 1,500-year timescales.
- Variance Mapping: Visualize the error propagation and variance of traditional anomaly approximations.
- Rational Design: Derive optimal convergents for constructing new calendar architectures.
Example Usage:
# Analyze secular acceleration against JPL DE422 numerical integration
caltib diag analysis --engine mongol --ephem de422
License: Distributed under the MIT License. Created by Tsogtgerel Gantumur.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file caltib-0.3.2.tar.gz.
File metadata
- Download URL: caltib-0.3.2.tar.gz
- Upload date:
- Size: 3.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b450727347f30a391c52ba2058f1ceafceaa8808b11676adf9b7ed8a272e9363
|
|
| MD5 |
4c08eb273b99a5d95a1bfc8c8d99fd89
|
|
| BLAKE2b-256 |
671ad7f072eedf46607c714f4eb7fde7254d62400a374b047c918c4d119d31d9
|
Provenance
The following attestation bundles were made for caltib-0.3.2.tar.gz:
Publisher:
publish.yml on gantemur/caltib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
caltib-0.3.2.tar.gz -
Subject digest:
b450727347f30a391c52ba2058f1ceafceaa8808b11676adf9b7ed8a272e9363 - Sigstore transparency entry: 1178029840
- Sigstore integration time:
-
Permalink:
gantemur/caltib@8cdf27f71ec4e58d5d0f4c9f0ceda9e75009a7de -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/gantemur
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8cdf27f71ec4e58d5d0f4c9f0ceda9e75009a7de -
Trigger Event:
push
-
Statement type:
File details
Details for the file caltib-0.3.2-py3-none-any.whl.
File metadata
- Download URL: caltib-0.3.2-py3-none-any.whl
- Upload date:
- Size: 294.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6d88b7c6bfa747d45bc47b336e31a2ebe2cbdda238c502e84cecf8d8232b956
|
|
| MD5 |
86e0b38d3cb564d28d42151c217d296e
|
|
| BLAKE2b-256 |
a60a4f9f25b09d349e9c88396f5e796bfa8ed715244b758418ca211d616984d1
|
Provenance
The following attestation bundles were made for caltib-0.3.2-py3-none-any.whl:
Publisher:
publish.yml on gantemur/caltib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
caltib-0.3.2-py3-none-any.whl -
Subject digest:
c6d88b7c6bfa747d45bc47b336e31a2ebe2cbdda238c502e84cecf8d8232b956 - Sigstore transparency entry: 1178029857
- Sigstore integration time:
-
Permalink:
gantemur/caltib@8cdf27f71ec4e58d5d0f4c9f0ceda9e75009a7de -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/gantemur
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8cdf27f71ec4e58d5d0f4c9f0ceda9e75009a7de -
Trigger Event:
push
-
Statement type: