- Dharmagya
- panchang docs
- KP & Prashna
KP & Prashna
panchang · v5.4.0 · MIT
KP sub-lords at any longitude, Placidus-KP cuspal sub-lords, four-fold significators, and horary Prashna charts.
KP sub-lord at any longitude
KP splits the zodiac into 243 sub-divisions, sized in proportion to the Vimshottari dasha years. Give it a sidereal longitude and you get back the sign lord, the star lord and the sub-lord for that point.
import { computeKpSubLord } from 'panchang-ts';
// 243 sub-divisions across the zodiac, proportional to Vimshottari years.
const info = computeKpSubLord(45.5); // 15°30' Taurus
info.signLord; // 'Venus'
info.starLord; // 'Moon'
info.subLord; // 'Jupiter'import "github.com/ishankgupta95/panchang/source/go/v5/panchang"
// 243 sub-divisions across the zodiac, proportional to Vimshottari years.
info := panchang.ComputeKpSubLord(45.5) // 15deg30' Taurus
fmt.Println(info.SignLord) // Venus
fmt.Println(info.StarLord) // Moon
fmt.Println(info.SubLord) // JupiterCuspal sub-lords
Placidus-KP houses are always used here, because that is the scheme KP is built on. The call still takes the usual options, but houseSystem is ignored: pass whole-sign and you get the same Placidus-KP cusps back. The ayanamsa defaults to 'krishnamurti' rather than the birth-chart default of 'lahiri'.
Since 5.4 an option passed as undefined keeps its KP default, the same as leaving the key out. Before, { ayanamsa: undefined } fell through to Lahiri, which put the ascendant cusp of the chart below at 184.99° instead of 185.07°. Go has no undefined, and its empty Ayanamsa already meant Krishnamurti.
import { computeKpCuspalSubLords, PanchangError } from 'panchang-ts';
// Always Placidus-KP — KP's anchor scheme.
const cusps = computeKpCuspalSubLords(birth, loc);
cusps.cusps[0]!.subLord; // 'Sun' — ascendant
cusps.cusps[6]!.subLord; // 'Mars' — descendant
// Placidus is undefined beyond the polar circles (about ±66.56°).
try {
computeKpCuspalSubLords(birth, { latitude: 70, longitude: 20 });
} catch (e) {
(e as PanchangError).code; // 'CIRCUMPOLAR'
}import (
"github.com/ishankgupta95/panchang/source/go/v5/panchang"
"github.com/ishankgupta95/panchang/source/go/v5/types"
)
// s, birth, loc as on Birth Charts.
// Always Placidus-KP - KP's anchor scheme.
cusps, err := s.ComputeKpCuspalSubLords(birth, loc, types.BirthChartOptions{})
if err != nil {
panic(err)
}
fmt.Println(cusps.Cusps[0].SubLord, cusps.Cusps[6].SubLord) // Sun Mars
// Placidus is undefined beyond the polar circles (about +/-66.56 deg).
_, err = s.ComputeKpCuspalSubLords(birth, types.GeoLocation{Latitude: 70, Longitude: 20},
types.BirthChartOptions{})
fmt.Println(panchang.IsCode(err, types.ErrCircumpolar)) // truePlacidus houses are defined only inside the polar circles, up to about ±66.56° of latitude. A birth place beyond them fails with PanchangError('CIRCUMPOLAR') where a cusp does not exist, or PLACIDUS_DIVERGED where the cusp search does not settle; see Errors & Compatibility. Since 5.4 every latitude inside the circles works. Before, many charts between about 66.3° and 66.56° failed with PLACIDUS_DIVERGED; see the polar note on Birth Charts.
Significators
For each planet you get the houses it signifies under the four-fold KP rule: the house it occupies, the houses its star lord occupies, the houses it owns, and the houses its star lord owns. The result is indexed both ways, by planet and by house.
import { computeKpSignificators } from 'panchang-ts';
// For each planet, the houses it signifies via the 4-fold KP rule
// (occupant + star-lord-occupant + owner + star-lord-owner).
const sig = computeKpSignificators(d1);
sig.byPlanet.Sun; // [9, 10, 11, 12]
sig.byHouse[10]; // ['Sun', 'Moon', 'Mars', 'Mercury', 'Venus']import "github.com/ishankgupta95/panchang/source/go/v5/panchang"
// s, birth, loc, d1 as on Birth Charts.
// For each planet, the houses it signifies via the 4-fold KP rule
// (occupant + star-lord-occupant + owner + star-lord-owner).
sig := panchang.ComputeKpSignificators(&d1)
fmt.Println(sig.ByPlanet.Sun) // [9 10 11 12]
h10, _ := sig.ByHouse.Get(10)
fmt.Println(h10) // [Sun Moon Mars Mercury Venus]Prashna (horary) chart
A Prashna chart is cast for the moment the question is asked, from where the querent is. You get the same shape back as a natal BirthChart, so everything that takes a chart takes this too.
import { computePrashnaChart } from 'panchang-ts';
// Cast at the question moment from the querent's location.
const moment = new Date('2026-05-09T14:30:00Z');
const loc = { latitude: 19.0760, longitude: 72.8777 };
const pchart = computePrashnaChart(moment, loc);
pchart.lagna.rashi.name; // 'Vrischika'
pchart.bhava.system; // 'placidus-kp' by default (KP horary anchor)
pchart.planets[1]!.house; // 3 — Moon, primary mind significator
// Traditional Vedic Prashna:
computePrashnaChart(moment, loc, { houseSystem: 'whole-sign' }).bhava.system;import "github.com/ishankgupta95/panchang/source/go/v5/types"
// s as on Birth Charts.
// Cast at the question moment from the querent's location.
moment, _ := time.Parse(time.RFC3339, "2026-05-09T14:30:00Z")
pchart, err := s.ComputePrashnaChart(moment,
types.GeoLocation{Latitude: 19.0760, Longitude: 72.8777},
types.BirthChartOptions{})
if err != nil {
panic(err)
}
fmt.Println(pchart.Lagna.Rashi.Name) // Vrischika
fmt.Println(pchart.Bhava.System) // placidus-kp by default
fmt.Println(pchart.Planets[1].Planet, pchart.Planets[1].House) // Moon 3
// Traditional Vedic Prashna:
ws, _ := s.ComputePrashnaChart(moment,
types.GeoLocation{Latitude: 19.0760, Longitude: 72.8777},
types.BirthChartOptions{HouseSystem: types.HouseSystemWholeSign})
fmt.Println(ws.Bhava.System) // whole-signThe defaults are 'placidus-kp' houses and the 'krishnamurti' ayanamsa, the KP horary anchor. Pass { houseSystem: 'whole-sign' } for traditional Vedic Prashna. Since 5.4 both defaults hold when you pass either option as undefined. Before, an undefined houseSystem fell through to whole-sign houses and an undefined ayanamsa to Lahiri.
