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,987 @@
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
+ import swisseph as swe
19
+ from typing import Self
20
+
21
+ from libaditya import constants as const
22
+ from libaditya import utils
23
+
24
+ from .context import EphContext, Circle
25
+
26
+
27
+ class Longitude:
28
+ """
29
+
30
+ note: this class is not really meant for users of any kind
31
+ most of this stuff should not be touched
32
+ ideally should not need to be touch
33
+ hopefully, it accurately represents the calculation basis well enough that it remains
34
+
35
+ in any case, if you are new to libaditya, the place to start is Chart()
36
+ Chart() sets off a whole cascade that ends up down here many times. Perhaps work your way
37
+ down from the top so you can see what is happening?
38
+
39
+ Longitude expects at minimum a longitude
40
+
41
+ longitude is a base floating point reference longitude already in whatever system you prefer
42
+
43
+ note: this class does NOT deal with tropical, sidereal, heliocentric, topocentric, etc.
44
+ (..though it may at some pont deal with draconic?)
45
+
46
+ it DOES however deal with whether something is referenced to the Aditya Circle or the Zodiac Circle
47
+ it also has to do with what varga, or "amsha" as the number itself is called, the longitude is referenced for
48
+
49
+ so if you know the ecliptic longitude of Mercury is 89 degrees (be they tropical, sidereal, or whatever) and you
50
+ want that in the 9th parivritti varga (the navamsha), you can call:
51
+ Longitude(89,9,context)
52
+
53
+ "context" is optional, but if you are working if a specific case, you will have a context you can pass
54
+ you can check out Longitude by
55
+
56
+ >>> l=Longitude(89,9)
57
+ >>> l
58
+ (89,321.0,9)
59
+ >>> l.longitde()
60
+ '21:00:00 parjanya'
61
+ >>> l.ecliptic_longitude()
62
+ 89
63
+ >>> l.context.circle
64
+ <Circle.ADITYA: 1>
65
+ >>> l.amsha_longitude()
66
+ 321.0
67
+
68
+ "amsha longitude" is what I chose to call the longitude in the varga. Everything longitude
69
+ knows its ecliptic longitude and its amsha longitude, if it is in an amsha other than one.
70
+ Thus, every longitude knows what sign that would in the rashi and its particular varga.
71
+ This is true of every object that is also an instance of Longitude, that is: Planet and Cusp and FixedStar.
72
+ Instances of all of these objects also have all of these
73
+
74
+ note: Longitude takes a floating longitude
75
+ this mean Longitude is not responsible for knowing if it is tropical or sidereal or topocentric, etc.
76
+ that is the job of CelestialObject and Cusp
77
+
78
+ Longitude does however initialize the varga longitude
79
+
80
+ for vargas, pass the longitude in the rashi along with, e.g., amsha=9
81
+ Longitude will know its original longitude, as well as the varga one
82
+ but it will consider itself to be a navamsha
83
+ so that Longitude.longitude() will give the longitude in the navamsha
84
+ """
85
+
86
+ def __init__(self, longitude: float, amsha, context=EphContext()):
87
+ self.context = context
88
+ if self.context.circle == Circle.ADITYA:
89
+ self.aditya_offset = 30
90
+ else:
91
+ self.aditya_offset = 0
92
+ self._amsha = amsha
93
+ self.jd = self.context.timeJD.jd_number()
94
+ # _longitude the ecliptic longitude of this longitude; i.e., in the rashi varga
95
+ self._longitude = longitude
96
+ # below is the index of the sign in a 0-indexed list; add 1 to get the sign number
97
+ self._ecliptic_index = int((self.ecliptic_longitude() % 360) / 30)
98
+ self._deity = "none"
99
+ self._amsha_longitude = self.varga(amsha)%360
100
+ self._amsha_index = int((self.amsha_raw_longitude() % 360) / 30)
101
+ self._ratio = self.get_ratio()
102
+
103
+ def Longitude(self):
104
+ return self
105
+
106
+ def ayanamsa(self):
107
+ return self.context.ayanamsa
108
+
109
+ def ecliptic_longitude(self) -> float:
110
+ return self._longitude
111
+
112
+ def amsha_raw_longitude(self):
113
+ return self._amsha_longitude
114
+
115
+ def raw_longitude(self) -> float:
116
+ if self.context.toround[0]:
117
+ return round(self.ecliptic_longitude(), self.context.toround[1])
118
+ else:
119
+ return self.ecliptic_longitude()
120
+
121
+ def amsha_longitude(self) -> float:
122
+ if self.context.toround[0]:
123
+ return round(self._amsha_longitude, self.context.toround[1])
124
+ else:
125
+ return self._amsha_longitude
126
+
127
+ def amsha_opposite(self):
128
+ return (self.amsha_longitude()+180)%360
129
+
130
+ def longitude(self) -> float | str:
131
+ if self.context.signize:
132
+ return self.signize()
133
+ else:
134
+ return self.amsha_longitude()
135
+
136
+ def ecliptic_index(self):
137
+ return self._ecliptic_index
138
+
139
+ def ecliptic_sign_index(self):
140
+ if self.context.circle == Circle.ADITYA:
141
+ return (self.ecliptic_index() + 1) % 12
142
+ else:
143
+ return self.ecliptic_index()
144
+
145
+ def ecliptic_sign(self):
146
+ """
147
+ ecliptic sign means the sign in the Rashi chart
148
+ this is the number of that sign
149
+ """
150
+ return self.ecliptic_sign_index()+1
151
+
152
+ def amsha_index(self):
153
+ return self._amsha_index
154
+
155
+ def amsha_sign_index(self):
156
+ if self.context.circle == Circle.ADITYA:
157
+ return (self.amsha_index() + 1) % 12
158
+ else:
159
+ return self.amsha_index()
160
+
161
+ def sign(self) -> int:
162
+ return self.amsha_sign_index() + 1
163
+
164
+ def sign_name(self) -> str:
165
+ return const.names[self.context.names_type][self.context.sign_names][self.amsha_sign_index()]
166
+
167
+ def get_rahu(self) -> float:
168
+ """
169
+ return float of rahus "ecliptic_longitude"
170
+ """
171
+ if self.context.sysflg == const.DRAC:
172
+ return swe.calc_ut(self.jd,swe.TRUE_NODE)[0][0]
173
+ else:
174
+ return 0
175
+
176
+ def in_sign_longitude(self) -> str:
177
+ if self.context.toround[0]:
178
+ inlong = round(self._longitude % 30, self.context.toround[1])
179
+ else:
180
+ inlong = self._longitude % 30
181
+ return utils.dec2dmsstr(inlong)
182
+
183
+ def real_in_sign_longitude(self) -> float:
184
+ """
185
+ i changed real_longitude to ecliptic_longitude
186
+
187
+ it might be tempting to change this name, but it works
188
+ i think it is just in the vargas, so would have to change all of them
189
+
190
+ there is a formula using this that makes it more clear what is going on
191
+ so dont change it
192
+ """
193
+ return self.ecliptic_longitude() % 30
194
+
195
+ def amsha_in_sign_longitude(self) -> float:
196
+ if self.context.toround[0]:
197
+ inlong = round(self.amsha_longitude() % 30, self.context.toround[1])
198
+ else:
199
+ inlong = self.amsha_longitude() % 30
200
+ return utils.dec2dmsstr(inlong)
201
+
202
+ def amsha_raw_in_sign_longitude(self) -> float:
203
+ if self.context.toround[0]:
204
+ return round(self.amsha_longitude() % 30, self.context.toround[1])
205
+ else:
206
+ return self.amsha_longitude() % 30
207
+
208
+ def amsha(self) -> int:
209
+ return self._amsha
210
+
211
+ def lord(self) -> str:
212
+ """
213
+ return the planetary lord of the sign this longitude is in in this amsha
214
+ """
215
+ return const.lords[self.sign()]
216
+
217
+ def deity(self) -> str:
218
+ """
219
+ returns the varga deity of the amsha that this longitude is in
220
+ varga lord is set in Longitude.varga() when it finds the longitude
221
+ amsha=1 can be passed if you want the lord of its sign in this varga
222
+ """
223
+ if self.amsha() < 0 or self.amsha() in [2,3,4,7,9,10,12,16,20,24,27,30,40,45,60]:
224
+ # if we have deities for this amsha, use them, otherwise, planetary lords
225
+ # varga lord is set in Longitude.varga() when it finds the longitude
226
+ return self._deity
227
+ else:
228
+ return const.lords[self.sign()]
229
+
230
+ def signize(self):
231
+ """
232
+ return a string with 360degree longitude long given with
233
+ long (sign), with long being in the sign
234
+ signs contains the signs to be used, which might be adityas
235
+ """
236
+ return f"{self.amsha_in_sign_longitude()} {self.sign_name()}"
237
+
238
+ def degrees_apart(self, next_long):
239
+ """
240
+ how many degrees from this longitude to next_long going forward around the ecliptic
241
+ """
242
+ # we dont cross the equinox to find the difference
243
+ if next_long > self.ecliptic_longitude():
244
+ return next_long - self.ecliptic_longitude()
245
+ # we have to cross the equinox, thus find the remainder in this cycle
246
+ # plus the portion of the next cycle
247
+ else:
248
+ return (360 - self.ecliptic_longitude()) + next_long
249
+
250
+ def amsha_degrees_apart(self, next_long):
251
+ """
252
+ how many degrees from this longitude to next_long going forward around the ecliptic
253
+ """
254
+ # we dont cross the equinox to find the difference
255
+ if next_long > self.amsha_longitude():
256
+ return next_long - self.amsha_longitude()
257
+ # we have to cross the equinox, thus find the remainder in this cycle
258
+ # plus the portion of the next cycle
259
+ else:
260
+ return (360 - self.amsha_longitude()) + next_long
261
+
262
+ def amsha_between(self, long1: float, long2: float) -> bool:
263
+ """
264
+ is self between long1 and long2, going signwise around the ecliptic?
265
+
266
+ this method is doesnt need to know what "kind" of longitude long1 and long2 are
267
+ not even what amsha. "on" means in the same relative circle.
268
+ """
269
+ # how far long1 is from 360
270
+ offset = 360 - long1
271
+ # this should = 0 mod 360
272
+ long1 = (long1+offset)%360
273
+ long2 = (long2+offset)%360
274
+ slong = (self.amsha_longitude()+offset)%360
275
+ return long1 <= slong and slong <= long2
276
+
277
+ def virupas_between(self, point: float | Self) -> float:
278
+ """
279
+ cusp is the Cusp of whereat Planet has digbala
280
+ point is the longitude (Cusp,Planet, other point)
281
+
282
+ between one point?
283
+
284
+ between point and its opposite point
285
+ in that 180 degrees, where is it?
286
+
287
+ between were this Longitude.amsha_longitude()
288
+ """
289
+ if isinstance(point, float) or isinstance(point, int):
290
+ point = Longitude(point,1,self.context)
291
+ if self.amsha_longitude() == point.amsha_longitude():
292
+ return 60
293
+ if self.amsha_longitude() == point.amsha_opposite():
294
+ return 0
295
+ # see if Planet is between 0 dig and 60 dig
296
+ if self.amsha_between(point.amsha_opposite(),point.amsha_longitude()):
297
+ how_far_into_this_cycle = ((self.amsha_longitude()-point.amsha_opposite())%360)/180
298
+ return how_far_into_this_cycle*60
299
+ # see if Planet is amsha_between 60 dig and 0 dig
300
+ if self.amsha_between(point.amsha_longitude(),point.amsha_opposite()):
301
+ how_close_to_opposite = ((point.amsha_opposite()-self.amsha_longitude())%360)/180
302
+ return how_close_to_opposite*60
303
+ return -1
304
+
305
+ def signs_apart(self, other_sign) -> int:
306
+ """
307
+ how many signs apart are this one sign and other_sign
308
+ if self=12 and other=1 -> (1-12)%12 = 1
309
+ used for temporary relationships
310
+ """
311
+ return (other_sign - self.sign())%12
312
+
313
+ def astrological_signs_foward(self,n) -> int:
314
+ """
315
+ go forward n signs
316
+ this means in the astrologically sense
317
+ so this sign is 1 and then we count
318
+ e.g., if this sign is sign 8 and we go forward 4 signs ->
319
+ 8,9,10,11, so 4 signs forwards from Scorpio is Aquarius
320
+ so self.astrological_signs_foward(1) = self
321
+
322
+ but in terms of sign numbers, we add n-1 to the sign number
323
+ and have to deal with how it wraps around
324
+ """
325
+ forward = self.sign() + (n-1)
326
+ if forward <= 12:
327
+ return forward
328
+ else:
329
+ return forward % 12
330
+
331
+ def amsha(self):
332
+ return self._amsha
333
+
334
+ def varga(self,amsha) -> float:
335
+ """
336
+ get varga with amsha divisions
337
+ returns float of longitude that varga
338
+ options for amsha:
339
+ all positive numbers give parivritti varga of that number
340
+ other numbers are for special vargas (listed as implemented):
341
+ -2 Hora -> the second half of a sign relates to the opposite sign
342
+ the first half of a sign is of that element, the second half of the other
343
+
344
+ these are called by functions in Longitude: .hora(), .drekkana(), etc.
345
+ this is where the actual calculation is done
346
+ """
347
+ if amsha == 1:
348
+ return self.ecliptic_longitude()
349
+ if amsha > 0:
350
+ return self.parivritti_varga(amsha)
351
+ match amsha:
352
+ case -2:
353
+ return self.hora()
354
+ case -3:
355
+ return self.drekkana()
356
+ case -4:
357
+ return self.chaturthamsha()
358
+ case -10:
359
+ return self.dashamsha()
360
+ case -100:
361
+ return self.dashamsha(even_reversed=True)
362
+ case -12:
363
+ return self.dvadashamsha()
364
+ case -16:
365
+ return self.shodashamsha()
366
+ case -20:
367
+ return self.vimshamsha()
368
+ case -24:
369
+ return self.siddhamsha(parashara=True)
370
+ case -240:
371
+ return self.siddhamsha()
372
+ case -27:
373
+ return self.bhamsha()
374
+ case -40:
375
+ return self.khavedamsha()
376
+ case -45:
377
+ return self.akshavedamsha()
378
+ case -60:
379
+ return self.shashtyamsha()
380
+ case _:
381
+ return "not yet implemented"
382
+
383
+
384
+ def parivritti_varga(self, this_amsha):
385
+ """
386
+ return the "real" longitude for self.ecliptic_longitude() in
387
+ varga number "division"
388
+ number 2-60 all refer to parvritti vargas
389
+
390
+ take number 8 for example:
391
+
392
+ divide each sign into 8, then write the names of the 12 signs
393
+ in order around this circle of 12*8 sections. There will be 8 sets of 12 signs.
394
+
395
+ sign sections, below
396
+ 01 02 03 04 05 06 07 08 01 02 03 04 05 06 07 08 01 02 03 04 05 06 07 08 01 02 03 04 05 06 07 08 01 02 03 04 05 06 07 08 01 02 03 04 05 06 07 08 01 02 03 04 05 06 07 08 01 02 03 04 05 06 07 08 01 02 03 04 05 06 07 08 01 02 03 04 05 06 07 08 01 02 03 04 05 06 07 08 01 02 03 04 05 06 07 08
397
+ 01 02 03 04 05 06 07 08 09 10 11 12 01 02 03 04 05 06 07 08 09 10 11 12 01 02 03 04 05 06 07 08 09 10 11 12 01 02 03 04 05 06 07 08 09 10 11 12 01 02 03 04 05 06 07 08 09 10 11 12 01 02 03 04 05 06 07 08 09 10 11 12 01 02 03 04 05 06 07 08 09 10 11 12 01 02 03 04 05 06 07 08 09 10 11 12
398
+ sign names, above
399
+
400
+ you have to look at it with no wrap, but the first line has 12 "01-08"s and the second line has 8 "01-12"s
401
+
402
+ if you look at each time 01 appears in the upper line, then below you while find either 01, 09, 05, etc.
403
+
404
+ likewise, 02, 10, and 06 form a trine, so you will see in the lines above that trines are always paired
405
+
406
+ that is a consequence of the dividing into 8 and the way the signs end up when laying them out
407
+
408
+ """
409
+ # just to make sure we are working with the rashi longitude
410
+ real_sign = self.ecliptic_sign_index()+1 # +1 to transform index into sign
411
+ real_longitude = self.ecliptic_longitude()+self.aditya_offset
412
+
413
+ amsha = 30/this_amsha
414
+ # position = which amsha this is in
415
+ position = real_longitude/amsha
416
+ amsha_elapsed = int(position)
417
+ # which amsha out of all the amshas
418
+ # i.e., in 2, there are 24 portions, in 9, 108
419
+ self._which_portion = amsha_elapsed+1
420
+ current_in_amsha = position%1
421
+
422
+ base_longitude = 0-self.aditya_offset
423
+
424
+ self.set_parivritti_deities(this_amsha,real_sign)
425
+
426
+ return base_longitude + (amsha_elapsed*30) + (current_in_amsha*30)
427
+
428
+ def get_ratio(self):
429
+ """
430
+ set the ratio of this parivritti varga
431
+ ratio meaning 12/amsha
432
+ for the first 12 amsha, we will relate this to a tone in just intonation
433
+ 12/9 = 4/3 => navamsha is related to 4/3
434
+ e.g.,
435
+ """
436
+ from fractions import Fraction
437
+ if self._amsha > 0:
438
+ return Fraction(12/self._amsha)
439
+ else:
440
+ return Fraction(0,1)
441
+
442
+ def ratio(self):
443
+ return self._ratio
444
+
445
+ def set_parivritti_deities(self, this_amsha, real_sign):
446
+ """
447
+ set self._deity for parivritti vargas that have deities, i.e., the 15 vargas of the 16 vargas
448
+ """
449
+ which_amsha = self._which_portion-1
450
+ if this_amsha == 2:
451
+ if utils.odd(real_sign):
452
+ if utils.odd(self._which_portion):
453
+ self._deity = "Sun"
454
+ if utils.even(self._which_portion):
455
+ self._deity = "Moon"
456
+ if utils.even(real_sign):
457
+ if utils.odd(self._which_portion):
458
+ self._deity = "Moon"
459
+ if utils.even(self._which_portion):
460
+ self._deity = "Sun"
461
+ if this_amsha == 3:
462
+ self._deity = const.varga_deities[3][which_amsha%3]
463
+ if this_amsha == 4:
464
+ self._deity = const.varga_deities[4][which_amsha%4]
465
+ if this_amsha == 7:
466
+ if utils.odd(real_sign):
467
+ self._deity = const.varga_deities[7][which_amsha%7]
468
+ if utils.even(real_sign):
469
+ self._deity = list(const.varga_deities[7].__reversed__())[which_amsha%7]
470
+ if this_amsha == 9:
471
+ self._deity = const.varga_deities[9][which_amsha%3]
472
+ if this_amsha == 10:
473
+ if utils.odd(real_sign):
474
+ self._deity = const.varga_deities[10][which_amsha%10]
475
+ if utils.even(real_sign):
476
+ self._deity = list(const.varga_deities[10].__reversed__())[which_amsha%10]
477
+ if this_amsha == 12:
478
+ self._deity = const.varga_deities[12][which_amsha%4]
479
+ if this_amsha == 16:
480
+ if utils.odd(real_sign):
481
+ self._deity = const.varga_deities[16][which_amsha%4]
482
+ if utils.even(real_sign):
483
+ self._deity = list(const.varga_deities[16].__reversed__())[which_amsha%4]
484
+ if this_amsha == 20:
485
+ # odd and even signs have different deities completely; 21 is for the odd signs, 20 for the even
486
+ if utils.odd(real_sign):
487
+ self._deity = const.varga_deities[21][which_amsha%20]
488
+ if utils.even(real_sign):
489
+ self._deity = const.varga_deities[20][which_amsha%20]
490
+ if this_amsha == 24:
491
+ if utils.odd(real_sign):
492
+ self._deity = const.varga_deities[24][which_amsha%12]
493
+ if utils.even(real_sign):
494
+ self._deity = list(const.varga_deities[24].__reversed__())[which_amsha%12]
495
+ if this_amsha == 27:
496
+ if utils.odd(real_sign):
497
+ self._deity = const.varga_deities[27][which_amsha%27]
498
+ if utils.even(real_sign):
499
+ self._deity = list(const.varga_deities[27].__reversed__())[which_amsha%27]
500
+ if this_amsha == 30:
501
+ real_in_sign = self.real_in_sign_longitude()
502
+ if utils.odd(real_sign):
503
+ if real_in_sign >= 0 and real_in_sign < 5:
504
+ self._deity = "Vahni/Mars"
505
+ if real_in_sign >= 5 and real_in_sign < 10:
506
+ self._deity = "Samira/Saturn"
507
+ if real_in_sign >= 10 and real_in_sign < 18:
508
+ self._deity = "Shakra/Jupiter"
509
+ if real_in_sign >= 18 and real_in_sign < 25:
510
+ self._deity = "Dhanada/Mercury"
511
+ if real_in_sign >= 25 and real_in_sign < 30:
512
+ self._deity = "Jalada/Venus"
513
+ if utils.even(real_sign):
514
+ if real_in_sign >= 0 and real_in_sign < 5:
515
+ self._deity = "Jalada/Venus"
516
+ if real_in_sign >= 5 and real_in_sign < 12:
517
+ self._deity = "Dhanada/Mercury"
518
+ if real_in_sign >= 12 and real_in_sign < 20:
519
+ self._deity = "Shakra/Jupiter"
520
+ if real_in_sign >= 20 and real_in_sign < 25:
521
+ self._deity = "Samira/Saturn"
522
+ if real_in_sign >= 25 and real_in_sign < 30:
523
+ self._deity = "Vahni/Mars"
524
+ if this_amsha == 40:
525
+ self._deity = const.varga_deities[40][which_amsha%12]
526
+ if this_amsha == 60:
527
+ if utils.odd(real_sign):
528
+ self._deity = const.varga_deities[60][which_amsha%60]
529
+ if utils.even(real_sign):
530
+ self._deity = list(const.varga_deities[60].__reversed__())[which_amsha%60]
531
+
532
+
533
+
534
+ def hora(self):
535
+ """
536
+ in the hora, lord of first half of a male sign is the sun, of second half is the moon
537
+ lord of first half of a female sign is hte moon, of second half is the sun
538
+ a planet in the first half stays in that sign
539
+ a planet in the second half goes to the opposite sign
540
+
541
+ this 1) returns the longitude of the planet in the hora
542
+ 2) sets self._deity to the hora lord
543
+ """
544
+ # just to make sure we are working with the rashi longitude
545
+ real_sign = self.ecliptic_sign_index()+1 # +1 to transform index into sign
546
+ real_in_sign = self.real_in_sign_longitude()
547
+
548
+ base_longitude = ((30*(real_sign-1))-self.aditya_offset)%360
549
+ opposite_base_longitude = ((base_longitude+180)%360)
550
+
551
+ # we need to 1) set the lord 2) return the amsha=-2 longitude
552
+ if utils.odd(real_sign) and real_in_sign < 15:
553
+ # first half of odd sign ->
554
+ self._deity = "Sun"
555
+ # stays in this sign
556
+ # minus makes the sign number into an index
557
+ hora_elapsed = (real_in_sign/15)*30
558
+ # print(f"{self.ecliptic_longitude()=}\n{self.sign()=}\t{real_sign=}")
559
+ return base_longitude+hora_elapsed
560
+ if utils.odd(real_sign) and real_in_sign >= 15:
561
+ # second half of odd sign ->
562
+ self._deity = "Moon"
563
+ # goes to opposite sign
564
+ hora_elapsed = ((real_in_sign-15)/15)*30
565
+ return opposite_base_longitude+hora_elapsed
566
+ if utils.even(real_sign) and real_in_sign < 15:
567
+ # first half of even sign ->
568
+ self._deity = "Moon"
569
+ # stays in this sign
570
+ # minus makes the sign number into an index
571
+ hora_elapsed = (real_in_sign/15)*30
572
+ return base_longitude+hora_elapsed
573
+ if utils.even(real_sign) and real_in_sign >= 15:
574
+ # second half of odd sign ->
575
+ self._deity = "Sun"
576
+ # goes to opposite sign
577
+ hora_elapsed = ((real_in_sign-15)/15)*30
578
+ return opposite_base_longitude+hora_elapsed
579
+
580
+ def drekkana(self):
581
+ """
582
+ same element, different modality
583
+ divide the sign into three: first 3rd remains as that sign, sign 1 from this sign (sign means Longitude(amsha), which implies a sign); narada
584
+ second 3rd goes to the next trine, the next sign of same element, different modality, sign 5 from here; agastya
585
+ third 3rd goes to the next next trine, the next next sign of same element, different different modality, sign 9 from here; durvasas
586
+
587
+ this 1) returns the longitude of the planet in the hora
588
+ 2) sets self._deity to the hora lord
589
+ """
590
+ # just to make sure we are working with the rashi longitude
591
+ real_sign = 1 + self.ecliptic_sign_index() # + 1 to transform index into sign
592
+ real_in_sign = self.real_in_sign_longitude()
593
+
594
+ # take care of it being aditya here, by adding self.aditya_offset; 30 if using Circle.ADITYA: 0 if using Circle.ZODIAC
595
+ base_longitude = ((30*(real_sign-1))-self.aditya_offset)%360
596
+ trine_longitude = (base_longitude+120)%360
597
+ trine_trine_longitude = (base_longitude+240)%360
598
+
599
+ if real_in_sign < 10:
600
+ self._deity = "Narada"
601
+ return base_longitude + (real_in_sign/10)*30
602
+ if real_in_sign >= 10 and real_in_sign < 20:
603
+ self._deity = "Agastya"
604
+ return trine_longitude + ((real_in_sign-10)/10)*30
605
+ if real_in_sign >= 20 and real_in_sign < 30:
606
+ self._deity = "Durvasas"
607
+ return trine_trine_longitude + ((real_in_sign-20)/10)*30
608
+
609
+ def chaturthamsha(self):
610
+ """
611
+ same modality, different element
612
+ divide the sign into four: first 4th remains, sanaka
613
+ second 4th goes to next sign of same modality, sananada
614
+ third 4th goes to opposite sign of same modality, sanatkumāra
615
+ fourth 4th goes to third sign of same modality, sanātana
616
+
617
+ this 1) returns the longitude of the planet in the hora
618
+ 2) sets self._deity to the hora lord
619
+ """
620
+ # just to make sure we are working with the rashi longitude
621
+ real_sign = 1 + self.ecliptic_sign_index() # + 1 to transform index into sign
622
+ real_in_sign = self.real_in_sign_longitude()
623
+
624
+ # take care of it being aditya here, by subtracting self.aditya_offset; 30 if using Circle.ADITYA: 0 if using Circle.ZODIAC
625
+ base_longitude = ((30*(real_sign-1))-self.aditya_offset)%360
626
+ square_longitude = (base_longitude+90)%360
627
+ square_square_longitude = (base_longitude+180)%360
628
+ square_square_square_longitude = (base_longitude+270)%360
629
+
630
+ fourth = 30/4
631
+
632
+ if real_in_sign < fourth:
633
+ self._deity = "Sanaka"
634
+ return base_longitude + (real_in_sign/fourth)*30
635
+ if real_in_sign >= fourth and real_in_sign < 2*fourth:
636
+ self._deity = "Sananda"
637
+ return square_longitude + ((real_in_sign-fourth)/fourth)*30
638
+ if real_in_sign >= 2*fourth and real_in_sign < 3*fourth:
639
+ self._deity = "Sanatkumāra"
640
+ return square_square_longitude + ((real_in_sign-2*fourth)/fourth)*30
641
+ if real_in_sign >= 3*fourth and real_in_sign < 4*fourth:
642
+ self._deity = "Sanātana"
643
+ return square_square_square_longitude + ((real_in_sign-3*fourth)/fourth)*30
644
+
645
+
646
+ def dashamsha(self, even_reversed=False):
647
+ """
648
+ -10
649
+ odd signs start with themselves
650
+ even signs start with the ninth from themselves
651
+
652
+ for -100
653
+ even signs start with the ninth from themselves but go in reverse
654
+
655
+ odd signs ruled over by the 10 deities in order
656
+ even signs ruled over by the 10 deities in reverse order
657
+ """
658
+ # just to make sure we are working with the rashi longitude
659
+ real_sign = 1 + self.ecliptic_sign_index() # + 1 to transform index into sign
660
+ real_in_sign = self.real_in_sign_longitude()
661
+
662
+ base_longitude_odd = ((30*(real_sign-1))-self.aditya_offset)%360
663
+ # even starts with the 9th sign
664
+ # since we start counting at the sign itself in astrology, that means we have to add 8 to get to the 9th sign
665
+ even_start = ((real_sign-1)+8)%12
666
+ base_longitude_even = ((30*even_start)-self.aditya_offset)%360
667
+
668
+ amsha = 30/10
669
+ position = real_in_sign/amsha
670
+ amsha_elapsed = int(position)
671
+ current_in_amsha = position%1
672
+
673
+ if utils.even(real_sign):
674
+ self._deity = list(const.varga_deities[10].__reversed__())[amsha_elapsed%12]
675
+ if utils.odd(real_sign):
676
+ self._deity = const.varga_deities[10][amsha_elapsed%12]
677
+
678
+ sign = 1
679
+ if utils.odd(real_sign):
680
+ base_longitude = base_longitude_odd
681
+ if utils.even(real_sign):
682
+ base_longitude = base_longitude_even
683
+ if even_reversed:
684
+ sign = -1
685
+
686
+ return base_longitude+(sign*amsha_elapsed*30)+(current_in_amsha)*30
687
+
688
+ def dvadashamsha(self):
689
+ """
690
+ -12
691
+ for this varga, each sign is divided up into 12 parts, with the first part corresponding to itself
692
+
693
+ so gemini is divided into 12, labelled: "gemini", "cancer", "leo", etc.
694
+ """
695
+ # just to make sure we are working with the rashi longitude
696
+ real_sign = 1 + self.ecliptic_sign_index() # + 1 to transform index into sign
697
+ real_in_sign = self.real_in_sign_longitude()
698
+
699
+ base_longitude = ((30*(real_sign-1))-self.aditya_offset)%360
700
+
701
+ amsha=30/12 # length of one portion in this sign
702
+ position = real_in_sign/amsha
703
+ amsha_elapsed = int(position)
704
+ current_in_amsha = position%1
705
+
706
+ self._deity = const.varga_deities[12][amsha_elapsed%4]
707
+
708
+ return base_longitude+(amsha_elapsed*30)+(current_in_amsha)*30
709
+
710
+ def shodashamsha(self):
711
+ """
712
+ -16
713
+ for moveable, start from Aries
714
+ for fixed, start from Leo
715
+ for dual, start from Sagittarius
716
+ then the 16 amshas in the normal order from the starting point
717
+ """
718
+ # just to make sure we are working with the rashi longitude
719
+ real_sign = 1 + self.ecliptic_sign_index() # + 1 to transform index into sign
720
+ real_in_sign = self.real_in_sign_longitude()
721
+
722
+ base_sign_moveable = 1
723
+ base_longitude_moveable = ((30*(base_sign_moveable-1))-self.aditya_offset)%360
724
+ base_sign_fixed = 5
725
+ base_longitude_fixed = ((30*(base_sign_fixed-1))-self.aditya_offset)%360
726
+ base_sign_dual = 9
727
+ base_longitude_dual = ((30*(base_sign_dual-1))-self.aditya_offset)%360
728
+
729
+ amsha=30/16 # length of one portion in this sign
730
+ position = real_in_sign/amsha
731
+ amsha_elapsed = int(position)
732
+ current_in_amsha = position%1
733
+
734
+ if real_sign in [1,4,7,10]:
735
+ base_longitude = base_longitude_moveable
736
+ if real_sign in [2,5,8,11]:
737
+ base_longitude = base_longitude_fixed
738
+ if real_sign in [3,6,9,12]:
739
+ base_longitude = base_longitude_dual
740
+
741
+ if utils.odd(real_sign):
742
+ self._deity = const.varga_deities[16][amsha_elapsed%4]
743
+ else:
744
+ self._deity = list(const.varga_deities[16].__reversed__())[amsha_elapsed%4]
745
+
746
+ return base_longitude+(amsha_elapsed*30)+(current_in_amsha)*30
747
+
748
+ def vimshamsha(self):
749
+ """
750
+ -20
751
+ divide each sign into 20 portions, starting with the first as follows:
752
+ for moveable signs: start from Aries
753
+ for fixed signs: start from Sagittarius
754
+ for dual signs: starts from Leo
755
+ """
756
+ # just to make sure we are working with the rashi longitude
757
+ real_sign = 1 + self.ecliptic_sign_index() # + 1 to transform index into sign
758
+ real_in_sign = self.real_in_sign_longitude()
759
+
760
+ base_sign_moveable = 1
761
+ base_longitude_moveable = ((30*(base_sign_moveable-1))-self.aditya_offset)%360
762
+ base_sign_fixed = 9
763
+ base_longitude_fixed = ((30*(base_sign_fixed-1))-self.aditya_offset)%360
764
+ base_sign_dual = 5
765
+ base_longitude_dual = ((30*(base_sign_dual-1))-self.aditya_offset)%360
766
+
767
+ amsha=30/20 # length of one portion in this sign
768
+ position = real_in_sign/amsha
769
+ amsha_elapsed = int(position)
770
+ current_in_amsha = position%1
771
+
772
+ if real_sign in [1,4,7,10]:
773
+ base_longitude = base_longitude_moveable
774
+ if real_sign in [2,5,8,11]:
775
+ # real_sign is fixed, so start with sagittarius
776
+ base_longitude = base_longitude_fixed
777
+ if real_sign in [3,6,9,12]:
778
+ base_longitude = base_longitude_dual
779
+
780
+ if utils.odd(real_sign):
781
+ self._deity = const.varga_deities[21][amsha_elapsed]
782
+ else:
783
+ self._deity = const.varga_deities[20][amsha_elapsed]
784
+
785
+ return base_longitude+(amsha_elapsed*30)+(current_in_amsha)*30
786
+
787
+ def siddhamsha(self, parashara=False):
788
+ """
789
+ -240 is the code for this varga
790
+ a varga of 24 divisions
791
+ odd signs: start at leo and go around the circle in order twice
792
+ even: start at cancer and go twice around the circle in reverse order
793
+ if parashara = True, go forward for reverse also
794
+ """
795
+ # just to make sure we are working with the rashi longitude
796
+ real_sign = 1 + self.ecliptic_sign_index() # + 1 to transform index into sign
797
+ real_in_sign = self.real_in_sign_longitude()
798
+
799
+ # the base longitude for odd signs is leo/indra, sign 5
800
+ base_sign_odd = 5
801
+ base_longitude_odd = ((30*(base_sign_odd-1))-self.aditya_offset)%360
802
+ base_sign_even = 4
803
+ base_longitude_even = ((30*(base_sign_even-1))-self.aditya_offset)%360
804
+
805
+ amsha=30/24 # length of one portion in this sign
806
+ position = real_in_sign/amsha
807
+ amsha_elapsed = int(position)
808
+ current_in_amsha = position%1
809
+
810
+ if utils.odd(real_sign):
811
+ self._deity = const.varga_deities[24][amsha_elapsed%12]
812
+ if utils.even(real_sign):
813
+ self._deity = list(const.varga_deities[24].__reversed__())[amsha_elapsed%12]
814
+
815
+ sign = 1
816
+ if utils.odd(real_sign):
817
+ base_longitude = base_longitude_odd
818
+ return base_longitude+(amsha_elapsed*30)+(current_in_amsha)*30
819
+ if utils.even(real_sign):
820
+ base_longitude = base_longitude_even
821
+ if not parashara:
822
+ sign = -1
823
+ return base_longitude+(sign*amsha_elapsed*30)+(current_in_amsha)*30
824
+
825
+ def bhamsha(self):
826
+ """
827
+ -27
828
+ divide each sign into 27 equal parts
829
+ the first amsha of a sign is a moveable sign; the moveable signs go into order for starting
830
+ i.e., Aries starts with Aries, Taurus starts with Cancer, Gemini starts with Libra, Cancer starts with Capricorn
831
+ Leo starts with Aries, Virgo starts with Cancer, etc.
832
+ i.e., fire signs start at Aries
833
+ earth signs start at Cancer
834
+ air signs start at Libra
835
+ water signs start at Capricorn
836
+ deities are nakshatra deities
837
+ normal order for odd signs
838
+ reverse for even signs
839
+ """
840
+ # just to make sure we are working with the rashi longitude
841
+ real_sign = 1 + self.ecliptic_sign_index() # + 1 to transform index into sign
842
+ real_in_sign = self.real_in_sign_longitude()
843
+
844
+ base_sign_fire = 1
845
+ base_longitude_fire = ((30*(base_sign_fire-1))-self.aditya_offset)%360
846
+ base_sign_earth = 4
847
+ base_longitude_earth = ((30*(base_sign_earth-1))-self.aditya_offset)%360
848
+ base_sign_air = 7
849
+ base_longitude_air = ((30*(base_sign_air-1))-self.aditya_offset)%360
850
+ base_sign_water = 10
851
+ base_longitude_water = ((30*(base_sign_water-1))-self.aditya_offset)%360
852
+
853
+ amsha=30/27 # length of one portion in this sign
854
+ position = real_in_sign/amsha
855
+ amsha_elapsed = int(position)
856
+ current_in_amsha = position%1
857
+
858
+ match real_sign:
859
+ case 1 | 5 | 9:
860
+ # fire sign
861
+ base_longitude = base_longitude_fire
862
+ case 2 | 6 | 10:
863
+ # earth sign
864
+ base_longitude = base_longitude_earth
865
+ case 3 | 7 | 11:
866
+ # air sign
867
+ base_longitude = base_longitude_air
868
+ case 4 | 8 | 12:
869
+ # water sign
870
+ base_longitude = base_longitude_water
871
+
872
+ if utils.odd(real_sign):
873
+ self._deity = const.varga_deities[27][amsha_elapsed]
874
+ if utils.even(real_sign):
875
+ self._deity = list(const.varga_deities[27].__reversed__())[amsha_elapsed]
876
+
877
+ return base_longitude+(amsha_elapsed*30)+(current_in_amsha)*30
878
+
879
+
880
+ def khavedamsha(self):
881
+ """
882
+ -40
883
+ divide each sign into 40 equal sections
884
+ odd signs start at Aries
885
+ even signs start at Libra
886
+
887
+ deities go in same order for all signs
888
+ """
889
+ # just to make sure we are working with the rashi longitude
890
+ real_sign = 1 + self.ecliptic_sign_index() # + 1 to transform index into sign
891
+ real_in_sign = self.real_in_sign_longitude()
892
+
893
+ base_sign_odd = 1
894
+ base_longitude_odd = ((30*(base_sign_odd-1))-self.aditya_offset)%360
895
+ base_sign_even = 7
896
+ base_longitude_even = ((30*(base_sign_even-1))-self.aditya_offset)%360
897
+
898
+ amsha=30/40 # length of one portion in this sign
899
+ position = real_in_sign/amsha
900
+ amsha_elapsed = int(position)
901
+ current_in_amsha = position%1
902
+
903
+ if utils.odd(real_sign):
904
+ base_longitude = base_longitude_odd
905
+ if utils.even(real_sign):
906
+ base_longitude = base_longitude_even
907
+
908
+ self._deity = const.varga_deities[40][amsha_elapsed%12]
909
+
910
+ return base_longitude+(amsha_elapsed*30)+(current_in_amsha)*30
911
+
912
+ def akshavedamsha(self):
913
+ """
914
+ -45
915
+ divide each sign into 45 portions
916
+ moveable signs start with Aries
917
+ fixed signs start with Leo
918
+ dual signs start with Sagittarius
919
+ Brahma, Shiva, Vishnu rules the portions
920
+ moveable: brahma, shiva, vishnu
921
+ fixed: shiva, vishnu, brahma
922
+ dual: vishnu, brahma, shiva
923
+ """
924
+ # just to make sure we are working with the rashi longitude
925
+ real_sign = 1 + self.ecliptic_sign_index() # + 1 to transform index into sign
926
+ real_in_sign = self.real_in_sign_longitude()
927
+
928
+ base_sign_moveable = 1
929
+ base_longitude_moveable = ((30*(base_sign_moveable-1))-self.aditya_offset)%360
930
+ # index is for setting the deity
931
+ index = 45
932
+ base_sign_fixed = 5
933
+ base_longitude_fixed = ((30*(base_sign_fixed-1))-self.aditya_offset)%360
934
+ index = 46
935
+ base_sign_dual = 9
936
+ base_longitude_dual = ((30*(base_sign_dual-1))-self.aditya_offset)%360
937
+ index = 47
938
+
939
+ amsha=30/45 # length of one portion in this sign
940
+ position = real_in_sign/amsha
941
+ amsha_elapsed = int(position)
942
+ current_in_amsha = position%1
943
+
944
+ if real_sign in [1,4,7,10]:
945
+ # modality of real_sign and base_longitude are the same here
946
+ base_longitude = base_longitude_moveable
947
+ if real_sign in [2,5,8,11]:
948
+ # real_sign is fixed, so start with sagittarius
949
+ base_longitude = base_longitude_fixed
950
+ if real_sign in [3,6,9,12]:
951
+ base_longitude = base_longitude_dual
952
+
953
+ self._deity = const.varga_deities[index][amsha_elapsed%3]
954
+
955
+ return base_longitude+(amsha_elapsed*30)+(current_in_amsha)*30
956
+
957
+ def shashtyamsha(self):
958
+ """
959
+ -60
960
+ algorithm as described in santhanam's translation of bphs, vol. 1, page 83
961
+ deities are in order for odd signs, reverse for even signs
962
+ """
963
+ real_longitude = Longitude(self.ecliptic_longitude(), 1, self.context)
964
+ real_sign = real_longitude.sign()
965
+ real_in_sign = self.real_in_sign_longitude()
966
+ calc = int(real_in_sign*2)
967
+ _, remainder = divmod(calc,12)
968
+ # this is how many signs from real_sign the d60 sign is
969
+ from_amsha = remainder+1
970
+ sign = real_longitude.astrological_signs_foward(from_amsha)
971
+
972
+ base_longitude = ((30*(sign-1))-self.aditya_offset)%360
973
+
974
+ amsha=30/60 # length of one portion in this sign
975
+ position = real_in_sign/amsha
976
+ amsha_elapsed = int(position)
977
+ current_in_amsha = position%1
978
+
979
+ if utils.odd(real_sign):
980
+ self._deity = const.varga_deities[60][amsha_elapsed]
981
+ if utils.even(real_sign):
982
+ self._deity = list(const.varga_deities[60].__reversed__())[amsha_elapsed]
983
+
984
+ return base_longitude+(current_in_amsha*30)
985
+
986
+ def __repr__(self):
987
+ return f"({self.ecliptic_longitude()},{self.amsha_longitude()},{self.amsha()})"