libaditya 0.3.4__py2.py3-none-any.whl

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 (131) hide show
  1. libaditya/__init__.py +46 -0
  2. libaditya/_version.py +29 -0
  3. libaditya/calc/__init__.py +9 -0
  4. libaditya/calc/api.py +30 -0
  5. libaditya/calc/avasthas.py +346 -0
  6. libaditya/calc/docs/jaimini-get-arch.md +95 -0
  7. libaditya/calc/hellenistic.py +37 -0
  8. libaditya/calc/jaimini.py +335 -0
  9. libaditya/calc/jaimini_get.py +240 -0
  10. libaditya/calc/kala.py +73 -0
  11. libaditya/calc/panchanga.py +422 -0
  12. libaditya/calc/rashi.py +612 -0
  13. libaditya/calc/returns.py +50 -0
  14. libaditya/calc/swe_functions.py +118 -0
  15. libaditya/calc/varga.py +287 -0
  16. libaditya/calc/vimshottari.py +431 -0
  17. libaditya/cards/__init__.py +5 -0
  18. libaditya/cards/card.py +90 -0
  19. libaditya/cards/cards_constants.py +115 -0
  20. libaditya/cards/cards_of_truth.py +323 -0
  21. libaditya/cards/cot.py +142 -0
  22. libaditya/cards/deck.py +52 -0
  23. libaditya/charts/__init__.py +6 -0
  24. libaditya/charts/api.py +36 -0
  25. libaditya/charts/bodygraph.py +80 -0
  26. libaditya/charts/chart.py +286 -0
  27. libaditya/charts/jaimini.py +83 -0
  28. libaditya/charts/tajika.py +36 -0
  29. libaditya/constants.py +1776 -0
  30. libaditya/draw/__init__.py +20 -0
  31. libaditya/draw/draw_bodygraph.py +489 -0
  32. libaditya/draw/draw_sbc.py +712 -0
  33. libaditya/draw/themes/default-theme.hd +53 -0
  34. libaditya/ephe/ast0/se00010s.se1 +0 -0
  35. libaditya/ephe/seas_00.se1 +0 -0
  36. libaditya/ephe/seas_06.se1 +0 -0
  37. libaditya/ephe/seas_12.se1 +0 -0
  38. libaditya/ephe/seas_18.se1 +0 -0
  39. libaditya/ephe/seas_24.se1 +0 -0
  40. libaditya/ephe/seas_30.se1 +0 -0
  41. libaditya/ephe/seas_36.se1 +0 -0
  42. libaditya/ephe/seas_42.se1 +0 -0
  43. libaditya/ephe/seas_48.se1 +0 -0
  44. libaditya/ephe/seasm06.se1 +0 -0
  45. libaditya/ephe/seasm12.se1 +0 -0
  46. libaditya/ephe/seasm18.se1 +0 -0
  47. libaditya/ephe/seasm24.se1 +0 -0
  48. libaditya/ephe/seasm30.se1 +0 -0
  49. libaditya/ephe/seasm36.se1 +0 -0
  50. libaditya/ephe/seasm42.se1 +0 -0
  51. libaditya/ephe/seasm48.se1 +0 -0
  52. libaditya/ephe/seasm54.se1 +0 -0
  53. libaditya/ephe/sefstars.txt +4245 -0
  54. libaditya/ephe/semo_00.se1 +0 -0
  55. libaditya/ephe/semo_06.se1 +0 -0
  56. libaditya/ephe/semo_12.se1 +0 -0
  57. libaditya/ephe/semo_18.se1 +0 -0
  58. libaditya/ephe/semo_24.se1 +0 -0
  59. libaditya/ephe/semo_30.se1 +0 -0
  60. libaditya/ephe/semo_36.se1 +0 -0
  61. libaditya/ephe/semo_42.se1 +0 -0
  62. libaditya/ephe/semo_48.se1 +0 -0
  63. libaditya/ephe/semom06.se1 +0 -0
  64. libaditya/ephe/semom12.se1 +0 -0
  65. libaditya/ephe/semom18.se1 +0 -0
  66. libaditya/ephe/semom24.se1 +0 -0
  67. libaditya/ephe/semom30.se1 +0 -0
  68. libaditya/ephe/semom36.se1 +0 -0
  69. libaditya/ephe/semom42.se1 +0 -0
  70. libaditya/ephe/semom48.se1 +0 -0
  71. libaditya/ephe/semom54.se1 +0 -0
  72. libaditya/ephe/sepl_00.se1 +0 -0
  73. libaditya/ephe/sepl_06.se1 +0 -0
  74. libaditya/ephe/sepl_12.se1 +0 -0
  75. libaditya/ephe/sepl_18.se1 +0 -0
  76. libaditya/ephe/sepl_24.se1 +0 -0
  77. libaditya/ephe/sepl_30.se1 +0 -0
  78. libaditya/ephe/sepl_36.se1 +0 -0
  79. libaditya/ephe/sepl_42.se1 +0 -0
  80. libaditya/ephe/sepl_48.se1 +0 -0
  81. libaditya/ephe/seplm06.se1 +0 -0
  82. libaditya/ephe/seplm12.se1 +0 -0
  83. libaditya/ephe/seplm18.se1 +0 -0
  84. libaditya/ephe/seplm24.se1 +0 -0
  85. libaditya/ephe/seplm30.se1 +0 -0
  86. libaditya/ephe/seplm36.se1 +0 -0
  87. libaditya/ephe/seplm42.se1 +0 -0
  88. libaditya/ephe/seplm48.se1 +0 -0
  89. libaditya/ephe/seplm54.se1 +0 -0
  90. libaditya/hd/__init__.py +8 -0
  91. libaditya/hd/calc.py +55 -0
  92. libaditya/hd/constants.py +127 -0
  93. libaditya/hd/longitude.py +271 -0
  94. libaditya/objects/__init__.py +19 -0
  95. libaditya/objects/celestial_object.py +206 -0
  96. libaditya/objects/context.py +133 -0
  97. libaditya/objects/cusps.py +259 -0
  98. libaditya/objects/julian_day.py +265 -0
  99. libaditya/objects/location.py +167 -0
  100. libaditya/objects/longitude.py +987 -0
  101. libaditya/objects/nakshatras.py +285 -0
  102. libaditya/objects/planets.py +2059 -0
  103. libaditya/objects/shadbala.py +398 -0
  104. libaditya/objects/signs.py +690 -0
  105. libaditya/objects/swe_functions.py +75 -0
  106. libaditya/print_functions.py +548 -0
  107. libaditya/read.py +665 -0
  108. libaditya/stars/__init__.py +4 -0
  109. libaditya/stars/fixed_star.py +216 -0
  110. libaditya/stars/make_swe_stars.py +407 -0
  111. libaditya/stars/star-sign-boundaries +44 -0
  112. libaditya/stars/stellarium/__init__.py +6 -0
  113. libaditya/stars/stellarium/remote_control/__init__.py +22 -0
  114. libaditya/stars/stellarium/remote_control/location.py +82 -0
  115. libaditya/stars/stellarium/remote_control/locationsearch.py +35 -0
  116. libaditya/stars/stellarium/remote_control/main.py +165 -0
  117. libaditya/stars/stellarium/remote_control/objects.py +63 -0
  118. libaditya/stars/stellarium/remote_control/scripts.py +81 -0
  119. libaditya/stars/stellarium/remote_control/simbad.py +20 -0
  120. libaditya/stars/stellarium/remote_control/stelaction.py +31 -0
  121. libaditya/stars/stellarium/remote_control/stelproperty.py +30 -0
  122. libaditya/stars/stellarium/remote_control/view.py +85 -0
  123. libaditya/stars/stellarium/stellarium.py +92 -0
  124. libaditya/stars/the_stars.py +522 -0
  125. libaditya/stars/utilities.py +539 -0
  126. libaditya/utils.py +431 -0
  127. libaditya/write.py +67 -0
  128. libaditya-0.3.4.dist-info/METADATA +588 -0
  129. libaditya-0.3.4.dist-info/RECORD +131 -0
  130. libaditya-0.3.4.dist-info/WHEEL +5 -0
  131. libaditya-0.3.4.dist-info/licenses/LICENSE +661 -0
