mirror of
https://github.com/acamarata/pray-calc-ml.git
synced 2026-06-30 19:04:26 +00:00
Weighted least-squares calibration of Islamic prayer time depression angles from observed mosque announcement data. Uses golden-section search to minimize the sum of squared residuals independently for Fajr and Isha. Internal Jean Meeus solar ephemeris — zero runtime dependencies. API: calibrateAngles, scoreAngles, predictFajr, predictIsha. Full TypeScript, dual CJS/ESM via tsup. 32 ESM tests, 6 CJS tests, all passing on Node 20/22/24.
1.4 KiB
1.4 KiB
pray-calc-ml
Machine learning calibration for Islamic prayer times. Fits optimal Fajr/Isha depression angles to observed mosque announcement data using weighted least-squares regression.
Zero runtime dependencies. Works in Node.js, browsers, and any ESM/CJS bundler.
Pages
- API Reference — full function signatures, parameters, return types
- Architecture — solver design, solar ephemeris, accuracy analysis
- Guide: Collecting Observations — how to record mosque times and build a dataset
- Guide: Integrating with pray-calc — calibrate then use in a full prayer time app
Quick start
npm install pray-calc-ml
import { calibrateAngles } from 'pray-calc-ml';
const result = calibrateAngles([
{ date: new Date('2024-06-01'), lat: 40.71, lng: -74.01, tz: -4, fajr: 3.75, isha: 21.58 },
{ date: new Date('2024-07-01'), lat: 40.71, lng: -74.01, tz: -4, fajr: 3.80, isha: 21.55 },
{ date: new Date('2024-08-01'), lat: 40.71, lng: -74.01, tz: -4, fajr: 4.12, isha: 21.15 },
{ date: new Date('2024-09-01'), lat: 40.71, lng: -74.01, tz: -4, fajr: 4.55, isha: 20.67 },
]);
console.log(result.angles); // { fajrAngle: 15.2, ishaAngle: 14.8 }
console.log(result.rmsMinutes); // 0.31