- Dharmagya
- panchang docs
- Strength, Yogas & Karakas
Strength, Yogas & Karakas
panchang · v5.4.0 · MIT
Graha drishti, six-fold Shadbala, Bhava Bala, Ashtakavarga with reductions, ~25 named yogas with cancellations, and Jaimini karakas.
Everything here works from the d1 chart, or from raw birth data. Both come from Birth Charts.
Aspects (Drishti)
import { computeAspects } from 'panchang-ts';
// Every graha aspects the 7th; Mars, Jupiter and Saturn add special
// aspects (Mars 4+8, Jupiter 5+9, Saturn 3+10).
const aspects = computeAspects(d1); // BPHS 7th-only on nodes
const aspExt = computeAspects(d1, { nodeAspects: '5-and-9' }); // KP/BV Raman extension
aspects.Mars; // [3, 6, 7]
aspects.Rahu; // [7]
aspExt.Rahu; // [5, 7, 9]import (
"github.com/ishankgupta95/panchang/source/go/v5/panchang"
"github.com/ishankgupta95/panchang/source/go/v5/types"
)
// s, birth, loc, d1 as on Birth Charts.
// Every graha aspects the 7th; Mars, Jupiter and Saturn add special
// aspects (Mars 4+8, Jupiter 5+9, Saturn 3+10).
aspects, err := panchang.ComputeAspects(&d1, types.AspectsOptions{}) // BPHS 7th-only on nodes
if err != nil {
panic(err)
}
aspExt, _ := panchang.ComputeAspects(&d1, types.AspectsOptions{NodeAspects: types.NodeAspects5And9})
fmt.Println(aspects.Mars) // [3 6 7]
fmt.Println(aspects.Rahu) // [7]
fmt.Println(aspExt.Rahu) // [5 7 9]The nodes aspect only the 7th by default, which is the BPHS rule. Pass nodeAspects: '5-and-9' if you want the KP and B. V. Raman extension instead. An empty string means the default. Any other value throws a PanchangError with code INVALID_INPUT; before 5.4 TypeScript ignored it and gave the 7th only, while Go already returned the error.
Shadbala and Bhava Bala
import { computeShadbala, computeBhavaBala } from 'panchang-ts';
// Shadbala — 7 visible grahas, 6 components, in Virupas (60 V = 1 Rupa).
// Sthana = Uchcha + Saptavargaja (D1/D2/D3/D7/D9/D12/D30 dignity sum)
// + Ojha-Yugma (rashi + navamsa parity) + Drekkana, range [0, 420 V].
// Dig is the directional cusp. Kala = Nathonatha (5 V an hour from apparent
// midnight to apparent noon) + Paksha (the Sun-Moon elongation at birth). Chesta
// is the retrograde bucket, Naisargika a fixed rank, Drik the weighted aspects.
const bala = computeShadbala(birth, loc);
bala.Sun.total; // 408.97
// Bhava Bala — 12-bhava strength built on top of Shadbala.
// Per-bhava: { bhavadhipati, dik, drik, sthana, total }.
const bhavaBala = computeBhavaBala(birth, loc);
bhavaBala.houses[0].total; // 424.46// s, birth, loc as on Birth Charts.
// Shadbala - 7 visible grahas, 6 components, in Virupas (60 V = 1 Rupa).
bala, err := s.ComputeShadbala(birth, loc, types.BirthChartOptions{})
if err != nil {
panic(err)
}
fmt.Printf("%+v\n", bala.Sun)
// {Sthana:151.45466774748732 Dig:50.62133441415399 Kala:71.89028662720226
// Chesta:30 Naisargika:60 Drik:45 Total:408.9662887888436}
// Bhava Bala - 12-bhava strength built on top of Shadbala.
bhavaBala, _ := s.ComputeBhavaBala(birth, loc, types.BirthChartOptions{})
fmt.Printf("%+v\n", bhavaBala.Houses[0])
// {Bhavadhipati:364.4641467061311 Dik:60 Drik:0 Sthana:0 Total:424.4641467061311}Both take birth data rather than a chart, and build what they need internally. A call takes a fraction of a millisecond; see Performance.
Nathonatha Bala, the day-and-night part of Kala Bala, follows BPHS (Ch. 27, v8-9): 5 virupas an hour, from 0 at apparent midnight to 60 at apparent noon. Apparent noon is the midpoint of the sunrise at or before birth and the sunset after it, and apparent midnight is twelve hours later. The Sun, Jupiter and Venus take that value, the Moon, Mars and Saturn take 60 minus it, and Mercury always takes 60.
Ashtakavarga
import { computeAshtakavarga } from 'panchang-ts';
// 12-rashi bindu grids (BPHS Ch. 66).
const av = computeAshtakavarga(d1);
av.sarvashtaka; // 12 cells, each 0..56, total 337
av.bhinnashtaka.Jupiter; // 12-cell grid; Jupiter total = 56 (chart-invariant)
// Other invariants: Sun=48, Moon=49, Mars=39, Mercury=54, Venus=52, Saturn=39.
// Trikona + Ekadhipatya Sodhana reductions (BPHS Ch. 67):
const avR = computeAshtakavarga(d1, { reductions: true });
avR.reduced!.sarvashtaka;// s, birth, loc, d1 as on Birth Charts.
// 12-rashi bindu grids (BPHS Ch. 66).
av := panchang.ComputeAshtakavarga(&d1, types.AshtakavargaOptions{})
fmt.Println(av.Sarvashtaka) // [29 35 30 28 30 25 31 22 32 29 20 26]
fmt.Println(av.Bhinnashtaka.Jupiter) // [7 4 5 5 5 5 3 5 4 6 3 4], total 56
// Trikona + Ekadhipatya Sodhana reductions (BPHS Ch. 67).
// Reduced is nil unless Reductions is set.
avR := panchang.ComputeAshtakavarga(&d1, types.AshtakavargaOptions{Reductions: true})
fmt.Println(avR.Reduced.Sarvashtaka) // [2 12 6 10 6 4 7 4 4 8 0 8]The reduced grids are only filled in when you ask for them, so read reduced only on a call that passed reductions: true.
Named yogas
import { computeYogas, computeNavamsa } from 'panchang-ts';
// ~25 named yogas — Pancha Mahapurusha (Ruchaka/Bhadra/Hamsa/Malavya/Sasha),
// lunar (Gajakesari, Sunapha, Anapha, Durudhura, Kemadruma), solar
// (Budha-Aditya, Veshi, Vasi, Ubhayachari), Raja (kendra/trikona-lord,
// Dharma-Karmadhipati, Vipareeta, Lakshmi), Dhana (2-11, 5-9, Vasumati),
// Vargottama, Yogakaraka, Neecha Bhanga, Daridra.
const yogas = computeYogas(d1);
// → [{ name, type, reasons[], bhanga?: { applies, reasons[] } }, …]
yogas[0]; // { name: 'Anapha', type: 'lunar', reasons: ['Saturn in 12th from Moon'] }
// Filter by type / pass D9 for Vargottama:
const d9 = computeNavamsa(birth, loc);
const all = computeYogas(d1, { types: ['raja', 'dhana'], navamsa: d9 });
all.map(y => y.name); // ['Raja Yoga']// s, birth, loc, d1 as on Birth Charts.
// ~25 named yogas. Each is { Name, Type, Reasons, Bhanga }.
yogas, err := panchang.ComputeYogas(&d1, types.ComputeYogasOptions{})
if err != nil {
panic(err)
}
for _, y := range yogas {
fmt.Println(y.Name, y.Type, y.Reasons)
}
// Anapha lunar [Saturn in 12th from Moon]
// Veshi solar [Mercury in 2nd from Sun]
// Raja Yoga raja [Kendra-lord Saturn and trikona-lord Mercury in mutual aspect]
// ...
// Filter by type / pass D9 for Vargottama.
d9, _ := s.ComputeNavamsa(birth, loc, types.BirthChartOptions{})
all, _ := panchang.ComputeYogas(&d1, types.ComputeYogasOptions{
// panchang.AllYogaTypes() returns all eight categories.
Types: []types.YogaType{types.YogaRaja, types.YogaDhana},
Navamsa: &d9,
})
fmt.Println(len(all), all[0].Name) // 1 Raja YogaSome yogas carry a cancellation annotation. The five Pancha Mahapurusha yogas report bhanga when the yoga-forming graha shares a rashi with the Sun or the Moon; Gajakesari reports it when Jupiter is combust or debilitated. Neecha Bhanga checks four conditions:
- the dispositor in a kendra from Lagna or Moon
- the lord of the exaltation rashi in a kendra from Lagna or Moon
- another graha exalted and in a kendra from the debilitated graha
- the dispositor aspecting the debilitated planet
Kemadruma forms when no visible graha other than the Sun sits with the Moon or in the 2nd or 12th from it, the same exclusion Sunapha and Anapha make. Before 5.4 the Sun alone was enough to break it. A birth at Delhi on 21 February 1950 at 02:24 UTC has the Moon in Meena and no visible graha in Meena, Mesha or Kumbha except the Sun in Kumbha, and now lists Kemadruma with the reason 'No planet but the Sun in 2nd, 12th, or conjunct with Moon (the Sun does not break Kemadruma)'.
An unknown entry in types, or an unknown nodeAspects, throws a PanchangError with code INVALID_INPUT. Before 5.4 TypeScript returned an empty list for an unknown type; Go already returned the error.
Jaimini karakas
import { computeJaiminiKarakas } from 'panchang-ts';
// Atmakaraka (highest degree-in-rashi) … Darakaraka (lowest).
const k7 = computeJaiminiKarakas(d1); // 7-graha Parashara default
k7.Atmakaraka; // 'Saturn'
k7.Darakaraka; // 'Jupiter'// s, birth, loc, d1 as on Birth Charts.
// Atmakaraka (highest degree-in-rashi) ... Darakaraka (lowest).
k7, err := panchang.ComputeJaiminiKarakas(&d1) // 7-graha Parashara scheme
if err != nil {
panic(err)
}
fmt.Println(k7.Atmakaraka, k7.Darakaraka) // Saturn JupiterThe 8-graha Jaimini variant adds Rahu, ranked on its reversed degree, and inserts Pitrukaraka at the 5th place. In Go it is a function of its own, ComputeJaimini8Karakas, new in 5.4.
const k8 = computeJaiminiKarakas(d1, { variant: '8-jaimini' });
k8.Pitrukaraka; // 'Rahu'// s, birth, loc, d1 as on Birth Charts.
k8, err := panchang.ComputeJaimini8Karakas(&d1)
if err != nil {
panic(err)
}
fmt.Println(k8.Pitrukaraka) // Rahu