caelus 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +1 -1
  2. package/accuracy.json +1 -1
  3. package/dist/src/chart.d.ts +193 -13
  4. package/dist/src/chart.js +163 -13
  5. package/dist/src/compiler.d.ts +44 -3
  6. package/dist/src/compiler.js +44 -3
  7. package/dist/src/core.d.ts +33 -2
  8. package/dist/src/core.js +33 -2
  9. package/dist/src/derived.d.ts +91 -2
  10. package/dist/src/derived.js +91 -2
  11. package/dist/src/directions.d.ts +27 -0
  12. package/dist/src/directions.js +69 -0
  13. package/dist/src/eclipses.d.ts +17 -1
  14. package/dist/src/eclipses.js +17 -1
  15. package/dist/src/events.d.ts +53 -7
  16. package/dist/src/events.js +53 -7
  17. package/dist/src/features.d.ts +69 -7
  18. package/dist/src/features.js +69 -7
  19. package/dist/src/firdaria.d.ts +49 -0
  20. package/dist/src/firdaria.js +62 -0
  21. package/dist/src/houses.d.ts +13 -4
  22. package/dist/src/houses.js +13 -4
  23. package/dist/src/index.d.ts +9 -0
  24. package/dist/src/index.js +9 -0
  25. package/dist/src/lots.d.ts +18 -0
  26. package/dist/src/lots.js +52 -0
  27. package/dist/src/pheno.d.ts +16 -2
  28. package/dist/src/pheno.js +16 -2
  29. package/dist/src/profections.d.ts +27 -0
  30. package/dist/src/profections.js +49 -0
  31. package/dist/src/query.d.ts +47 -6
  32. package/dist/src/query.js +47 -6
  33. package/dist/src/releasing.d.ts +32 -0
  34. package/dist/src/releasing.js +109 -0
  35. package/dist/src/turbo.d.ts +35 -1
  36. package/dist/src/turbo.js +35 -1
  37. package/dist/src/vargas.d.ts +32 -0
  38. package/dist/src/vargas.js +52 -0
  39. package/dist/src/vedic.d.ts +66 -0
  40. package/dist/src/vedic.js +101 -0
  41. package/dist/src/yogas.d.ts +26 -0
  42. package/dist/src/yogas.js +39 -0
  43. package/dist/src/yogini.d.ts +54 -0
  44. package/dist/src/yogini.js +63 -0
  45. package/package.json +1 -1