@@ -0,0 +1,398 @@
1
+ # This file is part of libaditya.
2
+ #
3
+ # Copyright (c) 2025 Josh Harper <humanhaven@substack.com>
4
+ #
5
+ # libaditya is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Affero General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # libaditya is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Affero General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Affero General Public License
16
+ # along with libaditya. If not, see <https://www.gnu.org/licenses/>.
17
+
18
+ """
19
+ shadbala is not an object, but these are all Mixin classes that go into classes in libaditya.objects
20
+ when i put these in calc/ there were import errors, so they are here in objects/
21
+ """
22
+
23
+ from libaditya import constants as const
24
+ from libaditya import utils
25
+
26
+ from .cusps import Cusp
27
+
28
+ class PlanetBala:
29
+ """
30
+ a Mixin for libaditya.objects.Planet which has shadbala methods
31
+ has most of them expect for class specific ones, e.g., Sun.cheshta_bala()
32
+ """
33
+
34
+
35
+ # STHANA BALA
36
+
37
+ def ucca_bala(self):
38
+ """
39
+ this method will work in each Varga, given the "amsha_longitude()", the longitude in whatever amsha this is in
40
+
41
+ get ucca bala for Planet; note, Moon and Mercury have their own special method because they have ex/db ranges, not points
42
+ if a planets longitude is at their Planet.ucca, ucca_bala is 60 points
43
+ if it is at thier Planet.nica, it is 0 points
44
+ it is a proportion of 60 in accord with its proportion between the two points
45
+ """
46
+ if self.identity() == "Moon" or self.identity() == "Mercury":
47
+ return self._ucca_bala_mm()
48
+ # ucca/nica are stored as sign.degrees, but we need the actual longitude to calculate ucca bala
49
+ ucca = utils.sign_degree_to_longitude(self.ucca(),self.context)
50
+ #nica = utils.sign_degree_to_longitude(self.nica(),self.context)
51
+
52
+ return self.virupas_between(ucca)
53
+
54
+ def _ucca_bala_mm(self):
55
+ """
56
+ get ucca bala for Moon or Mercury, not including Moon or Mercury
57
+ if a planets longitude is at their Planet.ucca, ucca_bala is 60 points
58
+ if it is at thier Planet.nica, it is 0 points
59
+ it is a proportion of 60 in accord with its proportion between the two points
60
+
61
+ you could use this in others vargas. the exaltation points would remaind the same
62
+ you could change it to move th exaltation point through the vargas as if it were another point
63
+ maybe will add that
64
+ """
65
+ # ucca/nica are stored as sign.degrees, but we need the actual longitude to calculate ucca bala
66
+ lower_ucca = utils.sign_degree_to_longitude(self.ucca()[0],self.context)
67
+ upper_ucca = utils.sign_degree_to_longitude(self.ucca()[1],self.context)
68
+ lower_nica = utils.sign_degree_to_longitude(self.nica()[0],self.context)
69
+ upper_nica = utils.sign_degree_to_longitude(self.nica()[1],self.context)
70
+
71
+ if self.amsha_longitude() >= lower_ucca and self.amsha_longitude() < upper_ucca:
72
+ return 60
73
+ if self.amsha_longitude() >= lower_nica and self.amsha_longitude() < upper_nica:
74
+ return 0
75
+
76
+ # these are the same, since the ex-db ranges are the same
77
+ # for the moon, each is 177, for mercury, each is 165
78
+ # ucca_length = 180-(upper_ucca - lower_ucca)
79
+ # nica_length = 180-(upper_nica - lower_nica)
80
+ # this is the length that gets 60 proportional points
81
+ calc_length = 180-(upper_ucca-lower_ucca)
82
+
83
+ if self.amsha_between(upper_ucca,lower_nica):
84
+ # 0-3 is the range of exaltation, so 60 points is divided into 177 degrees
85
+ from_lower_nica = self.amsha_degrees_apart(lower_nica)
86
+ return (from_lower_nica/calc_length)*60
87
+ if self.amsha_between(upper_nica,lower_ucca):
88
+ from_lower_ucca = self.amsha_degrees_apart(lower_ucca)
89
+ from_upper_nica = calc_length-from_lower_ucca
90
+ return (from_upper_nica/calc_length)*60
91
+
92
+ def saptavargaja_bala(self):
93
+ return self.attributes["saptavargaja_bala"]
94
+
95
+ def sama_visama_bala(self):
96
+ return self.attributes["sama_visama_bala"]
97
+
98
+ def kendradi_bala(self):
99
+ return self.attributes["kendradi_bala"]
100
+
101
+ def drekkana_bala(self):
102
+ """
103
+ this is based on the gender of a planet and which third of the sign it is in
104
+ thus a Planet can know its own drekkana bala
105
+ """
106
+ which_third = 0
107
+ if self.amsha_raw_in_sign_longitude() < 10:
108
+ which_third = 1
109
+ elif self.amsha_raw_in_sign_longitude() >= 10 and self.amsha_raw_in_sign_longitude() < 20:
110
+ which_third = 2
111
+ else:
112
+ which_third = 3
113
+ match (self.gender(),which_third):
114
+ case ("M",1):
115
+ return 15
116
+ case ("N",2):
117
+ return 15
118
+ case ("F",3):
119
+ return 15
120
+ case _:
121
+ return 0
122
+
123
+ def sthana_bala(self):
124
+ return self.ucca_bala() + self.saptavargaja_bala() + self.sama_visama_bala() + self.kendradi_bala() + self.drekkana_bala()
125
+
126
+ # DIG BALA
127
+
128
+ def _dig_bala(self, cusp: Cusp) -> float:
129
+ """
130
+ cusp is the Cusp whereat Planet has digbala
131
+
132
+ uses Longitude.virupas_between(point), where point is where the Planet has 60 virupas
133
+ """
134
+ return self.virupas_between(cusp.amsha_longitude())
135
+
136
+ # KALA BALA
137
+
138
+ # AYANA BALA
139
+
140
+ def ayana_bala(self):
141
+ """
142
+ ayana bala relates to the solstices as places where a planet can have 0 or 60 points
143
+ sun, mars, jupiter, venus have 60 at the northern solstice
144
+ moon, saturn have 60 at the southern solstice
145
+ mercury has 30 points on either equinox, and 60 points on either solstice
146
+
147
+ this is not exactly the algorithm bphs recommends
148
+ this algorithm makes all the motion proportional, i.e., every 3 degrees gains or loses 1 point
149
+ with the bphs style, a planet who likes the northern solstice will gain more slowly as it moves from
150
+ the southern solstice; e.g., with this algorithm, Jupiter 15 degrees past the southern solstice will have an
151
+ ayana bala of 5; with bphs, it will be about 2
152
+ is this difference really significant?
153
+ """
154
+ if self.identity() == "Mercury":
155
+ # mercury at the equinoxes has 30 points, and at each solstice 60 points
156
+ # so he has somewhere between 30 and 60 points
157
+ if self.ecliptic_longitude() >= 0 and self.ecliptic_longitude() < 90:
158
+ # if he is at 0, it will be 30
159
+ return self.virupas_between(90)
160
+ if self.ecliptic_longitude() >= 90 and self.ecliptic_longitude() < 180:
161
+ return self.virupas_between(90)
162
+ if self.ecliptic_longitude() >= 180 and self.ecliptic_longitude() < 270:
163
+ return self.virupas_between(270)
164
+ if self.ecliptic_longitude() >= 270 and self.ecliptic_longitude() < 0:
165
+ return self.virupas_between(270)
166
+ elif self.identity() == "Moon" or self.identity() == "Saturn":
167
+ # both have 60 points at the southern solstice, i.e., 270 degrees ecliptic longitude
168
+ return self.virupas_between(270)
169
+ else:
170
+ # all the others have 60 points at the northern solstice, i.e,, 90 degrees ecliptic longitude
171
+ return self.virupas_between(90)
172
+
173
+
174
+ # CHESHTA BALA
175
+
176
+ def mean_longitude(self):
177
+ t = self.context.timeJD.T()
178
+ return const.mean_longitude_formulas[self.identity()](t)
179
+
180
+ def cheshta_bala(self):
181
+ from libaditya.objects import Sun
182
+ t = self.context.timeJD.T()
183
+ sun_mean_longitude = Sun(self.context).mean_longitude()
184
+ mean = const.mean_longitude_formulas[self.identity()](t)
185
+ if self.identity() == "Mercury" or self.identity() == "Venus":
186
+ apogee = mean
187
+ mean = sun_mean_longitude
188
+ else:
189
+ apogee = sun_mean_longitude
190
+ average = (self.ecliptic_longitude()+mean)/2
191
+ reduce = abs(apogee - average)
192
+ if reduce > 180:
193
+ reduce = (360 - reduce)%360
194
+ return reduce/3
195
+
196
+ # DRIG BALA
197
+
198
+ def drig_bala(self):
199
+ return self.attributes["drig_bala"]
200
+
201
+ class RashiBala:
202
+ """
203
+ a Mixin for libaditya.calc.vargas.Rashi which has shadbala methods that work best at the Rashi level
204
+ """
205
+
206
+
207
+ # STHANA BALA
208
+ # also includes Planet.ucca_bala() and Planet.drekkana_bala()
209
+
210
+ def saptavargaja_balas(self):
211
+ return self._saptavargaja_balas
212
+
213
+ def sama_visama_balas(self):
214
+ return self._sama_visama_balas
215
+
216
+ def kendradi_balas(self):
217
+ return self._kendradi_balas
218
+
219
+ # STHANA BALA
220
+ # note: ucca_bala is calculated in Planet, since a Planet can know its own ucca bala
221
+ # likewise for drekkana_bala
222
+
223
+ def init_saptavargaja_balas(self):
224
+ """
225
+ find the saptavargaja bala for each karaka
226
+ set them in their Planet class
227
+ """
228
+ sapta_vargas = self.master.saptavargas()
229
+
230
+ points = {
231
+ "MT": 45,
232
+ "OH": 30,
233
+ "GF": 20,
234
+ "F": 15,
235
+ "N": 10,
236
+ "E": 4,
237
+ "GE": 2
238
+ }
239
+
240
+ # list of totals in karaka order
241
+ totals = []
242
+
243
+ # #import pdb; pdb.set_trace()
244
+ for planet in self.planets().karakas().values():
245
+ this_total = 0
246
+ for varga in sapta_vargas:
247
+ planet_in_varga = varga.planets()[planet.identity()]
248
+ dignity = planet_in_varga.dignity()
249
+ if dignity == "EX" or dignity == "DB":
250
+ dignity = planet_in_varga.combined_relationship()
251
+ this_total += points[dignity]
252
+ planet.set_attribute(("saptavargaja_bala",this_total))
253
+ totals.append(this_total)
254
+
255
+ return totals
256
+
257
+ def init_sama_visama_balas(self):
258
+ """
259
+ each planet gets points based on the gender of their signs in the rashi and navamsha
260
+ if they coincide, they get 15 points (for each varga); if not, 0
261
+ in this case, N is treated as M, basically
262
+ """
263
+ vargas = [self,self.master.varga(9)]
264
+
265
+ totals = []
266
+
267
+ #import pdb; pdb.set_trace()
268
+ for planet in self.planets().karakas().values():
269
+ this_total = 0
270
+ for varga in vargas:
271
+ planet_gender = planet.gender()
272
+ sign_gender = varga.signs().where_is(planet.identity()).gender()
273
+ if planet_gender == sign_gender or (planet_gender == "N" and sign_gender == "M"):
274
+ this_total += 15
275
+ planet.set_attribute(("sama_visama_bala",this_total))
276
+ totals.append(this_total)
277
+
278
+ return totals
279
+
280
+ def init_kendradi_balas(self):
281
+ """
282
+ in an angle, 60 points
283
+ in panaphara, 30 points
284
+ in apoklima, 15 points
285
+ """
286
+ balas = []
287
+ for planet in self.planets().karakas().values():
288
+ closest_cusp = self.cusps().closest_cusp(planet)
289
+ bala = 0
290
+ match closest_cusp:
291
+ case 1 | 4 | 7 | 10:
292
+ bala = 60
293
+ case 2 | 5 | 8 | 11:
294
+ bala = 30
295
+ case 3 | 6 | 9 | 12:
296
+ bala = 15
297
+ planet.set_attribute(("kendradi_bala",bala))
298
+ balas.append(bala)
299
+ return balas
300
+
301
+ def drekkana_balas(self):
302
+ balas = []
303
+ for planet in self.planets().karakas().values():
304
+ balas.append(planet.drekkana_bala())
305
+ return balas
306
+
307
+ def sthana_balas(self):
308
+ balas = []
309
+
310
+ for planet in self.planets().karakas().values():
311
+ balas.append(planet.sthana_bala())
312
+
313
+ return balas
314
+
315
+ # DIG BALA
316
+
317
+ def init_dig_balas(self):
318
+ digbs = self._dig_balas()
319
+ return digbs
320
+
321
+ def _dig_balas(self) -> [float]:
322
+ """
323
+ cusps is a Cusps class
324
+
325
+ return list of float values, which are the digbalas of the planets in their natural order
326
+ """
327
+ ret = []
328
+ for n,karaka in enumerate(self.planets().karakas().values()):
329
+ if n == 7:
330
+ break
331
+ ret.append(karaka._dig_bala(self.cusps()[karaka.dig_bala_cusp()]))
332
+ karaka.set_attribute(("dig_bala",ret[karaka.list_index()]))
333
+ return ret
334
+
335
+ def dig_balas(self):
336
+ return self._dig_balas
337
+
338
+ # KALA BALA
339
+
340
+
341
+ # AYANA BALA
342
+
343
+ def ayana_balas(self):
344
+ balas = []
345
+
346
+ for planet in self.planets().karakas().values():
347
+ balas.append(planet.ayana_bala())
348
+
349
+ return balas
350
+
351
+ # CHESHTA BALA
352
+
353
+ def cheshta_balas(self):
354
+ balas = []
355
+
356
+ for planet in self.planets().karakas().values():
357
+ balas.append(planet.cheshta_bala())
358
+
359
+ return balas
360
+
361
+ # DRIG BALA
362
+
363
+ def drig_balas(self):
364
+ return self._drig_balas
365
+
366
+ def init_drig_balas(self):
367
+ """
368
+ drig bala is aspect strength, using precise parashara aspect values
369
+ aspects of mercury and jupiter are added in full
370
+ aspects of other planets are combined to 1/4 of their strength
371
+ venus and benefic moon's values are added
372
+ values of sun, mars, saturn and malefic moon are subtracted
373
+ """
374
+ balas = []
375
+ # aspects is a list of list
376
+ # first list is aspects of sun to the grahas in order, second is aspects of moon to grahas in order, etc.
377
+ aspects = self.planets().parashara_aspects()
378
+
379
+ for this_planet_number,planet in enumerate(self.planets().karakas().values()):
380
+ this_total = 0
381
+ for aspecting_planet_number in range(0,7):
382
+ if not isinstance(aspects[aspecting_planet_number][this_planet_number], int):
383
+ # this means either aspecting_plant is this planet, or conjunct this plant, or does not aspect this planet
384
+ continue
385
+ # 3 is mercury and 4 is jupiter
386
+ # add there full aspect value
387
+ if aspecting_planet_number == 3 or aspecting_planet_number == 4:
388
+ this_total += aspects[aspecting_planet_number][this_planet_number]
389
+ # if it is venus or benefic moon, add 1/4 of their aspect value
390
+ elif aspecting_planet_number == 5 or (aspecting_planet_number == 1 and self.planets().moon().is_benefic()):
391
+ this_total += aspects[aspecting_planet_number][this_planet_number]*(1/4)
392
+ # otherwise it is a malefic aspect, so subtract 1/4 of the aspect value
393
+ else:
394
+ this_total -= aspects[aspecting_planet_number][this_planet_number]*(1/4)
395
+ planet.set_attribute(("drig_bala",this_total))
396
+ balas.append(this_total)
397
+
398
+ return balas