kerykeion 3.1.1__py3-none-any.whl → 5.1.9__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.
Potentially problematic release.
This version of kerykeion might be problematic. Click here for more details.
- kerykeion/__init__.py +58 -141
- kerykeion/aspects/__init__.py +14 -0
- kerykeion/aspects/aspects_factory.py +568 -0
- kerykeion/aspects/aspects_utils.py +164 -0
- kerykeion/astrological_subject_factory.py +1901 -0
- kerykeion/backword.py +820 -0
- kerykeion/chart_data_factory.py +552 -0
- kerykeion/charts/__init__.py +5 -0
- kerykeion/charts/chart_drawer.py +2794 -0
- kerykeion/charts/charts_utils.py +1840 -0
- kerykeion/charts/draw_planets.py +658 -0
- kerykeion/charts/templates/aspect_grid_only.xml +596 -0
- kerykeion/charts/templates/chart.xml +741 -0
- kerykeion/charts/templates/wheel_only.xml +653 -0
- kerykeion/charts/themes/black-and-white.css +148 -0
- kerykeion/charts/themes/classic.css +113 -0
- kerykeion/charts/themes/dark-high-contrast.css +159 -0
- kerykeion/charts/themes/dark.css +160 -0
- kerykeion/charts/themes/light.css +160 -0
- kerykeion/charts/themes/strawberry.css +158 -0
- kerykeion/composite_subject_factory.py +408 -0
- kerykeion/ephemeris_data_factory.py +443 -0
- kerykeion/fetch_geonames.py +105 -61
- kerykeion/house_comparison/__init__.py +6 -0
- kerykeion/house_comparison/house_comparison_factory.py +103 -0
- kerykeion/house_comparison/house_comparison_utils.py +126 -0
- kerykeion/kr_types/__init__.py +70 -0
- kerykeion/kr_types/chart_template_model.py +20 -0
- kerykeion/kr_types/kerykeion_exception.py +20 -0
- kerykeion/kr_types/kr_literals.py +20 -0
- kerykeion/kr_types/kr_models.py +20 -0
- kerykeion/kr_types/settings_models.py +20 -0
- kerykeion/planetary_return_factory.py +805 -0
- kerykeion/relationship_score_factory.py +301 -0
- kerykeion/report.py +779 -0
- kerykeion/schemas/__init__.py +106 -0
- kerykeion/schemas/chart_template_model.py +367 -0
- kerykeion/schemas/kerykeion_exception.py +20 -0
- kerykeion/schemas/kr_literals.py +181 -0
- kerykeion/schemas/kr_models.py +603 -0
- kerykeion/schemas/settings_models.py +188 -0
- kerykeion/settings/__init__.py +20 -0
- kerykeion/settings/chart_defaults.py +444 -0
- kerykeion/settings/config_constants.py +152 -0
- kerykeion/settings/kerykeion_settings.py +51 -0
- kerykeion/settings/translation_strings.py +1499 -0
- kerykeion/settings/translations.py +74 -0
- kerykeion/sweph/README.md +3 -0
- kerykeion/sweph/ast136/s136108s.se1 +0 -0
- kerykeion/sweph/ast136/s136199s.se1 +0 -0
- kerykeion/sweph/ast136/s136472s.se1 +0 -0
- kerykeion/sweph/ast28/se28978s.se1 +0 -0
- kerykeion/sweph/ast50/se50000s.se1 +0 -0
- kerykeion/sweph/ast90/se90377s.se1 +0 -0
- kerykeion/sweph/ast90/se90482s.se1 +0 -0
- kerykeion/sweph/seas_18.se1 +0 -0
- kerykeion/sweph/sefstars.txt +1602 -0
- kerykeion/transits_time_range_factory.py +302 -0
- kerykeion/utilities.py +762 -130
- kerykeion-5.1.9.dist-info/METADATA +1793 -0
- kerykeion-5.1.9.dist-info/RECORD +63 -0
- {kerykeion-3.1.1.dist-info → kerykeion-5.1.9.dist-info}/WHEEL +1 -2
- kerykeion-5.1.9.dist-info/licenses/LICENSE +661 -0
- kerykeion/aspects.py +0 -331
- kerykeion/charts/charts_svg.py +0 -1607
- kerykeion/charts/templates/basic.xml +0 -285
- kerykeion/charts/templates/extended.xml +0 -294
- kerykeion/kr.config.json +0 -464
- kerykeion/main.py +0 -595
- kerykeion/print_all_data.py +0 -44
- kerykeion/relationship_score.py +0 -219
- kerykeion/types.py +0 -190
- kerykeion-3.1.1.dist-info/METADATA +0 -204
- kerykeion-3.1.1.dist-info/RECORD +0 -17
- kerykeion-3.1.1.dist-info/top_level.txt +0 -1
kerykeion/main.py
DELETED
|
@@ -1,595 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
This is part of Kerykeion (C) 2022 Giacomo Battaglia
|
|
3
|
-
"""
|
|
4
|
-
#!/usr/bin/env python3
|
|
5
|
-
# -*- coding: utf-8 -*-
|
|
6
|
-
|
|
7
|
-
import math
|
|
8
|
-
import pytz
|
|
9
|
-
import swisseph as swe
|
|
10
|
-
|
|
11
|
-
from datetime import datetime
|
|
12
|
-
from logging import Logger, getLogger, basicConfig
|
|
13
|
-
from kerykeion.fetch_geonames import FetchGeonames
|
|
14
|
-
from kerykeion.types import KerykeionException, ZodiacType, KerykeionSubject
|
|
15
|
-
from kerykeion.utilities import get_number_from_name, calculate_position
|
|
16
|
-
from pathlib import Path
|
|
17
|
-
from typing import Union
|
|
18
|
-
|
|
19
|
-
# swe.set_ephe_path("/")
|
|
20
|
-
|
|
21
|
-
basicConfig(
|
|
22
|
-
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
|
23
|
-
level=20
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class KrInstance():
|
|
28
|
-
"""
|
|
29
|
-
Calculates all the astrological information, the coordinates,
|
|
30
|
-
it's utc and julian day and returns an object with all that data.
|
|
31
|
-
|
|
32
|
-
Args:
|
|
33
|
-
- name (str, optional): _ Defaults to "Now".
|
|
34
|
-
- year (int, optional): _ Defaults to now.year.
|
|
35
|
-
- month (int, optional): _ Defaults to now.month.
|
|
36
|
-
- day (int, optional): _ Defaults to now.day.
|
|
37
|
-
- hour (int, optional): _ Defaults to now.hour.
|
|
38
|
-
- minute (int, optional): _ Defaults to now.minute.
|
|
39
|
-
- city (str, optional): City or location of birth. Defaults to "London".
|
|
40
|
-
- nat (str, optional): _ Defaults to "".
|
|
41
|
-
- lng (Union[int, float], optional): _ Defaults to False.
|
|
42
|
-
- lat (Union[int, float], optional): _ Defaults to False.
|
|
43
|
-
- tz_str (Union[str, bool], optional): _ Defaults to False.
|
|
44
|
-
- logger (Union[Logger, None], optional): _ Defaults to None.
|
|
45
|
-
- geonames_username (str, optional): _ Defaults to 'century.boy'.
|
|
46
|
-
- online (bool, optional): Sets if you want to use the online mode (using
|
|
47
|
-
geonames) or not. Defaults to True.
|
|
48
|
-
"""
|
|
49
|
-
# Deined by the user
|
|
50
|
-
name: str
|
|
51
|
-
year: int
|
|
52
|
-
month: int
|
|
53
|
-
day: int
|
|
54
|
-
hour: int
|
|
55
|
-
minute: int
|
|
56
|
-
city: str
|
|
57
|
-
nation: str
|
|
58
|
-
lng: Union[int, float]
|
|
59
|
-
lat: Union[int, float]
|
|
60
|
-
tz_str: str
|
|
61
|
-
geonames_username: str
|
|
62
|
-
online: bool
|
|
63
|
-
zodiac_type: ZodiacType
|
|
64
|
-
__logger: Logger
|
|
65
|
-
|
|
66
|
-
# Generated internally
|
|
67
|
-
julian_day: Union[int, float]
|
|
68
|
-
utc: datetime
|
|
69
|
-
|
|
70
|
-
now = datetime.now()
|
|
71
|
-
|
|
72
|
-
def __init__(
|
|
73
|
-
self,
|
|
74
|
-
name="Now",
|
|
75
|
-
year: int = now.year,
|
|
76
|
-
month: int = now.month,
|
|
77
|
-
day: int = now.day,
|
|
78
|
-
hour: int = now.hour,
|
|
79
|
-
minute: int = now.minute,
|
|
80
|
-
city: str = "London",
|
|
81
|
-
nation: str = "",
|
|
82
|
-
lng: Union[int, float] = 0,
|
|
83
|
-
lat: Union[int, float] = 0,
|
|
84
|
-
tz_str: str = "",
|
|
85
|
-
logger: Union[Logger, None] = None,
|
|
86
|
-
geonames_username: str = 'century.boy',
|
|
87
|
-
zodiac_type: ZodiacType = "Tropic",
|
|
88
|
-
online: bool = True,
|
|
89
|
-
) -> None:
|
|
90
|
-
|
|
91
|
-
self.__logger: Logger = logger or getLogger(
|
|
92
|
-
self.__class__.__name__)
|
|
93
|
-
self.__logger.debug('Starting Kerykeion')
|
|
94
|
-
|
|
95
|
-
self.name = name
|
|
96
|
-
self.year = year
|
|
97
|
-
self.month = month
|
|
98
|
-
self.day = day
|
|
99
|
-
self.hour = hour
|
|
100
|
-
self.minute = minute
|
|
101
|
-
self.city = city
|
|
102
|
-
self.nation = nation
|
|
103
|
-
self.lng = lng
|
|
104
|
-
self.lat = lat
|
|
105
|
-
self.tz_str = tz_str
|
|
106
|
-
self.__geonames_username = geonames_username
|
|
107
|
-
self.zodiac_type = zodiac_type
|
|
108
|
-
self.online = online
|
|
109
|
-
self.json_dir = Path.home()
|
|
110
|
-
|
|
111
|
-
if (not self.online) and (not lng or not lat or not tz_str):
|
|
112
|
-
raise KerykeionException(
|
|
113
|
-
"You need to set the coordinates and timezone if you want to use the offline mode!")
|
|
114
|
-
|
|
115
|
-
self.julian_day = self.__get_jd()
|
|
116
|
-
|
|
117
|
-
# Get all the calculations
|
|
118
|
-
self.__get_all()
|
|
119
|
-
|
|
120
|
-
def __str__(self) -> str:
|
|
121
|
-
return f"Astrological data for: {self.name}, {self.utc} UTC\nBirth location: {self.city}, Lat {self.lat}, Lon {self.lng}"
|
|
122
|
-
|
|
123
|
-
def __repr__(self) -> str:
|
|
124
|
-
return f"Astrological data for: {self.name}, {self.utc} UTC\nBirth location: {self.city}, Lat {self.lat}, Lon {self.lng}"
|
|
125
|
-
|
|
126
|
-
def __get_tz(self) -> str:
|
|
127
|
-
"""Gets the nearest time zone for the calculation"""
|
|
128
|
-
self.__logger.debug("Conneting to Geonames...")
|
|
129
|
-
|
|
130
|
-
geonames = FetchGeonames(
|
|
131
|
-
self.city, self.nation, logger=self.__logger, username=self.__geonames_username)
|
|
132
|
-
self.city_data: dict[str, str] = geonames.get_serialized_data()
|
|
133
|
-
|
|
134
|
-
if (
|
|
135
|
-
not 'countryCode' in self.city_data or
|
|
136
|
-
not 'timezonestr' in self.city_data or
|
|
137
|
-
not 'lat' in self.city_data or
|
|
138
|
-
not 'lng' in self.city_data
|
|
139
|
-
):
|
|
140
|
-
|
|
141
|
-
raise KerykeionException(
|
|
142
|
-
"No data found for this city, try again! Maybe check your connection?")
|
|
143
|
-
|
|
144
|
-
self.nation = self.city_data["countryCode"]
|
|
145
|
-
self.lng = float(self.city_data["lng"])
|
|
146
|
-
self.lat = float(self.city_data["lat"])
|
|
147
|
-
self.tz_str = self.city_data["timezonestr"]
|
|
148
|
-
|
|
149
|
-
if self.lat > 66.0:
|
|
150
|
-
self.lat = 66.0
|
|
151
|
-
self.__logger.info(
|
|
152
|
-
'Polar circle override for houses, using 66 degrees')
|
|
153
|
-
|
|
154
|
-
elif self.lat < -66.0:
|
|
155
|
-
self.lat = -66.0
|
|
156
|
-
self.__logger.info(
|
|
157
|
-
'Polar circle override for houses, using -66 degrees')
|
|
158
|
-
|
|
159
|
-
return self.tz_str
|
|
160
|
-
|
|
161
|
-
def __get_utc(self):
|
|
162
|
-
"""Converts local time to utc time. """
|
|
163
|
-
if (self.online) and (not self.tz_str or not self.lng or not self.lat):
|
|
164
|
-
tz = self.__get_tz()
|
|
165
|
-
local_time = pytz.timezone(tz)
|
|
166
|
-
else:
|
|
167
|
-
local_time = pytz.timezone(self.tz_str)
|
|
168
|
-
|
|
169
|
-
naive_datetime = datetime(
|
|
170
|
-
self.year,
|
|
171
|
-
self.month,
|
|
172
|
-
self.day,
|
|
173
|
-
self.hour,
|
|
174
|
-
self.minute,
|
|
175
|
-
0
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
local_datetime = local_time.localize(naive_datetime, is_dst=None)
|
|
179
|
-
utc_datetime = local_datetime.astimezone(pytz.utc)
|
|
180
|
-
self.utc = utc_datetime
|
|
181
|
-
return self.utc
|
|
182
|
-
|
|
183
|
-
def __get_jd(self):
|
|
184
|
-
""" Calculates julian day from the utc time."""
|
|
185
|
-
utc = self.__get_utc()
|
|
186
|
-
self.utc_time = utc.hour + utc.minute/60
|
|
187
|
-
self.local_time = self.hour + self.minute/60
|
|
188
|
-
self.julian_day = float(swe.julday(utc.year, utc.month, utc.day,
|
|
189
|
-
self.utc_time))
|
|
190
|
-
|
|
191
|
-
return self.julian_day
|
|
192
|
-
|
|
193
|
-
def __houses(self) -> list:
|
|
194
|
-
"""Calculatetype positions and store them in dictionaries"""
|
|
195
|
-
point_type = "House"
|
|
196
|
-
# creates the list of the house in 360°
|
|
197
|
-
self.houses_degree_ut = swe.houses(self.julian_day, self.lat,
|
|
198
|
-
self.lng)[0]
|
|
199
|
-
# stores the house in singular dictionaries.
|
|
200
|
-
self.first_house = calculate_position(
|
|
201
|
-
self.houses_degree_ut[0], "First House", point_type=point_type
|
|
202
|
-
)
|
|
203
|
-
self.second_house = calculate_position(
|
|
204
|
-
self.houses_degree_ut[1], "Second House", point_type=point_type
|
|
205
|
-
)
|
|
206
|
-
self.third_house = calculate_position(
|
|
207
|
-
self.houses_degree_ut[2], "Third House", point_type=point_type
|
|
208
|
-
)
|
|
209
|
-
self.fourth_house = calculate_position(
|
|
210
|
-
self.houses_degree_ut[3], "Fourth House", point_type=point_type
|
|
211
|
-
)
|
|
212
|
-
self.fifth_house = calculate_position(
|
|
213
|
-
self.houses_degree_ut[4], "Fifth House", point_type=point_type
|
|
214
|
-
)
|
|
215
|
-
self.sixth_house = calculate_position(
|
|
216
|
-
self.houses_degree_ut[5], "Sixth House", point_type=point_type
|
|
217
|
-
)
|
|
218
|
-
self.seventh_house = calculate_position(
|
|
219
|
-
self.houses_degree_ut[6], "Seventh House", point_type=point_type
|
|
220
|
-
)
|
|
221
|
-
self.eighth_house = calculate_position(
|
|
222
|
-
self.houses_degree_ut[7], "Eighth House", point_type=point_type
|
|
223
|
-
)
|
|
224
|
-
self.ninth_house = calculate_position(
|
|
225
|
-
self.houses_degree_ut[8], "Ninth House", point_type=point_type
|
|
226
|
-
)
|
|
227
|
-
self.tenth_house = calculate_position(
|
|
228
|
-
self.houses_degree_ut[9], "Tenth House", point_type=point_type
|
|
229
|
-
)
|
|
230
|
-
self.eleventh_house = calculate_position(
|
|
231
|
-
self.houses_degree_ut[10], "Eleventh House", point_type=point_type
|
|
232
|
-
)
|
|
233
|
-
self.twelfth_house = calculate_position(
|
|
234
|
-
self.houses_degree_ut[11], "Twelfth House", point_type=point_type
|
|
235
|
-
)
|
|
236
|
-
|
|
237
|
-
# creates a list of all the dictionaries of thetype.
|
|
238
|
-
|
|
239
|
-
houses_degree = [
|
|
240
|
-
self.first_house["position"],
|
|
241
|
-
self.second_house["position"],
|
|
242
|
-
self.third_house["position"],
|
|
243
|
-
self.fourth_house["position"],
|
|
244
|
-
self.fifth_house["position"],
|
|
245
|
-
self.sixth_house["position"],
|
|
246
|
-
self.seventh_house["position"],
|
|
247
|
-
self.eighth_house["position"],
|
|
248
|
-
self.ninth_house["position"],
|
|
249
|
-
self.tenth_house["position"],
|
|
250
|
-
self.eleventh_house["position"],
|
|
251
|
-
self.twelfth_house["position"]
|
|
252
|
-
]
|
|
253
|
-
|
|
254
|
-
# return self.houses_list
|
|
255
|
-
return houses_degree
|
|
256
|
-
|
|
257
|
-
def __planets_degrees_lister(self):
|
|
258
|
-
"""Sidereal or tropic mode."""
|
|
259
|
-
self.__iflag = swe.FLG_SWIEPH+swe.FLG_SPEED
|
|
260
|
-
|
|
261
|
-
if self.zodiac_type == "Sidereal":
|
|
262
|
-
self.__iflag += swe.FLG_SIDEREAL
|
|
263
|
-
mode = "SIDM_FAGAN_BRADLEY"
|
|
264
|
-
swe.set_sid_mode(getattr(swe, mode))
|
|
265
|
-
|
|
266
|
-
"""Calculates the position of the planets and stores it in a list."""
|
|
267
|
-
|
|
268
|
-
sun_deg = swe.calc(self.julian_day, 0, self.__iflag)[0][0]
|
|
269
|
-
moon_deg = swe.calc(self.julian_day, 1, self.__iflag)[0][0]
|
|
270
|
-
mercury_deg = swe.calc(self.julian_day, 2, self.__iflag)[0][0]
|
|
271
|
-
venus_deg = swe.calc(self.julian_day, 3, self.__iflag)[0][0]
|
|
272
|
-
mars_deg = swe.calc(self.julian_day, 4, self.__iflag)[0][0]
|
|
273
|
-
jupiter_deg = swe.calc(self.julian_day, 5, self.__iflag)[0][0]
|
|
274
|
-
saturn_deg = swe.calc(self.julian_day, 6, self.__iflag)[0][0]
|
|
275
|
-
uranus_deg = swe.calc(self.julian_day, 7, self.__iflag)[0][0]
|
|
276
|
-
neptune_deg = swe.calc(self.julian_day, 8, self.__iflag)[0][0]
|
|
277
|
-
pluto_deg = swe.calc(self.julian_day, 9, self.__iflag)[0][0]
|
|
278
|
-
mean_node_deg = swe.calc(self.julian_day, 10, self.__iflag)[0][0]
|
|
279
|
-
true_node_deg = swe.calc(self.julian_day, 11, self.__iflag)[0][0]
|
|
280
|
-
|
|
281
|
-
# print(swe.calc(self.julian_day, 7, self.__iflag)[3])
|
|
282
|
-
|
|
283
|
-
self.planets_degrees = [
|
|
284
|
-
sun_deg,
|
|
285
|
-
moon_deg,
|
|
286
|
-
mercury_deg,
|
|
287
|
-
venus_deg,
|
|
288
|
-
mars_deg,
|
|
289
|
-
jupiter_deg,
|
|
290
|
-
saturn_deg,
|
|
291
|
-
uranus_deg,
|
|
292
|
-
neptune_deg,
|
|
293
|
-
pluto_deg,
|
|
294
|
-
mean_node_deg,
|
|
295
|
-
true_node_deg
|
|
296
|
-
]
|
|
297
|
-
|
|
298
|
-
return self.planets_degrees
|
|
299
|
-
|
|
300
|
-
def __planets(self) -> None:
|
|
301
|
-
""" Defines body positon in signs and information and
|
|
302
|
-
stores them in dictionaries """
|
|
303
|
-
self.planets_degrees = self.__planets_degrees_lister()
|
|
304
|
-
point_type = "Planet"
|
|
305
|
-
# stores the planets in singular dictionaries.
|
|
306
|
-
self.sun = calculate_position(
|
|
307
|
-
self.planets_degrees[0], "Sun", point_type=point_type
|
|
308
|
-
)
|
|
309
|
-
self.moon = calculate_position(
|
|
310
|
-
self.planets_degrees[1], "Moon", point_type=point_type
|
|
311
|
-
)
|
|
312
|
-
self.mercury = calculate_position(
|
|
313
|
-
self.planets_degrees[2], "Mercury", point_type=point_type
|
|
314
|
-
)
|
|
315
|
-
self.venus = calculate_position(
|
|
316
|
-
self.planets_degrees[3], "Venus", point_type=point_type
|
|
317
|
-
)
|
|
318
|
-
self.mars = calculate_position(
|
|
319
|
-
self.planets_degrees[4], "Mars", point_type=point_type
|
|
320
|
-
)
|
|
321
|
-
self.jupiter = calculate_position(
|
|
322
|
-
self.planets_degrees[5], "Jupiter", point_type=point_type
|
|
323
|
-
)
|
|
324
|
-
self.saturn = calculate_position(
|
|
325
|
-
self.planets_degrees[6], "Saturn", point_type=point_type
|
|
326
|
-
)
|
|
327
|
-
self.uranus = calculate_position(
|
|
328
|
-
self.planets_degrees[7], "Uranus", point_type=point_type
|
|
329
|
-
)
|
|
330
|
-
self.neptune = calculate_position(
|
|
331
|
-
self.planets_degrees[8], "Neptune", point_type=point_type
|
|
332
|
-
)
|
|
333
|
-
self.pluto = calculate_position(
|
|
334
|
-
self.planets_degrees[9], "Pluto", point_type=point_type
|
|
335
|
-
)
|
|
336
|
-
self.mean_node = calculate_position(
|
|
337
|
-
self.planets_degrees[10], "Mean_Node", point_type=point_type
|
|
338
|
-
)
|
|
339
|
-
self.true_node = calculate_position(
|
|
340
|
-
self.planets_degrees[11], "True_Node", point_type=point_type
|
|
341
|
-
)
|
|
342
|
-
|
|
343
|
-
def __planets_in_houses(self):
|
|
344
|
-
"""Calculates the house of the planet and updates
|
|
345
|
-
the planets dictionary."""
|
|
346
|
-
self.__planets()
|
|
347
|
-
self.__houses()
|
|
348
|
-
|
|
349
|
-
def for_every_planet(planet, planet_deg):
|
|
350
|
-
"""Function to do the calculation.
|
|
351
|
-
Args: planet dictionary, planet degree"""
|
|
352
|
-
|
|
353
|
-
def point_between(p1, p2, p3):
|
|
354
|
-
"""Finds if a point is between two other in a circle
|
|
355
|
-
args: first point, second point, point in the middle"""
|
|
356
|
-
p1_p2 = math.fmod(p2 - p1 + 360, 360)
|
|
357
|
-
p1_p3 = math.fmod(p3 - p1 + 360, 360)
|
|
358
|
-
if (p1_p2 <= 180) != (p1_p3 > p1_p2):
|
|
359
|
-
return True
|
|
360
|
-
else:
|
|
361
|
-
return False
|
|
362
|
-
|
|
363
|
-
if point_between(self.houses_degree_ut[0], self.houses_degree_ut[1],
|
|
364
|
-
planet_deg) == True:
|
|
365
|
-
planet["house"] = "First House"
|
|
366
|
-
elif point_between(self.houses_degree_ut[1], self.houses_degree_ut[2],
|
|
367
|
-
planet_deg) == True:
|
|
368
|
-
planet["house"] = "Second House"
|
|
369
|
-
elif point_between(self.houses_degree_ut[2], self.houses_degree_ut[3],
|
|
370
|
-
planet_deg) == True:
|
|
371
|
-
planet["house"] = "Third House"
|
|
372
|
-
elif point_between(self.houses_degree_ut[3], self.houses_degree_ut[4],
|
|
373
|
-
planet_deg) == True:
|
|
374
|
-
planet["house"] = "Fourth House"
|
|
375
|
-
elif point_between(self.houses_degree_ut[4], self.houses_degree_ut[5],
|
|
376
|
-
planet_deg) == True:
|
|
377
|
-
planet["house"] = "Fifth House"
|
|
378
|
-
elif point_between(self.houses_degree_ut[5], self.houses_degree_ut[6],
|
|
379
|
-
planet_deg) == True:
|
|
380
|
-
planet["house"] = "Sixth House"
|
|
381
|
-
elif point_between(self.houses_degree_ut[6], self.houses_degree_ut[7],
|
|
382
|
-
planet_deg) == True:
|
|
383
|
-
planet["house"] = "Seventh House"
|
|
384
|
-
elif point_between(self.houses_degree_ut[7], self.houses_degree_ut[8],
|
|
385
|
-
planet_deg) == True:
|
|
386
|
-
planet["house"] = "Eighth House"
|
|
387
|
-
elif point_between(self.houses_degree_ut[8], self.houses_degree_ut[9],
|
|
388
|
-
planet_deg) == True:
|
|
389
|
-
planet["house"] = "Ninth House"
|
|
390
|
-
elif point_between(self.houses_degree_ut[9], self.houses_degree_ut[10],
|
|
391
|
-
planet_deg) == True:
|
|
392
|
-
planet["house"] = "Tenth House"
|
|
393
|
-
elif point_between(self.houses_degree_ut[10], self.houses_degree_ut[11],
|
|
394
|
-
planet_deg) == True:
|
|
395
|
-
planet["house"] = "Eleventh House"
|
|
396
|
-
elif point_between(self.houses_degree_ut[11], self.houses_degree_ut[0],
|
|
397
|
-
planet_deg) == True:
|
|
398
|
-
planet["house"] = "Twelfth House"
|
|
399
|
-
else:
|
|
400
|
-
planet["house"] = "error!"
|
|
401
|
-
|
|
402
|
-
return planet
|
|
403
|
-
|
|
404
|
-
self.sun = for_every_planet(
|
|
405
|
-
self.sun, self.planets_degrees[0]
|
|
406
|
-
)
|
|
407
|
-
self.moon = for_every_planet(
|
|
408
|
-
self.moon, self.planets_degrees[1]
|
|
409
|
-
)
|
|
410
|
-
self.mercury = for_every_planet(
|
|
411
|
-
self.mercury, self.planets_degrees[2]
|
|
412
|
-
)
|
|
413
|
-
self.venus = for_every_planet(
|
|
414
|
-
self.venus, self.planets_degrees[3]
|
|
415
|
-
)
|
|
416
|
-
self.mars = for_every_planet(
|
|
417
|
-
self.mars, self.planets_degrees[4]
|
|
418
|
-
)
|
|
419
|
-
self.jupiter = for_every_planet(
|
|
420
|
-
self.jupiter, self.planets_degrees[5]
|
|
421
|
-
)
|
|
422
|
-
self.saturn = for_every_planet(
|
|
423
|
-
self.saturn, self.planets_degrees[6]
|
|
424
|
-
)
|
|
425
|
-
self.uranus = for_every_planet(
|
|
426
|
-
self.uranus, self.planets_degrees[7]
|
|
427
|
-
)
|
|
428
|
-
self.neptune = for_every_planet(
|
|
429
|
-
self.neptune, self.planets_degrees[8]
|
|
430
|
-
)
|
|
431
|
-
self.pluto = for_every_planet(
|
|
432
|
-
self.pluto, self.planets_degrees[9]
|
|
433
|
-
)
|
|
434
|
-
self.mean_node = for_every_planet(
|
|
435
|
-
self.mean_node, self.planets_degrees[10]
|
|
436
|
-
)
|
|
437
|
-
self.true_node = for_every_planet(
|
|
438
|
-
self.true_node, self.planets_degrees[11]
|
|
439
|
-
)
|
|
440
|
-
|
|
441
|
-
planets_list = [
|
|
442
|
-
self.sun,
|
|
443
|
-
self.moon,
|
|
444
|
-
self.mercury,
|
|
445
|
-
self.venus,
|
|
446
|
-
self.mars,
|
|
447
|
-
self.jupiter,
|
|
448
|
-
self.saturn,
|
|
449
|
-
self.uranus,
|
|
450
|
-
self.neptune,
|
|
451
|
-
self.pluto,
|
|
452
|
-
self.mean_node,
|
|
453
|
-
self.true_node
|
|
454
|
-
]
|
|
455
|
-
|
|
456
|
-
# Check in retrograde or not:
|
|
457
|
-
planets_ret = []
|
|
458
|
-
for p in planets_list:
|
|
459
|
-
planet_number = get_number_from_name(p["name"])
|
|
460
|
-
if swe.calc(self.julian_day, planet_number, self.__iflag)[0][3] < 0:
|
|
461
|
-
p['retrograde'] = True
|
|
462
|
-
else:
|
|
463
|
-
p['retrograde'] = False
|
|
464
|
-
planets_ret.append(p)
|
|
465
|
-
|
|
466
|
-
def __lunar_phase_calc(self) -> None:
|
|
467
|
-
""" Function to calculate the lunar phase"""
|
|
468
|
-
|
|
469
|
-
# If ther's an error:
|
|
470
|
-
moon_phase, sun_phase = None, None
|
|
471
|
-
|
|
472
|
-
# anti-clockwise degrees between sun and moon
|
|
473
|
-
moon, sun = self.planets_degrees[1], self.planets_degrees[0]
|
|
474
|
-
degrees_between = moon - sun
|
|
475
|
-
|
|
476
|
-
if degrees_between < 0:
|
|
477
|
-
degrees_between += 360.0
|
|
478
|
-
|
|
479
|
-
step = 360.0 / 28.0
|
|
480
|
-
|
|
481
|
-
for x in range(28):
|
|
482
|
-
low = x * step
|
|
483
|
-
high = (x + 1) * step
|
|
484
|
-
|
|
485
|
-
if degrees_between >= low and degrees_between < high:
|
|
486
|
-
moon_phase = x + 1
|
|
487
|
-
|
|
488
|
-
sunstep = [
|
|
489
|
-
0, 30, 40, 50, 60, 70, 80, 90, 120, 130, 140, 150, 160, 170, 180,
|
|
490
|
-
210, 220, 230, 240, 250, 260, 270, 300, 310, 320, 330, 340, 350
|
|
491
|
-
]
|
|
492
|
-
|
|
493
|
-
for x in range(len(sunstep)):
|
|
494
|
-
|
|
495
|
-
low = sunstep[x]
|
|
496
|
-
|
|
497
|
-
if x == 27:
|
|
498
|
-
high = 360
|
|
499
|
-
else:
|
|
500
|
-
high = sunstep[x+1]
|
|
501
|
-
if degrees_between >= low and degrees_between < high:
|
|
502
|
-
sun_phase = x + 1
|
|
503
|
-
|
|
504
|
-
def moon_emoji(phase):
|
|
505
|
-
if phase == 1:
|
|
506
|
-
result = "🌑"
|
|
507
|
-
elif phase < 7:
|
|
508
|
-
result = "🌒"
|
|
509
|
-
elif 7 <= phase <= 9:
|
|
510
|
-
result = "🌓"
|
|
511
|
-
elif phase < 14:
|
|
512
|
-
result = "🌔"
|
|
513
|
-
elif phase == 14:
|
|
514
|
-
result = "🌕"
|
|
515
|
-
elif phase < 20:
|
|
516
|
-
result = "🌖"
|
|
517
|
-
elif 20 <= phase <= 22:
|
|
518
|
-
result = "🌗"
|
|
519
|
-
elif phase <= 28:
|
|
520
|
-
result = "🌘"
|
|
521
|
-
else:
|
|
522
|
-
result = phase
|
|
523
|
-
|
|
524
|
-
return result
|
|
525
|
-
|
|
526
|
-
self.lunar_phase = {
|
|
527
|
-
"degrees_between_s_m": degrees_between,
|
|
528
|
-
"moon_phase": moon_phase,
|
|
529
|
-
"sun_phase": sun_phase,
|
|
530
|
-
"moon_emoji": moon_emoji(moon_phase)
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
def __make_lists(self):
|
|
534
|
-
""" Internal function to generate the lists"""
|
|
535
|
-
self.planets_list = [self.sun, self.moon, self.mercury, self.venus,
|
|
536
|
-
self.mars, self.jupiter, self.saturn, self.uranus, self.neptune,
|
|
537
|
-
self.pluto, self.mean_node, self.true_node]
|
|
538
|
-
|
|
539
|
-
self.houses_list = [self.first_house, self.second_house, self.third_house,
|
|
540
|
-
self.fourth_house, self.fifth_house, self.sixth_house, self.seventh_house,
|
|
541
|
-
self.eighth_house, self.ninth_house, self.tenth_house, self.eleventh_house,
|
|
542
|
-
self.twelfth_house]
|
|
543
|
-
|
|
544
|
-
def __get_all(self):
|
|
545
|
-
""" Gets all data from all the functions """
|
|
546
|
-
|
|
547
|
-
self.__planets_in_houses()
|
|
548
|
-
self.__lunar_phase_calc()
|
|
549
|
-
self.__make_lists()
|
|
550
|
-
|
|
551
|
-
def json(self, dump=False, destination_folder: Union[str, None] = None) -> str:
|
|
552
|
-
"""
|
|
553
|
-
Dumps the Kerykeion object to a json string foramt,
|
|
554
|
-
if dump=True also dumps to file located in destination
|
|
555
|
-
or the home folder.
|
|
556
|
-
"""
|
|
557
|
-
|
|
558
|
-
KrData = KerykeionSubject(**self.__dict__)
|
|
559
|
-
json_string = KrData.json(exclude_none=True)
|
|
560
|
-
print(json_string)
|
|
561
|
-
|
|
562
|
-
if dump:
|
|
563
|
-
if destination_folder:
|
|
564
|
-
destination_path = Path(destination_folder)
|
|
565
|
-
json_path = destination_path / f"{self.name}_kerykeion.json"
|
|
566
|
-
|
|
567
|
-
else:
|
|
568
|
-
json_path = self.json_dir / f"{self.name}_kerykeion.json"
|
|
569
|
-
|
|
570
|
-
with open(json_path, "w", encoding="utf-8") as file:
|
|
571
|
-
file.write(json_string)
|
|
572
|
-
self.__logger.info(f"JSON file dumped in {json_path}.")
|
|
573
|
-
|
|
574
|
-
return json_string
|
|
575
|
-
|
|
576
|
-
def model(self) -> KerykeionSubject:
|
|
577
|
-
"""
|
|
578
|
-
Creates a Pydantic model of the Kerykeion object.
|
|
579
|
-
"""
|
|
580
|
-
|
|
581
|
-
return KerykeionSubject(**self.__dict__)
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
if __name__ == "__main__":
|
|
585
|
-
|
|
586
|
-
kanye = KrInstance(
|
|
587
|
-
"Kanye", 1977, 6, 8, 8, 45,
|
|
588
|
-
lng=50, lat=50, tz_str="Europe/Rome"
|
|
589
|
-
)
|
|
590
|
-
|
|
591
|
-
test = KrInstance("Kanye", 1977, 6, 8, 8, 45, "Milano")
|
|
592
|
-
# print(test.sun)
|
|
593
|
-
# print(kanye.geonames_username)
|
|
594
|
-
|
|
595
|
-
print(kanye.model())
|
kerykeion/print_all_data.py
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
This is part of Kerykeion (C) 2022 Giacomo Battaglia
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
#!/usr/bin/env python3
|
|
6
|
-
# -*- coding: utf-8 -*-
|
|
7
|
-
|
|
8
|
-
from kerykeion import KrInstance
|
|
9
|
-
|
|
10
|
-
def print_all_data(user: KrInstance) -> None:
|
|
11
|
-
output = ("\n")
|
|
12
|
-
output += ("NAME: " + user.name + "\n")
|
|
13
|
-
output += ("PLANET POSITION\n")
|
|
14
|
-
output += (" \n")
|
|
15
|
-
output += (f"Sun: {user.sun['sign']} {round(user.sun['position'], 3)} in {user.sun['house']}\n")
|
|
16
|
-
output += (f"Moon: {user.moon['sign']} {round(user.moon['position'], 3)} in {user.moon['house']}\n")
|
|
17
|
-
output += (f"Mercury: {user.mercury['sign']} {round(user.mercury['position'], 3)} in {user.mercury['house']}\n")
|
|
18
|
-
output += (f"Venus: {user.venus['sign']} {round(user.venus['position'], 3)} in {user.venus['house']}\n")
|
|
19
|
-
output += (f"Mars: {user.mars['sign']} {round(user.mars['position'], 3)} in {user.mars['house']}\n")
|
|
20
|
-
output += (f"Jupiter: {user.jupiter['sign']} {round(user.jupiter['position'], 3)} in {user.jupiter['house']}\n")
|
|
21
|
-
output += (f"Saturn: {user.saturn['sign']} {round(user.saturn['position'], 3)} in {user.saturn['house']}\n")
|
|
22
|
-
output += (f"Uranus: {user.uranus['sign']} {round(user.uranus['position'], 3)} in {user.uranus['house']}\n")
|
|
23
|
-
output += (f"Neptune: {user.neptune['sign']} {round(user.neptune['position'], 3)} in {user.neptune['house']}\n")
|
|
24
|
-
output += (f"Pluto: {user.pluto['sign']} {round(user.pluto['position'], 3)} in {user.pluto['house']}\n")
|
|
25
|
-
#output += (f"Juno: {p[10]['sign']} {round(p[10]['pos'], 3)} in {p[10]['house']}\n\n")
|
|
26
|
-
output += ("\nPLACIDUS HOUSES\n")
|
|
27
|
-
output += (f"House Cusp 1: {user.first_house['sign']} {round(user.first_house['position'], 3)}\n")
|
|
28
|
-
output += (f"House Cusp 2: {user.second_house['sign']} {round(user.second_house['position'], 3)}\n")
|
|
29
|
-
output += (f"House Cusp 3: {user.third_house['sign']} {round(user.third_house['position'], 3)}\n")
|
|
30
|
-
output += (f"House Cusp 4: {user.fourth_house['sign']} {round(user.fourth_house['position'], 3)}\n")
|
|
31
|
-
output += (f"House Cusp 5: {user.fifth_house['sign']} {round(user.fifth_house['position'], 3)}\n")
|
|
32
|
-
output += (f"House Cusp 6: {user.sixth_house['sign']} {round(user.sixth_house['position'], 3)}\n")
|
|
33
|
-
output += (f"House Cusp 7: {user.seventh_house['sign']} {round(user.seventh_house['position'], 3)}\n")
|
|
34
|
-
output += (f"House Cusp 8: {user.eighth_house['sign']} {round(user.eighth_house['position'], 3)}\n")
|
|
35
|
-
output += (f"House Cusp 9: {user.ninth_house['sign']} {round(user.ninth_house['position'], 3)}\n")
|
|
36
|
-
output += (f"House Cusp 10: {user.tenth_house['sign']} {round(user.tenth_house['position'], 3)}\n")
|
|
37
|
-
output += (f"House Cusp 11: {user.eleventh_house['sign']} {round(user.eleventh_house['position'], 3)}\n")
|
|
38
|
-
output += (f"House Cusp 12: {user.twelfth_house['sign']} {round(user.twelfth_house['position'], 3)}\n")
|
|
39
|
-
output += ("\n")
|
|
40
|
-
print(output)
|
|
41
|
-
|
|
42
|
-
if __name__ == "__main__":
|
|
43
|
-
user = KrInstance("Brigitte Bardot", 1934, 9, 28, 13, 15, "Paris", "FR")
|
|
44
|
-
print_all_data(user)
|