@@ -0,0 +1,39 @@
1
+ import { dignities } from "./derived.js";
2
+ /** Pancha Mahapurusha: [yoga name, planet]. */
3
+ const MAHAPURUSHA = [
4
+ ["Ruchaka", "mars"], ["Bhadra", "mercury"], ["Hamsa", "jupiter"],
5
+ ["Malavya", "venus"], ["Shasha", "saturn"],
6
+ ];
7
+ const KENDRA = new Set([1, 4, 7, 10]);
8
+ export const YOGA_PLANETS = ["sun", "moon", "mars", "mercury", "jupiter", "venus", "saturn"];
9
+ /** The placement yogas present in a chart. `signs` maps each of the seven
10
+ * classical planets to its 0-based sign index; `ascSign` is the Ascendant's
11
+ * sign index. */
12
+ export function detectYogas(signs, ascSign) {
13
+ const house = (sign) => ((sign - ascSign) % 12 + 12) % 12 + 1;
14
+ const out = [];
15
+ for (const [name, p] of MAHAPURUSHA) {
16
+ const dig = dignities(p, signs[p]);
17
+ if ((dig.includes("domicile") || dig.includes("exaltation")) && KENDRA.has(house(signs[p]))) {
18
+ out.push({ yoga: name, planets: [p] });
19
+ }
20
+ }
21
+ const jkFromMoon = ((signs.jupiter - signs.moon) % 12 + 12) % 12;
22
+ if (jkFromMoon === 0 || jkFromMoon === 3 || jkFromMoon === 6 || jkFromMoon === 9) {
23
+ out.push({ yoga: "Gajakesari", planets: ["jupiter", "moon"] });
24
+ }
25
+ if (signs.sun === signs.mercury)
26
+ out.push({ yoga: "Budha-Aditya", planets: ["sun", "mercury"] });
27
+ if (signs.moon === signs.mars)
28
+ out.push({ yoga: "Chandra-Mangala", planets: ["moon", "mars"] });
29
+ return out;
30
+ }
31
+ /** The placement yogas of a natal chart, from the sidereal rasi positions. */
32
+ export function yogasAt(engine, natalJd, lat, lonEast, zodiac = "sidereal:lahiri") {
33
+ const chart = engine.chartAt(natalJd, lat, lonEast, { zodiac });
34
+ const ascSign = Math.floor(chart.angles.asc / 30) % 12;
35
+ const signs = {};
36
+ for (const b of YOGA_PLANETS)
37
+ signs[b] = Math.floor(chart.bodies[b].lon / 30) % 12;
38
+ return detectYogas(signs, ascSign);
39
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * astroengine yogini -- the Yogini dasha, a 36-year nakshatra-based dasha cycle.
3
+ *
4
+ * Eight yoginis rule in a fixed order with periods 1..8 years (totalling 36):
5
+ * Mangala (Moon) 1, Pingala (Sun) 2, Dhanya (Jupiter) 3, Bhramari (Mars) 4,
6
+ * Bhadrika (Mercury) 5, Ulka (Saturn) 6, Siddha (Venus) 7, Sankata (Rahu) 8.
7
+ * The starting yogini comes from the Moon's birth nakshatra: (nakshatra number
8
+ * + 3) mod 8, a remainder of 0 meaning the 8th. As in Vimshottari, the elapsed
9
+ * portion of the first period is the fraction of the nakshatra the Moon has
10
+ * traversed, and each period subdivides into eight proportional sub-periods.
11
+ * Mirrors the Python reference (astroengine/yogini.py); the golden fixtures pin
12
+ * the two together.
13
+ */
14
+ import { Engine, Zodiac } from "./chart.js";
15
+ export declare const YOGINIS: readonly ["Mangala", "Pingala", "Dhanya", "Bhramari", "Bhadrika", "Ulka", "Siddha", "Sankata"];
16
+ export declare const YOGINI_LORDS: Record<(typeof YOGINIS)[number], string>;
17
+ /** Period in years by yogini index (Mangala..Sankata), totalling 36. */
18
+ export declare const YOGINI_YEARS: readonly [1, 2, 3, 4, 5, 6, 7, 8];
19
+ /** 0-based starting yogini index from the Moon's nakshatra index (0-based):
20
+ * (nakshatra number + 3) mod 8, a remainder of 0 mapping to the 8th. */
21
+ export declare function startingYogini(nakIndex: number): number;
22
+ export interface YoginiSub {
23
+ yogini: string;
24
+ lord: string;
25
+ start: number;
26
+ end: number;
27
+ }
28
+ export interface YoginiPeriod {
29
+ level: number;
30
+ yogini: string;
31
+ lord: string;
32
+ years: number;
33
+ start: number;
34
+ end: number;
35
+ sub: YoginiSub[];
36
+ }
37
+ export interface YoginiTimeline {
38
+ start_yogini: string;
39
+ balance_years: number;
40
+ dashas: YoginiPeriod[];
41
+ }
42
+ /** The Yogini dasha timeline from the Moon's sidereal longitude. */
43
+ export declare function yoginiDashas(moonLon: number, natalJd: number, levels?: number, yearLength?: number, count?: number): YoginiTimeline;
44
+ export interface YoginiActive {
45
+ maha: string;
46
+ antar: string | null;
47
+ }
48
+ /** The maha and antar yogini active at targetJd; null before the first period. */
49
+ export declare function yoginiActive(moonLon: number, natalJd: number, targetJd: number, yearLength?: number): YoginiActive | null;
50
+ /** Yogini dasha active at targetJd, from the natal Moon's nakshatra. */
51
+ export declare function yoginiAt(engine: Engine, natalJd: number, targetJd: number, zodiac?: Zodiac, yearLength?: number): {
52
+ moon_nakshatra: string;
53
+ start_yogini: string;
54
+ } & Partial<YoginiActive>;
@@ -0,0 +1,63 @@
1
+ import { nakshatra, NAK_SPAN, DASHA_YEAR } from "./vedic.js";
2
+ export const YOGINIS = [
3
+ "Mangala", "Pingala", "Dhanya", "Bhramari", "Bhadrika", "Ulka", "Siddha", "Sankata",
4
+ ];
5
+ export const YOGINI_LORDS = {
6
+ Mangala: "moon", Pingala: "sun", Dhanya: "jupiter", Bhramari: "mars",
7
+ Bhadrika: "mercury", Ulka: "saturn", Siddha: "venus", Sankata: "rahu",
8
+ };
9
+ /** Period in years by yogini index (Mangala..Sankata), totalling 36. */
10
+ export const YOGINI_YEARS = [1, 2, 3, 4, 5, 6, 7, 8];
11
+ const YOGINI_TOTAL = 36;
12
+ /** 0-based starting yogini index from the Moon's nakshatra index (0-based):
13
+ * (nakshatra number + 3) mod 8, a remainder of 0 mapping to the 8th. */
14
+ export function startingYogini(nakIndex) {
15
+ const y = (nakIndex + 1 + 3) % 8; // nakshatra number is 1-based
16
+ return ((y - 1) % 8 + 8) % 8; // remainder 0 -> 8th (index 7)
17
+ }
18
+ /** The Yogini dasha timeline from the Moon's sidereal longitude. */
19
+ export function yoginiDashas(moonLon, natalJd, levels = 2, yearLength = DASHA_YEAR, count = 8) {
20
+ const nak = nakshatra(moonLon);
21
+ const start = startingYogini(nak.index);
22
+ const elapsed = nak.pos / NAK_SPAN;
23
+ const y0 = YOGINI_YEARS[start];
24
+ let t = natalJd - elapsed * y0 * yearLength;
25
+ const dashas = [];
26
+ for (let k = 0; k < count; k++) {
27
+ const yi = (start + k) % 8;
28
+ const years = YOGINI_YEARS[yi];
29
+ const span = years * yearLength;
30
+ const maha = {
31
+ level: 1, yogini: YOGINIS[yi], lord: YOGINI_LORDS[YOGINIS[yi]],
32
+ years, start: t, end: t + span, sub: [],
33
+ };
34
+ if (levels >= 2) {
35
+ let st = t;
36
+ for (let j = 0; j < 8; j++) {
37
+ const sj = (yi + j) % 8;
38
+ const subSpan = (years * YOGINI_YEARS[sj] / YOGINI_TOTAL) * yearLength;
39
+ maha.sub.push({ yogini: YOGINIS[sj], lord: YOGINI_LORDS[YOGINIS[sj]], start: st, end: st + subSpan });
40
+ st += subSpan;
41
+ }
42
+ }
43
+ dashas.push(maha);
44
+ t += span;
45
+ }
46
+ return { start_yogini: YOGINIS[start], balance_years: (1 - elapsed) * y0, dashas };
47
+ }
48
+ /** The maha and antar yogini active at targetJd; null before the first period. */
49
+ export function yoginiActive(moonLon, natalJd, targetJd, yearLength = DASHA_YEAR) {
50
+ const timeline = yoginiDashas(moonLon, natalJd, 2, yearLength, 24).dashas;
51
+ const maha = timeline.find((p) => p.start <= targetJd && targetJd < p.end);
52
+ if (!maha)
53
+ return null;
54
+ const antar = maha.sub.find((s) => s.start <= targetJd && targetJd < s.end);
55
+ return { maha: maha.yogini, antar: antar ? antar.yogini : null };
56
+ }
57
+ /** Yogini dasha active at targetJd, from the natal Moon's nakshatra. */
58
+ export function yoginiAt(engine, natalJd, targetJd, zodiac = "sidereal:lahiri", yearLength = DASHA_YEAR) {
59
+ const moonLon = engine.longitude("moon", natalJd, { zodiac });
60
+ const nak = nakshatra(moonLon);
61
+ const active = yoginiActive(moonLon, natalJd, targetJd, yearLength) ?? {};
62
+ return { moon_nakshatra: nak.name, start_yogini: YOGINIS[startingYogini(nak.index)], ...active };
63
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "caelus",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "Astrological ephemeris engine. MIT, no AGPL, no ephemeris files. Checked against Swiss Ephemeris.",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",