kerykeion 4.12.3__py3-none-any.whl → 4.18.0__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 +3 -1
- kerykeion/aspects/aspects_utils.py +40 -123
- kerykeion/aspects/natal_aspects.py +34 -25
- kerykeion/aspects/synastry_aspects.py +34 -28
- kerykeion/astrological_subject.py +199 -196
- kerykeion/charts/charts_utils.py +701 -62
- kerykeion/charts/draw_planets.py +407 -0
- kerykeion/charts/kerykeion_chart_svg.py +534 -1140
- kerykeion/charts/templates/aspect_grid_only.xml +452 -0
- kerykeion/charts/templates/chart.xml +88 -70
- kerykeion/charts/templates/wheel_only.xml +499 -0
- kerykeion/charts/themes/classic.css +82 -0
- kerykeion/charts/themes/dark-high-contrast.css +121 -0
- kerykeion/charts/themes/dark.css +121 -0
- kerykeion/charts/themes/light.css +117 -0
- kerykeion/enums.py +1 -0
- kerykeion/ephemeris_data.py +178 -0
- kerykeion/fetch_geonames.py +2 -3
- kerykeion/kr_types/chart_types.py +6 -16
- kerykeion/kr_types/kr_literals.py +12 -3
- kerykeion/kr_types/kr_models.py +77 -32
- kerykeion/kr_types/settings_models.py +4 -10
- kerykeion/relationship_score/__init__.py +2 -0
- kerykeion/relationship_score/relationship_score.py +175 -0
- kerykeion/relationship_score/relationship_score_factory.py +275 -0
- kerykeion/report.py +6 -3
- kerykeion/settings/kerykeion_settings.py +6 -1
- kerykeion/settings/kr.config.json +256 -102
- kerykeion/utilities.py +122 -217
- {kerykeion-4.12.3.dist-info → kerykeion-4.18.0.dist-info}/METADATA +40 -10
- kerykeion-4.18.0.dist-info/RECORD +42 -0
- kerykeion/relationship_score.py +0 -205
- kerykeion-4.12.3.dist-info/RECORD +0 -32
- {kerykeion-4.12.3.dist-info → kerykeion-4.18.0.dist-info}/LICENSE +0 -0
- {kerykeion-4.12.3.dist-info → kerykeion-4.18.0.dist-info}/WHEEL +0 -0
- {kerykeion-4.12.3.dist-info → kerykeion-4.18.0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
This is part of Kerykeion (C) 2024 Giacomo Battaglia
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from kerykeion import AstrologicalSubject
|
|
7
|
+
from kerykeion.aspects.synastry_aspects import SynastryAspects
|
|
8
|
+
import logging
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Union
|
|
11
|
+
from kerykeion.kr_types.kr_models import AstrologicalSubjectModel, RelationshipScoreAspectModel, RelationshipScoreModel
|
|
12
|
+
from kerykeion.kr_types.kr_literals import RelationshipScoreDescription
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class RelationshipScoreFactory:
|
|
16
|
+
"""
|
|
17
|
+
Calculates the relevance of the relationship between two subjects using the Ciro Discepolo method.
|
|
18
|
+
|
|
19
|
+
Results:
|
|
20
|
+
- 0 to 5: Minimal relationship
|
|
21
|
+
- 5 to 10: Medium relationship
|
|
22
|
+
- 10 to 15: Important relationship
|
|
23
|
+
- 15 to 20: Very important relationship
|
|
24
|
+
- 20 to 35: Exceptional relationship
|
|
25
|
+
- 30 and above: Rare Exceptional relationship
|
|
26
|
+
|
|
27
|
+
Documentation: http://www.cirodiscepolo.it/Articoli/Discepoloele.htm
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
first_subject (Union[AstrologicalSubject, AstrologicalSubjectModel]): First subject instance
|
|
31
|
+
second_subject (Union[AstrologicalSubject, AstrologicalSubjectModel]): Second subject instance
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
SCORE_MAPPING = [
|
|
35
|
+
("Minimal", 5),
|
|
36
|
+
("Medium", 10),
|
|
37
|
+
("Important", 15),
|
|
38
|
+
("Very Important", 20),
|
|
39
|
+
("Exceptional", 30),
|
|
40
|
+
("Rare Exceptional", float("inf")),
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
def __init__(
|
|
44
|
+
self,
|
|
45
|
+
first_subject: Union[AstrologicalSubject, AstrologicalSubjectModel],
|
|
46
|
+
second_subject: Union[AstrologicalSubject, AstrologicalSubjectModel],
|
|
47
|
+
use_only_major_aspects: bool = True,
|
|
48
|
+
):
|
|
49
|
+
if isinstance(first_subject, AstrologicalSubject):
|
|
50
|
+
self.first_subject = first_subject.model()
|
|
51
|
+
if isinstance(second_subject, AstrologicalSubject):
|
|
52
|
+
self.second_subject = second_subject.model()
|
|
53
|
+
|
|
54
|
+
self.use_only_major_aspects = use_only_major_aspects
|
|
55
|
+
|
|
56
|
+
self.score_value = 0
|
|
57
|
+
self.relationship_score_description: RelationshipScoreDescription = "Minimal"
|
|
58
|
+
self.is_destiny_sign = True
|
|
59
|
+
self.relationship_score_aspects: list[RelationshipScoreAspectModel] = []
|
|
60
|
+
self._synastry_aspects = SynastryAspects(self.first_subject, self.second_subject).all_aspects
|
|
61
|
+
|
|
62
|
+
def _evaluate_destiny_sign(self):
|
|
63
|
+
"""
|
|
64
|
+
Evaluates if the subjects share the same sun sign quality and adds points if true.
|
|
65
|
+
"""
|
|
66
|
+
if self.first_subject.sun["quality"] == self.second_subject.sun["quality"]:
|
|
67
|
+
self.is_destiny_sign = True
|
|
68
|
+
self.score_value += 5
|
|
69
|
+
logging.debug(f"Destiny sign found, adding 5 points, total score: {self.score_value}")
|
|
70
|
+
|
|
71
|
+
def _evaluate_aspect(self, aspect, points):
|
|
72
|
+
"""
|
|
73
|
+
Evaluates an aspect and adds points to the score.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
aspect (dict): Aspect information.
|
|
77
|
+
points (int): Points to add.
|
|
78
|
+
"""
|
|
79
|
+
if self.use_only_major_aspects and not aspect["is_major"]:
|
|
80
|
+
return
|
|
81
|
+
|
|
82
|
+
self.score_value += points
|
|
83
|
+
self.relationship_score_aspects.append(
|
|
84
|
+
RelationshipScoreAspectModel(
|
|
85
|
+
p1_name=aspect["p1_name"],
|
|
86
|
+
p2_name=aspect["p2_name"],
|
|
87
|
+
aspect=aspect["aspect"],
|
|
88
|
+
orbit=aspect["orbit"],
|
|
89
|
+
)
|
|
90
|
+
)
|
|
91
|
+
logging.debug(f"{aspect['p1_name']}-{aspect['p2_name']} aspect: {aspect['aspect']} with orbit {aspect['orbit']} degrees, adding {points} points, total score: {self.score_value}, total aspects: {len(self.relationship_score_aspects)}")
|
|
92
|
+
|
|
93
|
+
def _evaluate_sun_sun_main_aspect(self, aspect):
|
|
94
|
+
"""
|
|
95
|
+
Evaluates Sun-Sun main aspects and adds points accordingly:
|
|
96
|
+
- 8 points for conjunction/opposition/square
|
|
97
|
+
- 11 points if the aspect's orbit is <= 2 degrees
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
aspect (dict): Aspect information.
|
|
101
|
+
"""
|
|
102
|
+
if aspect["p1_name"] == "Sun" and aspect["p2_name"] == "Sun" and aspect["aspect"] in {"conjunction", "opposition", "square"}:
|
|
103
|
+
points = 11 if aspect["orbit"] <= 2 else 8
|
|
104
|
+
self._evaluate_aspect(aspect, points)
|
|
105
|
+
|
|
106
|
+
def _evaluate_sun_moon_conjunction(self, aspect):
|
|
107
|
+
"""
|
|
108
|
+
Evaluates Sun-Moon conjunctions and adds points accordingly:
|
|
109
|
+
- 8 points for conjunction
|
|
110
|
+
- 11 points if the aspect's orbit is <= 2 degrees
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
aspect (dict): Aspect information.
|
|
114
|
+
"""
|
|
115
|
+
if {aspect["p1_name"], aspect["p2_name"]} == {"Moon", "Sun"} and aspect["aspect"] == "conjunction":
|
|
116
|
+
points = 11 if aspect["orbit"] <= 2 else 8
|
|
117
|
+
self._evaluate_aspect(aspect, points)
|
|
118
|
+
|
|
119
|
+
def _evaluate_sun_sun_other_aspects(self, aspect):
|
|
120
|
+
"""
|
|
121
|
+
Evaluates Sun-Sun aspects that are not conjunctions and adds points accordingly:
|
|
122
|
+
- 4 points for other aspects
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
aspect (dict): Aspect information.
|
|
126
|
+
"""
|
|
127
|
+
if aspect["p1_name"] == "Sun" and aspect["p2_name"] == "Sun" and aspect["aspect"] not in {"conjunction", "opposition", "square"}:
|
|
128
|
+
points = 4
|
|
129
|
+
self._evaluate_aspect(aspect, points)
|
|
130
|
+
|
|
131
|
+
def _evaluate_sun_moon_other_aspects(self, aspect):
|
|
132
|
+
"""
|
|
133
|
+
Evaluates Sun-Moon aspects that are not conjunctions and adds points accordingly:
|
|
134
|
+
- 4 points for other aspects
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
aspect (dict): Aspect information.
|
|
138
|
+
"""
|
|
139
|
+
if {aspect["p1_name"], aspect["p2_name"]} == {"Moon", "Sun"} and aspect["aspect"] != "conjunction":
|
|
140
|
+
points = 4
|
|
141
|
+
self._evaluate_aspect(aspect, points)
|
|
142
|
+
|
|
143
|
+
def _evaluate_sun_ascendant_aspect(self, aspect):
|
|
144
|
+
"""
|
|
145
|
+
Evaluates Sun-Ascendant aspects and adds points accordingly:
|
|
146
|
+
- 4 points for any aspect
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
aspect (dict): Aspect information.
|
|
150
|
+
"""
|
|
151
|
+
if {aspect["p1_name"], aspect["p2_name"]} == {"Sun", "First_House"}:
|
|
152
|
+
points = 4
|
|
153
|
+
self._evaluate_aspect(aspect, points)
|
|
154
|
+
|
|
155
|
+
def _evaluate_moon_ascendant_aspect(self, aspect):
|
|
156
|
+
"""
|
|
157
|
+
Evaluates Moon-Ascendant aspects and adds points accordingly:
|
|
158
|
+
- 4 points for any aspect
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
aspect (dict): Aspect information.
|
|
162
|
+
"""
|
|
163
|
+
if {aspect["p1_name"], aspect["p2_name"]} == {"Moon", "First_House"}:
|
|
164
|
+
points = 4
|
|
165
|
+
self._evaluate_aspect(aspect, points)
|
|
166
|
+
|
|
167
|
+
def _evaluate_venus_mars_aspect(self, aspect):
|
|
168
|
+
"""
|
|
169
|
+
Evaluates Venus-Mars aspects and adds points accordingly:
|
|
170
|
+
- 4 points for any aspect
|
|
171
|
+
|
|
172
|
+
Args:
|
|
173
|
+
aspect (dict): Aspect information.
|
|
174
|
+
"""
|
|
175
|
+
if {aspect["p1_name"], aspect["p2_name"]} == {"Venus", "Mars"}:
|
|
176
|
+
points = 4
|
|
177
|
+
self._evaluate_aspect(aspect, points)
|
|
178
|
+
|
|
179
|
+
def _evaluate_relationship_score_description(self):
|
|
180
|
+
"""
|
|
181
|
+
Evaluates the relationship score description based on the total score.
|
|
182
|
+
"""
|
|
183
|
+
for description, threshold in self.SCORE_MAPPING:
|
|
184
|
+
if self.score_value < threshold:
|
|
185
|
+
self.relationship_score_description = description
|
|
186
|
+
break
|
|
187
|
+
|
|
188
|
+
def get_relationship_score(self):
|
|
189
|
+
"""
|
|
190
|
+
Calculates the relationship score based on synastry aspects.
|
|
191
|
+
|
|
192
|
+
Returns:
|
|
193
|
+
RelationshipScoreModel: The calculated relationship score.
|
|
194
|
+
"""
|
|
195
|
+
self._evaluate_destiny_sign()
|
|
196
|
+
|
|
197
|
+
for aspect in self._synastry_aspects:
|
|
198
|
+
self._evaluate_sun_sun_main_aspect(aspect)
|
|
199
|
+
self._evaluate_sun_moon_conjunction(aspect)
|
|
200
|
+
self._evaluate_sun_moon_other_aspects(aspect)
|
|
201
|
+
self._evaluate_sun_sun_other_aspects(aspect)
|
|
202
|
+
self._evaluate_sun_ascendant_aspect(aspect)
|
|
203
|
+
self._evaluate_moon_ascendant_aspect(aspect)
|
|
204
|
+
self._evaluate_venus_mars_aspect(aspect)
|
|
205
|
+
|
|
206
|
+
self._evaluate_relationship_score_description()
|
|
207
|
+
|
|
208
|
+
return RelationshipScoreModel(
|
|
209
|
+
score_value=self.score_value,
|
|
210
|
+
score_description=self.relationship_score_description,
|
|
211
|
+
is_destiny_sign=self.is_destiny_sign,
|
|
212
|
+
aspects=self.relationship_score_aspects,
|
|
213
|
+
subjects=[self.first_subject, self.second_subject],
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
if __name__ == "__main__":
|
|
218
|
+
from kerykeion.utilities import setup_logging
|
|
219
|
+
|
|
220
|
+
setup_logging(level="critical")
|
|
221
|
+
|
|
222
|
+
john = AstrologicalSubject("John", 1940, 10, 9, 18, 30, "Liverpool", "UK")
|
|
223
|
+
yoko = AstrologicalSubject("Yoko", 1933, 2, 18, 20, 30, "Tokyo", "JP")
|
|
224
|
+
|
|
225
|
+
relationship_score_factory = RelationshipScoreFactory(john, yoko)
|
|
226
|
+
relationship_score = relationship_score_factory.get_relationship_score()
|
|
227
|
+
|
|
228
|
+
print("John and Yoko relationship score:")
|
|
229
|
+
print(relationship_score.score_value)
|
|
230
|
+
print(relationship_score.score_description)
|
|
231
|
+
print(relationship_score.is_destiny_sign)
|
|
232
|
+
print(len(relationship_score.aspects))
|
|
233
|
+
print(len(relationship_score_factory._synastry_aspects))
|
|
234
|
+
|
|
235
|
+
print("------------------->")
|
|
236
|
+
freud = AstrologicalSubject("Freud", 1856, 5, 6, 18, 30, "Freiberg", "DE")
|
|
237
|
+
jung = AstrologicalSubject("Jung", 1875, 7, 26, 18, 30, "Kesswil", "CH")
|
|
238
|
+
|
|
239
|
+
relationship_score_factory = RelationshipScoreFactory(freud, jung)
|
|
240
|
+
relationship_score = relationship_score_factory.get_relationship_score()
|
|
241
|
+
|
|
242
|
+
print("Freud and Jung relationship score:")
|
|
243
|
+
print(relationship_score.score_value)
|
|
244
|
+
print(relationship_score.score_description)
|
|
245
|
+
print(relationship_score.is_destiny_sign)
|
|
246
|
+
print(len(relationship_score.aspects))
|
|
247
|
+
print(len(relationship_score_factory._synastry_aspects))
|
|
248
|
+
|
|
249
|
+
print("------------------->")
|
|
250
|
+
richart_burton = AstrologicalSubject("Richard Burton", 1925, 11, 10, 15, 00, "Pontrhydyfen", "UK")
|
|
251
|
+
liz_taylor = AstrologicalSubject("Elizabeth Taylor", 1932, 2, 27, 2, 30, "London", "UK")
|
|
252
|
+
|
|
253
|
+
relationship_score_factory = RelationshipScoreFactory(richart_burton, liz_taylor)
|
|
254
|
+
relationship_score = relationship_score_factory.get_relationship_score()
|
|
255
|
+
|
|
256
|
+
print("Richard Burton and Elizabeth Taylor relationship score:")
|
|
257
|
+
print(relationship_score.score_value)
|
|
258
|
+
print(relationship_score.score_description)
|
|
259
|
+
print(relationship_score.is_destiny_sign)
|
|
260
|
+
print(len(relationship_score.aspects))
|
|
261
|
+
print(len(relationship_score_factory._synastry_aspects))
|
|
262
|
+
|
|
263
|
+
print("------------------->")
|
|
264
|
+
dario_fo = AstrologicalSubject("Dario Fo", 1926, 3, 24, 12, 25, "Sangiano", "IT")
|
|
265
|
+
franca_rame = AstrologicalSubject("Franca Rame", 1929, 7, 18, 12, 25, "Parabiago", "IT")
|
|
266
|
+
|
|
267
|
+
relationship_score_factory = RelationshipScoreFactory(dario_fo, franca_rame)
|
|
268
|
+
relationship_score = relationship_score_factory.get_relationship_score()
|
|
269
|
+
|
|
270
|
+
print("Dario Fo and Franca Rame relationship score:")
|
|
271
|
+
print(relationship_score.score_value)
|
|
272
|
+
print(relationship_score.score_description)
|
|
273
|
+
print(relationship_score.is_destiny_sign)
|
|
274
|
+
print(len(relationship_score.aspects))
|
|
275
|
+
print(len(relationship_score_factory._synastry_aspects))
|
kerykeion/report.py
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
from kerykeion import AstrologicalSubject
|
|
2
2
|
from terminaltables import AsciiTable
|
|
3
|
+
from kerykeion.utilities import get_houses_list, get_available_planets_list
|
|
4
|
+
from typing import Union
|
|
5
|
+
from kerykeion.kr_types.kr_models import AstrologicalSubjectModel
|
|
3
6
|
|
|
4
7
|
class Report:
|
|
5
8
|
"""
|
|
@@ -11,7 +14,7 @@ class Report:
|
|
|
11
14
|
planets_table: str
|
|
12
15
|
houses_table: str
|
|
13
16
|
|
|
14
|
-
def __init__(self, instance: AstrologicalSubject):
|
|
17
|
+
def __init__(self, instance: Union[AstrologicalSubject, AstrologicalSubjectModel]):
|
|
15
18
|
self.instance = instance
|
|
16
19
|
|
|
17
20
|
self.get_report_title()
|
|
@@ -51,7 +54,7 @@ class Report:
|
|
|
51
54
|
("R" if planet.retrograde else "-"),
|
|
52
55
|
planet.house,
|
|
53
56
|
]
|
|
54
|
-
for planet in self.instance
|
|
57
|
+
for planet in get_available_planets_list(self.instance)
|
|
55
58
|
]
|
|
56
59
|
|
|
57
60
|
self.planets_table = AsciiTable(planets_data).table
|
|
@@ -62,7 +65,7 @@ class Report:
|
|
|
62
65
|
"""
|
|
63
66
|
|
|
64
67
|
houses_data = [["House", "Sign", "Position"]] + [
|
|
65
|
-
[house.name, house.sign, round(float(house.position), 2)] for house in self.instance
|
|
68
|
+
[house.name, house.sign, round(float(house.position), 2)] for house in get_houses_list(self.instance)
|
|
66
69
|
]
|
|
67
70
|
|
|
68
71
|
self.houses_table = AsciiTable(houses_data).table
|
|
@@ -11,7 +11,7 @@ from typing import Dict, Union
|
|
|
11
11
|
from kerykeion.kr_types import KerykeionSettingsModel
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
def get_settings(new_settings_file: Union[Path, None] = None) -> KerykeionSettingsModel:
|
|
14
|
+
def get_settings(new_settings_file: Union[Path, None, KerykeionSettingsModel, dict] = None) -> KerykeionSettingsModel:
|
|
15
15
|
"""
|
|
16
16
|
This function is used to get the settings dict from the settings file.
|
|
17
17
|
If no settings file is passed as argument, or the file is not found, it will fallback to:
|
|
@@ -25,6 +25,11 @@ def get_settings(new_settings_file: Union[Path, None] = None) -> KerykeionSettin
|
|
|
25
25
|
Dict: The settings dict
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
|
+
if isinstance(new_settings_file, dict):
|
|
29
|
+
return KerykeionSettingsModel(**new_settings_file)
|
|
30
|
+
elif isinstance(new_settings_file, KerykeionSettingsModel):
|
|
31
|
+
return new_settings_file
|
|
32
|
+
|
|
28
33
|
# Config path we passed as argument
|
|
29
34
|
if new_settings_file is not None:
|
|
30
35
|
settings_file = new_settings_file
|