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.
- libaditya/__init__.py +46 -0
- libaditya/_version.py +29 -0
- libaditya/calc/__init__.py +9 -0
- libaditya/calc/api.py +30 -0
- libaditya/calc/avasthas.py +346 -0
- libaditya/calc/docs/jaimini-get-arch.md +95 -0
- libaditya/calc/hellenistic.py +37 -0
- libaditya/calc/jaimini.py +335 -0
- libaditya/calc/jaimini_get.py +240 -0
- libaditya/calc/kala.py +73 -0
- libaditya/calc/panchanga.py +422 -0
- libaditya/calc/rashi.py +612 -0
- libaditya/calc/returns.py +50 -0
- libaditya/calc/swe_functions.py +118 -0
- libaditya/calc/varga.py +287 -0
- libaditya/calc/vimshottari.py +431 -0
- libaditya/cards/__init__.py +5 -0
- libaditya/cards/card.py +90 -0
- libaditya/cards/cards_constants.py +115 -0
- libaditya/cards/cards_of_truth.py +323 -0
- libaditya/cards/cot.py +142 -0
- libaditya/cards/deck.py +52 -0
- libaditya/charts/__init__.py +6 -0
- libaditya/charts/api.py +36 -0
- libaditya/charts/bodygraph.py +80 -0
- libaditya/charts/chart.py +286 -0
- libaditya/charts/jaimini.py +83 -0
- libaditya/charts/tajika.py +36 -0
- libaditya/constants.py +1776 -0
- libaditya/draw/__init__.py +20 -0
- libaditya/draw/draw_bodygraph.py +489 -0
- libaditya/draw/draw_sbc.py +712 -0
- libaditya/draw/themes/default-theme.hd +53 -0
- libaditya/ephe/ast0/se00010s.se1 +0 -0
- libaditya/ephe/seas_00.se1 +0 -0
- libaditya/ephe/seas_06.se1 +0 -0
- libaditya/ephe/seas_12.se1 +0 -0
- libaditya/ephe/seas_18.se1 +0 -0
- libaditya/ephe/seas_24.se1 +0 -0
- libaditya/ephe/seas_30.se1 +0 -0
- libaditya/ephe/seas_36.se1 +0 -0
- libaditya/ephe/seas_42.se1 +0 -0
- libaditya/ephe/seas_48.se1 +0 -0
- libaditya/ephe/seasm06.se1 +0 -0
- libaditya/ephe/seasm12.se1 +0 -0
- libaditya/ephe/seasm18.se1 +0 -0
- libaditya/ephe/seasm24.se1 +0 -0
- libaditya/ephe/seasm30.se1 +0 -0
- libaditya/ephe/seasm36.se1 +0 -0
- libaditya/ephe/seasm42.se1 +0 -0
- libaditya/ephe/seasm48.se1 +0 -0
- libaditya/ephe/seasm54.se1 +0 -0
- libaditya/ephe/sefstars.txt +4245 -0
- libaditya/ephe/semo_00.se1 +0 -0
- libaditya/ephe/semo_06.se1 +0 -0
- libaditya/ephe/semo_12.se1 +0 -0
- libaditya/ephe/semo_18.se1 +0 -0
- libaditya/ephe/semo_24.se1 +0 -0
- libaditya/ephe/semo_30.se1 +0 -0
- libaditya/ephe/semo_36.se1 +0 -0
- libaditya/ephe/semo_42.se1 +0 -0
- libaditya/ephe/semo_48.se1 +0 -0
- libaditya/ephe/semom06.se1 +0 -0
- libaditya/ephe/semom12.se1 +0 -0
- libaditya/ephe/semom18.se1 +0 -0
- libaditya/ephe/semom24.se1 +0 -0
- libaditya/ephe/semom30.se1 +0 -0
- libaditya/ephe/semom36.se1 +0 -0
- libaditya/ephe/semom42.se1 +0 -0
- libaditya/ephe/semom48.se1 +0 -0
- libaditya/ephe/semom54.se1 +0 -0
- libaditya/ephe/sepl_00.se1 +0 -0
- libaditya/ephe/sepl_06.se1 +0 -0
- libaditya/ephe/sepl_12.se1 +0 -0
- libaditya/ephe/sepl_18.se1 +0 -0
- libaditya/ephe/sepl_24.se1 +0 -0
- libaditya/ephe/sepl_30.se1 +0 -0
- libaditya/ephe/sepl_36.se1 +0 -0
- libaditya/ephe/sepl_42.se1 +0 -0
- libaditya/ephe/sepl_48.se1 +0 -0
- libaditya/ephe/seplm06.se1 +0 -0
- libaditya/ephe/seplm12.se1 +0 -0
- libaditya/ephe/seplm18.se1 +0 -0
- libaditya/ephe/seplm24.se1 +0 -0
- libaditya/ephe/seplm30.se1 +0 -0
- libaditya/ephe/seplm36.se1 +0 -0
- libaditya/ephe/seplm42.se1 +0 -0
- libaditya/ephe/seplm48.se1 +0 -0
- libaditya/ephe/seplm54.se1 +0 -0
- libaditya/hd/__init__.py +8 -0
- libaditya/hd/calc.py +55 -0
- libaditya/hd/constants.py +127 -0
- libaditya/hd/longitude.py +271 -0
- libaditya/objects/__init__.py +19 -0
- libaditya/objects/celestial_object.py +206 -0
- libaditya/objects/context.py +133 -0
- libaditya/objects/cusps.py +259 -0
- libaditya/objects/julian_day.py +265 -0
- libaditya/objects/location.py +167 -0
- libaditya/objects/longitude.py +987 -0
- libaditya/objects/nakshatras.py +285 -0
- libaditya/objects/planets.py +2059 -0
- libaditya/objects/shadbala.py +398 -0
- libaditya/objects/signs.py +690 -0
- libaditya/objects/swe_functions.py +75 -0
- libaditya/print_functions.py +548 -0
- libaditya/read.py +665 -0
- libaditya/stars/__init__.py +4 -0
- libaditya/stars/fixed_star.py +216 -0
- libaditya/stars/make_swe_stars.py +407 -0
- libaditya/stars/star-sign-boundaries +44 -0
- libaditya/stars/stellarium/__init__.py +6 -0
- libaditya/stars/stellarium/remote_control/__init__.py +22 -0
- libaditya/stars/stellarium/remote_control/location.py +82 -0
- libaditya/stars/stellarium/remote_control/locationsearch.py +35 -0
- libaditya/stars/stellarium/remote_control/main.py +165 -0
- libaditya/stars/stellarium/remote_control/objects.py +63 -0
- libaditya/stars/stellarium/remote_control/scripts.py +81 -0
- libaditya/stars/stellarium/remote_control/simbad.py +20 -0
- libaditya/stars/stellarium/remote_control/stelaction.py +31 -0
- libaditya/stars/stellarium/remote_control/stelproperty.py +30 -0
- libaditya/stars/stellarium/remote_control/view.py +85 -0
- libaditya/stars/stellarium/stellarium.py +92 -0
- libaditya/stars/the_stars.py +522 -0
- libaditya/stars/utilities.py +539 -0
- libaditya/utils.py +431 -0
- libaditya/write.py +67 -0
- libaditya-0.3.4.dist-info/METADATA +588 -0
- libaditya-0.3.4.dist-info/RECORD +131 -0
- libaditya-0.3.4.dist-info/WHEEL +5 -0
- libaditya-0.3.4.dist-info/licenses/LICENSE +661 -0
|
@@ -0,0 +1,422 @@
|
|
|
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 datetime import date
|
|
20
|
+
from dataclasses import replace
|
|
21
|
+
from typing import Self
|
|
22
|
+
|
|
23
|
+
from libaditya import constants as const
|
|
24
|
+
from libaditya import utils
|
|
25
|
+
from libaditya import print_functions as printf
|
|
26
|
+
|
|
27
|
+
from libaditya.objects import Sun, Moon, EphContext, JulianDay
|
|
28
|
+
|
|
29
|
+
class Panchanga:
|
|
30
|
+
"""
|
|
31
|
+
an independent object that is a function of EphContext
|
|
32
|
+
does everything related to panchanga
|
|
33
|
+
|
|
34
|
+
repr(Panchanga()) gives the concise information on the specific Panchanga
|
|
35
|
+
|
|
36
|
+
print(Panchanga()) gives all the information that is given in a row that might be printed in libaditya/monthly_panchanga.py
|
|
37
|
+
it actually prints to stdout rather than return a string...i should maybe change that to produce a string...
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
def __init__(self, context=EphContext()):
|
|
41
|
+
self.context = context
|
|
42
|
+
self.location = self.context.location
|
|
43
|
+
self.timeJD = self.context.timeJD
|
|
44
|
+
self._sun = Sun(self.context)
|
|
45
|
+
self._moon = Moon(self.context)
|
|
46
|
+
self._tithi_number, self._tithi_elapsed, self._tithi_remaining = self.init_tithi()
|
|
47
|
+
self._karana_number, self._karana_elapsed, self._karana_remaining = self.init_karana()
|
|
48
|
+
self._karana_index = self.karana_index()
|
|
49
|
+
self._yoga_raw, self._yoga_elapsed, self._yoga_remaining = self.init_yoga()
|
|
50
|
+
|
|
51
|
+
def __str__(self):
|
|
52
|
+
"""
|
|
53
|
+
print everything that is known about this Panchanga()
|
|
54
|
+
this prints directly...should change to return a string
|
|
55
|
+
"""
|
|
56
|
+
panch = "\nPanchanga\n\n"
|
|
57
|
+
panch += f"{const.ayanamsa_name(self.context.ayanamsa)}"
|
|
58
|
+
panch += f"\n{self.context.timeJD}\n"
|
|
59
|
+
|
|
60
|
+
panch += f"\nAbsolute tithi: {self.tithi()}\n"
|
|
61
|
+
if self.tithi() > 15:
|
|
62
|
+
panch += f"Relative tithi: {self.tithi() - 15}\n"
|
|
63
|
+
panch += f"Type: {self.tithi_type()}\n"
|
|
64
|
+
|
|
65
|
+
panch += f"Karana: {self.karana()}\n"
|
|
66
|
+
panch += f"Vara: {self.vara()}\n"
|
|
67
|
+
panch += f"Nakshatra: {self.nakshatra()}\n"
|
|
68
|
+
panch += f"Yoga: {self.yoga()}\n"
|
|
69
|
+
|
|
70
|
+
print(panch)
|
|
71
|
+
|
|
72
|
+
self.print_addendum()
|
|
73
|
+
|
|
74
|
+
return ""
|
|
75
|
+
|
|
76
|
+
def __repr__(self):
|
|
77
|
+
"""
|
|
78
|
+
for the purposes of identification in a repl, or for just the basic panchanga information
|
|
79
|
+
"""
|
|
80
|
+
panch = "\nPanchanga\n"
|
|
81
|
+
panch += f"{const.ayanamsa_name(self.context.ayanamsa)}"
|
|
82
|
+
panch += f"\n{self.context.timeJD}\n"
|
|
83
|
+
|
|
84
|
+
panch += f"\nAbsolute tithi: {self.tithi()}\n"
|
|
85
|
+
if self.tithi() > 15:
|
|
86
|
+
panch += f"Relative tithi: {self.tithi() - 15}\n"
|
|
87
|
+
panch += f"Type: {self.tithi_type()}\n"
|
|
88
|
+
|
|
89
|
+
panch += f"Karana: {self.karana()}\n"
|
|
90
|
+
panch += f"Vara: {self.vara()}\n"
|
|
91
|
+
panch += f"Nakshatra: {self.nakshatra()}\n"
|
|
92
|
+
panch += f"Yoga: {self.yoga()}\n"
|
|
93
|
+
|
|
94
|
+
return panch
|
|
95
|
+
|
|
96
|
+
def info_string(self):
|
|
97
|
+
panch = ""
|
|
98
|
+
panch += f"\nAbsolute tithi: {self.tithi()}\n"
|
|
99
|
+
if self.tithi() > 15:
|
|
100
|
+
panch += f"Relative tithi: {self.tithi() - 15}\n"
|
|
101
|
+
panch += f"Type: {self.tithi_type()}\n"
|
|
102
|
+
|
|
103
|
+
panch += f"Karana: {self.karana()}\n"
|
|
104
|
+
panch += f"Vara: {self.vara()}\n"
|
|
105
|
+
panch += f"Nakshatra: {self.nakshatra()}\n"
|
|
106
|
+
panch += f"Yoga: {self.yoga()}\n"
|
|
107
|
+
|
|
108
|
+
return panch
|
|
109
|
+
|
|
110
|
+
def sun(self):
|
|
111
|
+
return self._sun
|
|
112
|
+
|
|
113
|
+
def moon(self):
|
|
114
|
+
return self._moon
|
|
115
|
+
|
|
116
|
+
def sunrise(self):
|
|
117
|
+
"""
|
|
118
|
+
return a JulianDay
|
|
119
|
+
"""
|
|
120
|
+
return self._sun.riseset(swe.CALC_RISE, self.location)
|
|
121
|
+
|
|
122
|
+
def sunset(self):
|
|
123
|
+
return self._sun.riseset(swe.CALC_SET, self.location)
|
|
124
|
+
|
|
125
|
+
def moonrise(self):
|
|
126
|
+
return self._moon.riseset(swe.CALC_RISE, self.location)
|
|
127
|
+
|
|
128
|
+
def moonset(self):
|
|
129
|
+
return self._moon.riseset(swe.CALC_SET, self.location)
|
|
130
|
+
|
|
131
|
+
def init_tithi(self):
|
|
132
|
+
traw = ((self._moon.ecliptic_longitude() - self._sun.ecliptic_longitude()) % 360) / 12
|
|
133
|
+
remainder = traw % 1 # remainder shows how much has elapsed
|
|
134
|
+
elapsed = remainder * 12 # degrees elapsed
|
|
135
|
+
remaining = 12 - elapsed # degrees remaining
|
|
136
|
+
return (int(traw)+1, elapsed, remaining)
|
|
137
|
+
|
|
138
|
+
def tithi(self) -> int:
|
|
139
|
+
"""
|
|
140
|
+
returns number of the tithi
|
|
141
|
+
"""
|
|
142
|
+
return self._tithi_number
|
|
143
|
+
|
|
144
|
+
def tithi_type(self):
|
|
145
|
+
return const.names[self.context.names_type]["tithis"][(self.tithi()-1)%5]
|
|
146
|
+
|
|
147
|
+
def tithi_degrees_elapsed(self):
|
|
148
|
+
return round(self._tithi_elapsed,3)
|
|
149
|
+
|
|
150
|
+
def tithi_degrees_remaining(self):
|
|
151
|
+
return round(self._tithi_remaining,3)
|
|
152
|
+
|
|
153
|
+
def init_karana(self):
|
|
154
|
+
kraw = ((self._moon.ecliptic_longitude() - self._sun.ecliptic_longitude()) % 360) / 6
|
|
155
|
+
remainder = kraw % 1 # remainder shows how much has elapsed
|
|
156
|
+
elapsed = remainder * 6 # degrees elapsed
|
|
157
|
+
remaining = 6 - elapsed # degrees remaining
|
|
158
|
+
return (kraw, elapsed, remaining)
|
|
159
|
+
|
|
160
|
+
def karana_index(self):
|
|
161
|
+
if self._tithi_remaining > 6:
|
|
162
|
+
return (self.tithi()-1,0)
|
|
163
|
+
else:
|
|
164
|
+
return (self.tithi()-1,1)
|
|
165
|
+
|
|
166
|
+
def karana(self):
|
|
167
|
+
return const.names[self.context.names_type]["karanas"][self.karana_index()[0]][self.karana_index()[1]]
|
|
168
|
+
|
|
169
|
+
def karana_number(self):
|
|
170
|
+
return self._karana_number
|
|
171
|
+
|
|
172
|
+
def karana_degrees_elapsed(self):
|
|
173
|
+
return round(self._karana_elapsed,3)
|
|
174
|
+
|
|
175
|
+
def karana_degrees_remaining(self):
|
|
176
|
+
return round(self._karana_remaining,3)
|
|
177
|
+
|
|
178
|
+
def vara(self):
|
|
179
|
+
weekday = date(
|
|
180
|
+
self.timeJD.datetime[0],
|
|
181
|
+
self.timeJD.datetime[1],
|
|
182
|
+
self.timeJD.datetime[2],
|
|
183
|
+
).isoweekday() # 1 is Monday
|
|
184
|
+
# there is this nice function in swe actually...
|
|
185
|
+
# but for it Monday = 0 and Sunday = 6
|
|
186
|
+
#weekday = swe.day_of_week(self.context.timeJD.jd_number())
|
|
187
|
+
sunriseyk = self._sun.sunrise_yamakoti()
|
|
188
|
+
if sunriseyk < self.context.timeJD:
|
|
189
|
+
return const.names[self.context.names_type]["varas"][(weekday + 1) % 7]
|
|
190
|
+
else:
|
|
191
|
+
return const.names[self.context.names_type]["varas"][weekday % 7]
|
|
192
|
+
|
|
193
|
+
def nakshatra(self):
|
|
194
|
+
return self._moon.nakshatra_name()
|
|
195
|
+
|
|
196
|
+
def init_yoga(self):
|
|
197
|
+
"""
|
|
198
|
+
sun and moon longitude should be taken from the beginning of the first yoga, which
|
|
199
|
+
is equivalent to the beginning of ashvini, thus we need to add (or subtract) the ayanamsa value
|
|
200
|
+
to the longitudes
|
|
201
|
+
"""
|
|
202
|
+
yraw = ((self._moon.nakshatra().ashvini_longitude() + self._sun.nakshatra().ashvini_longitude()) % 360) / (13 + (20 / 60))
|
|
203
|
+
remainder = yraw % 1 # remainder shows how much has elapsed
|
|
204
|
+
elapsed = remainder * (13+(1/3)) # degrees elapsed
|
|
205
|
+
remaining = (13+(1/3)) - elapsed # degrees remaining
|
|
206
|
+
return (yraw, elapsed, remaining)
|
|
207
|
+
|
|
208
|
+
def yoga_index(self):
|
|
209
|
+
return int(self._yoga_raw)
|
|
210
|
+
|
|
211
|
+
def yoga_number(self):
|
|
212
|
+
return self.yoga_index()+1
|
|
213
|
+
|
|
214
|
+
def yoga_name(self):
|
|
215
|
+
return const.names[self.context.names_type]["yogas"][self.yoga_index()]
|
|
216
|
+
|
|
217
|
+
def yoga(self):
|
|
218
|
+
return f"{self.yoga_number()} {self.yoga_name()}"
|
|
219
|
+
|
|
220
|
+
def yoga_degrees_elapsed(self):
|
|
221
|
+
return round(self._yoga_elapsed,3)
|
|
222
|
+
|
|
223
|
+
def yoga_degrees_remaining(self):
|
|
224
|
+
return round(self._yoga_remaining,3)
|
|
225
|
+
|
|
226
|
+
def next_tithi(self) -> Self:
|
|
227
|
+
if self.tithi_degrees_remaining() == 0:
|
|
228
|
+
return Panchanga(replace(self.context,timeJD=self.timeJD.shift("f","seconds",5)))
|
|
229
|
+
shift_factor = self.tithi_degrees_remaining()*self._moon.lowest_hourly_speed()
|
|
230
|
+
return Panchanga(replace(self.context,timeJD=self.timeJD.shift("f","hours",shift_factor))).next_tithi()
|
|
231
|
+
|
|
232
|
+
def next_karana(self) -> Self:
|
|
233
|
+
if self.karana_degrees_remaining() == 0:
|
|
234
|
+
return Panchanga(replace(self.context,timeJD=self.timeJD.shift("f","seconds",5)))
|
|
235
|
+
shift_factor = self.karana_degrees_remaining()*self._moon.lowest_hourly_speed()
|
|
236
|
+
return Panchanga(replace(self.context,timeJD=self.timeJD.shift("f","hours",shift_factor))).next_karana()
|
|
237
|
+
|
|
238
|
+
# doesnt work
|
|
239
|
+
def next_vara(self) -> Self:
|
|
240
|
+
# find sunrise at yamakoti on this day
|
|
241
|
+
today_yamakotiJD = self._sun.sunrise_yamakoti()
|
|
242
|
+
# if the current time is before sunrise at yamakoti, todayJD is the next varas
|
|
243
|
+
if self.timeJD.jd_number() < today_yamakotiJD.jd_number():
|
|
244
|
+
return Panchanga(replace(self.context,timeJD=today_yamakotiJD.shift("f","minutes",5)))
|
|
245
|
+
# if the current time is after sunrise at yamaktoi, go ahead one today
|
|
246
|
+
next_yamakotiJD = Sun(replace(self.context,timeJD=self.timeJD.shift("f","day",1))).sunrise_yamakoti()
|
|
247
|
+
return Panchanga(replace(self.context,timeJD=next_yamakotiJD.timeJD.shift("f","minutes",5))).next_vara()
|
|
248
|
+
|
|
249
|
+
def next_nakshatra(self):
|
|
250
|
+
if self._moon.nakshatra().degrees_remaining() <= .00001:
|
|
251
|
+
return Panchanga(replace(self.context,timeJD=self.timeJD.shift("f","minute",1)))
|
|
252
|
+
shift_factor = self._moon.nakshatra().degrees_remaining()*self._moon.lowest_hourly_speed()
|
|
253
|
+
return Panchanga(replace(self.context,timeJD=self.timeJD.shift("f","hours",shift_factor))).next_nakshatra()
|
|
254
|
+
|
|
255
|
+
def next_yoga(self):
|
|
256
|
+
if self.yoga_degrees_remaining() == 0:
|
|
257
|
+
return Panchanga(replace(self.context,timeJD=self.timeJD.shift("f","seconds",5)))
|
|
258
|
+
shift_factor = self.yoga_degrees_remaining()*self._moon.lowest_hourly_speed()
|
|
259
|
+
return Panchanga(replace(self.context,timeJD=self.timeJD.shift("f","hours",shift_factor))).next_yoga()
|
|
260
|
+
|
|
261
|
+
def shift(self,dir,tunit,shift_factor):
|
|
262
|
+
return Panchanga(replace(self.context,timeJD=self.timeJD.shift(dir,tunit,shift_factor)))
|
|
263
|
+
|
|
264
|
+
def print_next_new_moon(self):
|
|
265
|
+
"""
|
|
266
|
+
an actual print() function
|
|
267
|
+
|
|
268
|
+
also prints previous last visibility and next first visibility of the moon around the "next_new_moon"
|
|
269
|
+
"""
|
|
270
|
+
next = self.next_new_moon() # return the Panchanga of the next new moon
|
|
271
|
+
print(f"\n\tLast visibility:")
|
|
272
|
+
next.shift("back","days",10).moon().next_morning_last()[1].indent_print(1)
|
|
273
|
+
print("\nNext new moon at:")
|
|
274
|
+
print(next.timeJD)
|
|
275
|
+
print(f"At: {next._moon.longitude()}")
|
|
276
|
+
print(f"Nakshatra: {next._moon.nakshatra_name()}")
|
|
277
|
+
next.moon().nakshatra().print_in_longitude()
|
|
278
|
+
print(f"\n\tNext visibility:")
|
|
279
|
+
# print the middle JulianDay of the return list, the "optimum" visibility as when you can first see it next
|
|
280
|
+
# JulianDay.indent_print() uses print() itself
|
|
281
|
+
next.moon().next_evening_first()[1].indent_print(1)
|
|
282
|
+
# use this but put it somewhere else as an option
|
|
283
|
+
# print(f"Next last morning visibility:")
|
|
284
|
+
# # Moon/Mercury/Venus.next_morning_last() returns a list of 3 JulianDay classes
|
|
285
|
+
# # earliest, best, latest visibility for that event
|
|
286
|
+
# printf.print_visible_times(next.moon().next_morning_last())
|
|
287
|
+
# print(f"Next evening first visibility:")
|
|
288
|
+
# printf.print_visible_times(next.moon().next_evening_first())
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def print_next_full_moon(self):
|
|
292
|
+
next = self.next_full_moon() # return the Panchanga of the next new moon
|
|
293
|
+
print("\nNext full moon at:")
|
|
294
|
+
print(next.timeJD)
|
|
295
|
+
print(f"At: {next._moon.longitude()}")
|
|
296
|
+
print(f"Nakshatra: {next._moon.nakshatra_name()}")
|
|
297
|
+
next._moon.nakshatra().print_in_longitude()
|
|
298
|
+
|
|
299
|
+
def next_new_moon(self):
|
|
300
|
+
"""
|
|
301
|
+
return the Panchanga of the new moon that comes after
|
|
302
|
+
self.timeJD
|
|
303
|
+
"""
|
|
304
|
+
if (self.tithi() != 30):
|
|
305
|
+
# if the tithi isnt 30, it cant be a new moon, so go forward 8 hours
|
|
306
|
+
return Panchanga(replace(self.context,timeJD=self.timeJD.shift("f","hour", 8))).next_new_moon()
|
|
307
|
+
if (self._sun.ecliptic_longitude() - self._moon.ecliptic_longitude()) <= 0.001:
|
|
308
|
+
return Panchanga(replace(self.context,timeJD=self.timeJD.shift("f","second",10)))
|
|
309
|
+
remaining = self.tithi_degrees_remaining()
|
|
310
|
+
shift_factor = remaining*self._moon.lowest_hourly_speed()
|
|
311
|
+
return Panchanga(replace(self.context,timeJD=self.timeJD.shift("f","hours",shift_factor))).next_new_moon()
|
|
312
|
+
|
|
313
|
+
def next_full_moon(self) -> Self:
|
|
314
|
+
"""
|
|
315
|
+
return the Panchanga of the full moon that comes after
|
|
316
|
+
self.timeJD
|
|
317
|
+
"""
|
|
318
|
+
if (self.tithi() != 15):
|
|
319
|
+
# if the tithi isnt 15, it cant be a full moon, so go forward 8 hours
|
|
320
|
+
return Panchanga(replace(self.context,timeJD=self.timeJD.shift("f","hour", 8))).next_full_moon()
|
|
321
|
+
target = (self._sun.ecliptic_longitude() + 180) % 360
|
|
322
|
+
diff = abs(self._moon.ecliptic_longitude() - target)
|
|
323
|
+
if diff <= 0.0001:
|
|
324
|
+
return Panchanga(replace(self.context,timeJD=self.timeJD.shift("f","second",10)))
|
|
325
|
+
shift_factor = diff*self._moon.lowest_hourly_speed()
|
|
326
|
+
return Panchanga(replace(self.context,timeJD=self.timeJD.shift("f","hours",shift_factor))).next_full_moon()
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
def print_addendum(self):
|
|
330
|
+
print("\nPanchanga addendum")
|
|
331
|
+
|
|
332
|
+
dmsun = self._sun.daily_motion()
|
|
333
|
+
dmmoon = self._moon.daily_motion()
|
|
334
|
+
|
|
335
|
+
print(
|
|
336
|
+
f"\nSunrise {self.timeJD.date()} at {self.location.place()}:\n{self._sun.riseset(swe.CALC_RISE, self.location)}\n"
|
|
337
|
+
)
|
|
338
|
+
print(
|
|
339
|
+
f"Sunset {self.timeJD.date()} at {self.location.place()}:\n{self._sun.riseset(swe.CALC_SET, self.location)}\n"
|
|
340
|
+
)
|
|
341
|
+
|
|
342
|
+
# give moonrise for three days, the one before, this one, and the one after
|
|
343
|
+
# yesterpanch = Panchanga(panch.shift("b", "day", 1))
|
|
344
|
+
# morrowpanch = Panchanga(panch.shift("f", "day", 1))
|
|
345
|
+
print(
|
|
346
|
+
f"Moonrise {self.timeJD.date()} at {self.location.place()}: \n{self._moon.riseset(swe.CALC_RISE, self.location)}"
|
|
347
|
+
)
|
|
348
|
+
print(
|
|
349
|
+
f"\nMoonset {self.timeJD.date()} at {self.location.place()}: \n{self._moon.riseset(swe.CALC_SET, self.location)}"
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
print(f"\nTithi: {self.tithi()}")
|
|
353
|
+
print("Elapsed: ", self.tithi_degrees_elapsed(), " degrees (", round((self.tithi_degrees_elapsed() / 12) * 100, 3), "%)")
|
|
354
|
+
print(
|
|
355
|
+
"Remaining: ", self.tithi_degrees_remaining(), " degree (", round((self.tithi_degrees_remaining() / 12) * 100, 3), "%)"
|
|
356
|
+
)
|
|
357
|
+
|
|
358
|
+
next_tithi = self.next_tithi()
|
|
359
|
+
|
|
360
|
+
hours_left = abs(self.timeJD.jd_number() - next_tithi.timeJD.jd_number())*24
|
|
361
|
+
|
|
362
|
+
print(f"Ending time of current tithi: {round(hours_left, 2)} hours from panchanga time")
|
|
363
|
+
print(f"Next tithi is {next_tithi.tithi()} ({next_tithi.tithi_type()}), starting at:")
|
|
364
|
+
print(f"{next_tithi.timeJD}")
|
|
365
|
+
|
|
366
|
+
# karana
|
|
367
|
+
kelapsed = round(self.karana_degrees_elapsed(), 3)
|
|
368
|
+
kremaining = round(self.karana_degrees_remaining(), 3)
|
|
369
|
+
|
|
370
|
+
print(f"\nKarana: {self.karana()}")
|
|
371
|
+
print("Elapsed: ", kelapsed, " degrees (", round((kelapsed / 6) * 100, 2), "%)")
|
|
372
|
+
print(
|
|
373
|
+
"Remaining: ", kremaining, " degree (", round((kremaining / 6) * 100, 2), "%)"
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
next_karana = self.next_karana()
|
|
377
|
+
|
|
378
|
+
hours_left = abs(self.timeJD.jd_number() - next_karana.timeJD.jd_number())*24
|
|
379
|
+
|
|
380
|
+
print(f"Ending time of current karana: {round(hours_left, 2)} hours from panchanga time")
|
|
381
|
+
print(f"Next karana is {next_karana.karana()}, starting at:")
|
|
382
|
+
print(f"{next_karana.timeJD}\n")
|
|
383
|
+
|
|
384
|
+
# vara
|
|
385
|
+
|
|
386
|
+
# this doesnt work perfectly - fix it sometime
|
|
387
|
+
|
|
388
|
+
next_vara = self.next_vara()
|
|
389
|
+
|
|
390
|
+
hours_left = abs(self.timeJD.jd_number() - next_vara.timeJD.jd_number())*24
|
|
391
|
+
print(f"Ending time of current vara: {round(hours_left, 2)} hours from panchanga time")
|
|
392
|
+
print(f"Next vara is {next_vara.vara()}, starting at:")
|
|
393
|
+
print(f"{next_vara.timeJD}")
|
|
394
|
+
|
|
395
|
+
# nakshatra
|
|
396
|
+
print(f"\nNakshatra: {self._moon.nakshatra_name()}")
|
|
397
|
+
self._moon.nakshatra().print_in_longitude()
|
|
398
|
+
next_nakshatra = self.next_nakshatra()
|
|
399
|
+
hours_left = (next_nakshatra.timeJD.jd_number() - self.timeJD.jd_number()) * 24
|
|
400
|
+
print(f"Ending time of current nakshatra: {round(hours_left, 2)} hours from panchanga time")
|
|
401
|
+
print(f"Next nakshatra is {next_nakshatra.nakshatra()}, starting at:")
|
|
402
|
+
print(f"{next_nakshatra.timeJD}\n")
|
|
403
|
+
|
|
404
|
+
# yoga
|
|
405
|
+
yelapsed = round(self.yoga_degrees_elapsed(), 2)
|
|
406
|
+
yremaining = round(self.yoga_degrees_remaining(), 2)
|
|
407
|
+
|
|
408
|
+
print(f"\nYoga: {self.yoga()}")
|
|
409
|
+
print("Elapsed: ", yelapsed, " degrees (", round((yelapsed / (13+(1/3))) * 100, 2), "%)")
|
|
410
|
+
print(
|
|
411
|
+
"Remaining: ", yremaining, " degree (", round((yremaining / (13+(1/3))) * 100, 2), "%)"
|
|
412
|
+
)
|
|
413
|
+
|
|
414
|
+
next_yoga = self.next_yoga()
|
|
415
|
+
|
|
416
|
+
hours_left = abs(self.timeJD.jd_number() - next_yoga.timeJD.jd_number())*24
|
|
417
|
+
|
|
418
|
+
print(f"Ending time of current yoga: {round(hours_left, 2)} hours from panchanga time")
|
|
419
|
+
print(f"Next yoga is {next_yoga.yoga()}, starting at:")
|
|
420
|
+
print(f"{next_yoga.timeJD}\n")
|
|
421
|
+
|
|
422
|
+
|