Comments (4)
Hi there, unfortunately ayanamsas are not implemented in this library (yet)..
from flatlib.
nor is ayanamsa topic understand clearly, in indian astrology. swisseph 'offers' 42 of them, nobody knows for sure which one is 'neo - the one'.
the one popularly used in ind.astro is lahiri, and if one checks the details, it is arbitrary (not based on any real observations), and it was changed after it became 'a standard one'.
in short, ind.astro is a mess.
ie, using ayanamsa, for signs calculation, moves entry of sun into aries for cca. 23 days (23 being average ayanamsa, out of 42, approx.) later -> indians celebrate spring 23 days too late. except if this fact is incorporated in their celebration dates.
mixed zodiac is gaining popularity - western signs and jyotisa naksatras (moon mansions) calculations.
s love nia
from flatlib.
Can you include following code for calculating Ayanamsa:
(and include a constant for 'Chandra-Hari Ayanamsa'
#/*---------------------------------------------------------------*/ def JD(y, m, d, h, mn, s:float): # Provide y = negative y if Era is Before Common Era (BCE) era = "CE" if y == 0: print("There is no year 0 in the Julian system!") return -1 elif y < 0: era = 'BCE' y = -y if (y == 1582 and m == 10 and d > 4 and d < 15): print("The dates 5 through 14 October, 1582, do not exist in the Gregorian system!") return -2 # if y < 0: y = y + 1 if era == 'BCE': y = -y + 1 if m > 2: jy = y jm = m + 1 else: jy = y - 1 jm = m + 13 intgr = int(math.floor(math.floor(365.25*jy) + math.floor(30.6001*jm) + d + 1720995)) #print(intgr) #check for switch to Gregorian calendar gregcal = 15 + 31*(10 + 12*1582) if (d + 31*(m + 12*y) >= gregcal): ja = int(math.floor(0.01*jy)) intgr += 2 - ja + int(math.floor(0.25*ja)) #correct for half-day offset dayfrac = float(h)/24.0 - 0.5; if ( dayfrac < 0.0 ): dayfrac += 1.0 intgr -= 1 #ow set the fraction of a day frac = dayfrac + (float(mn) + s/60.0)/60.0/24.0 #print(frac) #round to nearest second jd0 = (intgr + frac)*100000 #print(jd0) jd = int(math.floor(jd0)) #print(jd) if (jd0 - jd > 0.5): jd += 1 return float(int(jd/100000)) #/*---------------------------------------------------------------*/ def jd (d, m, y): #long a, j, l; #float b; if (m < 3): m += 12 y -= 1 a = y/100 b = float(30.6) * float(m+1) l = int(b) j = 365 * y + y/4 + l + 2 - a + a/4 + d return j #/*---------------------------------------------------------------*/ def jd2000 (y, m, d, h, mt, s:float): return JD(y,m,d,h,mt,s) #//return (snDate.day2000(y,m,d,0,0,0.0,0)); #/*---------------------------------------------------------------*/ def precessionArc (jd1:float, jd2:float): pArc = 0.0 t_period = 0.0 Tperiod = 0.0 jd2000 = 2451545.0 t_period = (float(jd2 - jd1)) / 36525.0 Tperiod = (float(jd1 - jd2000)) / 36525.0; #print(" JD2000 = " + jd2000 + " Calc=" + jd2000(2000,1,1,12,0,0)) pArc = (5029.0966 + 2.22226*Tperiod - 0.000042*Tperiod*Tperiod) pArc = pArc * t_period pArc = pArc + (1.11161 - 0.000127 * Tperiod)* t_period * t_period pArc = pArc - 0.000113 * t_period * t_period * t_period return (pArc/60.0/60.0) #/*---------------------------------------------------------------*/ def chandraHari_Ayana (y, m, d, h, mt, s:float): jd1 = jd2000(231,3,21,15,30,0.0) # //Spring Equinox of 231 A.D. = 0 Ayanamsa jd2 = jd2000(y,m,d,h,mt,s) #//System.out.println("JD231 = " + jd1 + " Required for "+jd2); return (precessionArc(jd1, jd2)) #/*---------------------------------------------------------------*/ #/*---------------------------------------------------------------*/ def hms2float(h, m, s): #tm = date.utcoffset.time() #tm = tzUTCoffset.time() #tmVal = (((tm[2] / 60) + tm[1]) / 60) + tm[0] tmVal = (((float(s) / 60.0) + float(m)) / 60.0) + float(h) return tmVal #/*---------------------------------------------------------------*/ def ayan(ayan_opt:int, y, m, d, h, mt, sec, tz, aya_val:float): ret = 0.0 chandraHariAyana = False j = jd(d, m, y) #h6 = float(h) + (float(mt) + float(sec)/60.0) / 60.0; h6 = hms2float(h, mt, sec) timeZone = tz h6 = (h6 - timeZone - 12.0) / 24.0 b6 = (float(j) - 694025.0 + h6) / 36525.0 if ayan_opt == 1: ret = 21.013972 + 1.398191*b6; # BVRaman elif ayan_opt == 2: ret = chandraHari_Ayana(y, m, d, h, mt, s) #print("ChandraHari Ayana using Precsn Arc="+DMS.dms(ret)) chandraHariAyana = True elif ayan_opt == 3: ret = aya_val; # User specified else: ret = 22.460148 + 1.396042*b6 + 3.08e-4*b6*b6 # NCLahiri - Default return ret #/*---------------------------------------------------------------*/
from flatlib.
My 2 cents:
You should try to translate that with appropriate SwissEph functions directly.
See https://www.astro.com/swisseph/swephprg.htm#_Toc78973611 (C API)
Or equivalent Python functions in Pyswisseph https://github.com/astrorigin/pyswisseph
And follow instructions for user-defined ayanamsa.
If that is not giving you satisfaction, you can discuss the problem here: https://groups.io/g/swisseph
from flatlib.
Related Issues (20)
- Usage examples? HOT 1
- Unexpected results HOT 1
- Iterate for two years? HOT 1
- can not use modern planets. HOT 2
- cannot install, fails at pyswisseph HOT 3
- SwissEph file 'seas_18.se1' not found in PATH '.:/users/ephe2/:/users/ephe/' HOT 10
- house number is wrong with some planets HOT 1
- Plans to add planets past Saturn? HOT 5
- House calculation HOT 1
- Where are Neptune and Uranus? HOT 2
- Is there a way to calculate lunation day? HOT 1
- Planet sits in a wrong house HOT 3
- Results don't match with other pages' results HOT 6
- Vedic sunset/sunrise? HOT 1
- Applying aspects HOT 7
- add new planet to flatlib objects HOT 5
- iterating through const.LIST_OBJECTS with chart.get() throws error at uranus HOT 1
- Parans?
- Polar regions - ValueError: math domain error
- Retrieving angle value HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flatlib.