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
|
@@ -0,0 +1,568 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
This is part of Kerykeion (C) 2025 Giacomo Battaglia
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import logging
|
|
7
|
+
from typing import Union, List, Optional
|
|
8
|
+
|
|
9
|
+
from kerykeion.astrological_subject_factory import AstrologicalSubjectFactory
|
|
10
|
+
from kerykeion.aspects.aspects_utils import get_aspect_from_two_points, get_active_points_list, calculate_aspect_movement
|
|
11
|
+
from kerykeion.schemas.kr_models import (
|
|
12
|
+
AstrologicalSubjectModel,
|
|
13
|
+
AspectModel,
|
|
14
|
+
ActiveAspect,
|
|
15
|
+
CompositeSubjectModel,
|
|
16
|
+
PlanetReturnModel,
|
|
17
|
+
SingleChartAspectsModel,
|
|
18
|
+
DualChartAspectsModel,
|
|
19
|
+
# Legacy aliases for backward compatibility
|
|
20
|
+
NatalAspectsModel,
|
|
21
|
+
SynastryAspectsModel
|
|
22
|
+
)
|
|
23
|
+
from kerykeion.schemas.kr_literals import AstrologicalPoint
|
|
24
|
+
from kerykeion.settings.config_constants import DEFAULT_ACTIVE_ASPECTS
|
|
25
|
+
from kerykeion.settings.chart_defaults import (
|
|
26
|
+
DEFAULT_CELESTIAL_POINTS_SETTINGS,
|
|
27
|
+
DEFAULT_CHART_ASPECTS_SETTINGS,
|
|
28
|
+
)
|
|
29
|
+
from kerykeion.utilities import find_common_active_points
|
|
30
|
+
|
|
31
|
+
# Axes constants for orb filtering
|
|
32
|
+
AXES_LIST = [
|
|
33
|
+
"Ascendant",
|
|
34
|
+
"Medium_Coeli",
|
|
35
|
+
"Descendant",
|
|
36
|
+
"Imum_Coeli",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class AspectsFactory:
|
|
41
|
+
"""
|
|
42
|
+
Unified factory class for creating both single chart and dual chart aspects analysis.
|
|
43
|
+
|
|
44
|
+
This factory provides methods to calculate all aspects within a single chart or
|
|
45
|
+
between two charts. It consolidates the common functionality between different
|
|
46
|
+
types of aspect calculations while providing specialized methods for each type.
|
|
47
|
+
|
|
48
|
+
The factory provides both comprehensive and filtered aspect lists based on orb settings
|
|
49
|
+
and relevance criteria.
|
|
50
|
+
|
|
51
|
+
Key Features:
|
|
52
|
+
- Calculates aspects within a single chart (natal, returns, composite, etc.)
|
|
53
|
+
- Calculates aspects between two charts (synastry, transits, comparisons, etc.)
|
|
54
|
+
- Filters aspects based on orb thresholds
|
|
55
|
+
- Applies stricter orb limits for chart axes (ASC, MC, DSC, IC)
|
|
56
|
+
- Supports multiple subject types (natal, composite, planetary returns)
|
|
57
|
+
|
|
58
|
+
Example:
|
|
59
|
+
>>> # For single chart aspects (natal, returns, etc.)
|
|
60
|
+
>>> johnny = AstrologicalSubjectFactory.from_birth_data("Johnny", 1963, 6, 9, 0, 0, "Owensboro", "US")
|
|
61
|
+
>>> single_chart_aspects = AspectsFactory.single_chart_aspects(johnny)
|
|
62
|
+
>>>
|
|
63
|
+
>>> # For dual chart aspects (synastry, comparisons, etc.)
|
|
64
|
+
>>> john = AstrologicalSubjectFactory.from_birth_data("John", 1990, 1, 1, 12, 0, "London", "GB")
|
|
65
|
+
>>> jane = AstrologicalSubjectFactory.from_birth_data("Jane", 1992, 6, 15, 14, 30, "Paris", "FR")
|
|
66
|
+
>>> dual_chart_aspects = AspectsFactory.dual_chart_aspects(john, jane)
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
@staticmethod
|
|
70
|
+
def single_chart_aspects(
|
|
71
|
+
subject: Union[AstrologicalSubjectModel, CompositeSubjectModel, PlanetReturnModel],
|
|
72
|
+
*,
|
|
73
|
+
active_points: Optional[List[AstrologicalPoint]] = None,
|
|
74
|
+
active_aspects: Optional[List[ActiveAspect]] = None,
|
|
75
|
+
axis_orb_limit: Optional[float] = None,
|
|
76
|
+
) -> SingleChartAspectsModel:
|
|
77
|
+
"""
|
|
78
|
+
Create aspects analysis for a single astrological chart.
|
|
79
|
+
|
|
80
|
+
This method calculates all astrological aspects (angular relationships)
|
|
81
|
+
within a single chart. Can be used for any type of chart including:
|
|
82
|
+
- Natal charts
|
|
83
|
+
- Planetary return charts
|
|
84
|
+
- Composite charts
|
|
85
|
+
- Any other single chart type
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
subject: The astrological subject for aspect calculation
|
|
89
|
+
|
|
90
|
+
Kwargs:
|
|
91
|
+
active_points: List of points to include in calculations
|
|
92
|
+
active_aspects: List of aspects with their orb settings
|
|
93
|
+
axis_orb_limit: Optional orb threshold applied to chart axes; when None, no special axis filter
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
SingleChartAspectsModel containing all calculated aspects data
|
|
97
|
+
|
|
98
|
+
Example:
|
|
99
|
+
>>> johnny = AstrologicalSubjectFactory.from_birth_data("Johnny", 1963, 6, 9, 0, 0, "Owensboro", "US")
|
|
100
|
+
>>> chart_aspects = AspectsFactory.single_chart_aspects(johnny)
|
|
101
|
+
>>> print(f"Found {len(chart_aspects.aspects)} aspects")
|
|
102
|
+
"""
|
|
103
|
+
# Initialize settings and configurations
|
|
104
|
+
celestial_points = DEFAULT_CELESTIAL_POINTS_SETTINGS
|
|
105
|
+
aspects_settings = DEFAULT_CHART_ASPECTS_SETTINGS
|
|
106
|
+
# Set active aspects with default fallback
|
|
107
|
+
active_aspects_resolved = active_aspects if active_aspects is not None else DEFAULT_ACTIVE_ASPECTS
|
|
108
|
+
|
|
109
|
+
# Determine active points to use
|
|
110
|
+
if active_points is None:
|
|
111
|
+
active_points_resolved = subject.active_points
|
|
112
|
+
else:
|
|
113
|
+
active_points_resolved = find_common_active_points(
|
|
114
|
+
subject.active_points,
|
|
115
|
+
active_points,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
return AspectsFactory._create_single_chart_aspects_model(
|
|
119
|
+
subject,
|
|
120
|
+
active_points_resolved,
|
|
121
|
+
active_aspects_resolved,
|
|
122
|
+
aspects_settings,
|
|
123
|
+
axis_orb_limit,
|
|
124
|
+
celestial_points,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
@staticmethod
|
|
128
|
+
def dual_chart_aspects(
|
|
129
|
+
first_subject: Union[AstrologicalSubjectModel, CompositeSubjectModel, PlanetReturnModel],
|
|
130
|
+
second_subject: Union[AstrologicalSubjectModel, CompositeSubjectModel, PlanetReturnModel],
|
|
131
|
+
*,
|
|
132
|
+
active_points: Optional[List[AstrologicalPoint]] = None,
|
|
133
|
+
active_aspects: Optional[List[ActiveAspect]] = None,
|
|
134
|
+
axis_orb_limit: Optional[float] = None,
|
|
135
|
+
) -> DualChartAspectsModel:
|
|
136
|
+
"""
|
|
137
|
+
Create aspects analysis between two astrological charts.
|
|
138
|
+
|
|
139
|
+
This method calculates all astrological aspects (angular relationships)
|
|
140
|
+
between planets and points in two different charts. Can be used for:
|
|
141
|
+
- Synastry (relationship compatibility)
|
|
142
|
+
- Transit comparisons
|
|
143
|
+
- Composite vs natal comparisons
|
|
144
|
+
- Any other dual chart analysis
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
first_subject: The first astrological subject
|
|
148
|
+
second_subject: The second astrological subject to compare with the first
|
|
149
|
+
|
|
150
|
+
Kwargs:
|
|
151
|
+
active_points: Optional list of celestial points to include in calculations.
|
|
152
|
+
If None, uses common points between both subjects.
|
|
153
|
+
active_aspects: Optional list of aspect types with their orb settings.
|
|
154
|
+
If None, uses default aspect configuration.
|
|
155
|
+
axis_orb_limit: Optional orb threshold for chart axes (applied to single chart calculations only)
|
|
156
|
+
|
|
157
|
+
Returns:
|
|
158
|
+
DualChartAspectsModel: Complete model containing all calculated aspects data,
|
|
159
|
+
including both comprehensive and filtered relevant aspects.
|
|
160
|
+
|
|
161
|
+
Example:
|
|
162
|
+
>>> john = AstrologicalSubjectFactory.from_birth_data("John", 1990, 1, 1, 12, 0, "London", "GB")
|
|
163
|
+
>>> jane = AstrologicalSubjectFactory.from_birth_data("Jane", 1992, 6, 15, 14, 30, "Paris", "FR")
|
|
164
|
+
>>> synastry = AspectsFactory.dual_chart_aspects(john, jane)
|
|
165
|
+
>>> print(f"Found {len(synastry.aspects)} aspects")
|
|
166
|
+
"""
|
|
167
|
+
# Initialize settings and configurations
|
|
168
|
+
celestial_points = DEFAULT_CELESTIAL_POINTS_SETTINGS
|
|
169
|
+
aspects_settings = DEFAULT_CHART_ASPECTS_SETTINGS
|
|
170
|
+
# Set active aspects with default fallback
|
|
171
|
+
active_aspects_resolved = active_aspects if active_aspects is not None else DEFAULT_ACTIVE_ASPECTS
|
|
172
|
+
|
|
173
|
+
# Determine active points to use - find common points between both subjects
|
|
174
|
+
if active_points is None:
|
|
175
|
+
active_points_resolved = first_subject.active_points
|
|
176
|
+
else:
|
|
177
|
+
active_points_resolved = find_common_active_points(
|
|
178
|
+
first_subject.active_points,
|
|
179
|
+
active_points,
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
# Further filter with second subject's active points
|
|
183
|
+
active_points_resolved = find_common_active_points(
|
|
184
|
+
second_subject.active_points,
|
|
185
|
+
active_points_resolved,
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
return AspectsFactory._create_dual_chart_aspects_model(
|
|
189
|
+
first_subject,
|
|
190
|
+
second_subject,
|
|
191
|
+
active_points_resolved,
|
|
192
|
+
active_aspects_resolved,
|
|
193
|
+
aspects_settings,
|
|
194
|
+
axis_orb_limit,
|
|
195
|
+
celestial_points,
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
@staticmethod
|
|
199
|
+
def _create_single_chart_aspects_model(
|
|
200
|
+
subject: Union[AstrologicalSubjectModel, CompositeSubjectModel, PlanetReturnModel],
|
|
201
|
+
active_points_resolved: List[AstrologicalPoint],
|
|
202
|
+
active_aspects_resolved: List[ActiveAspect],
|
|
203
|
+
aspects_settings: List[dict],
|
|
204
|
+
axis_orb_limit: Optional[float],
|
|
205
|
+
celestial_points: List[dict]
|
|
206
|
+
) -> SingleChartAspectsModel:
|
|
207
|
+
"""
|
|
208
|
+
Create the complete single chart aspects model with all calculations.
|
|
209
|
+
|
|
210
|
+
Returns:
|
|
211
|
+
SingleChartAspectsModel containing filtered aspects data
|
|
212
|
+
"""
|
|
213
|
+
all_aspects = AspectsFactory._calculate_single_chart_aspects(
|
|
214
|
+
subject, active_points_resolved, active_aspects_resolved, aspects_settings, celestial_points
|
|
215
|
+
)
|
|
216
|
+
filtered_aspects = AspectsFactory._filter_relevant_aspects(
|
|
217
|
+
all_aspects,
|
|
218
|
+
axis_orb_limit,
|
|
219
|
+
apply_axis_orb_filter=axis_orb_limit is not None,
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
return SingleChartAspectsModel(
|
|
223
|
+
subject=subject,
|
|
224
|
+
aspects=filtered_aspects,
|
|
225
|
+
active_points=active_points_resolved,
|
|
226
|
+
active_aspects=active_aspects_resolved,
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
@staticmethod
|
|
230
|
+
def _create_dual_chart_aspects_model(
|
|
231
|
+
first_subject: Union[AstrologicalSubjectModel, CompositeSubjectModel, PlanetReturnModel],
|
|
232
|
+
second_subject: Union[AstrologicalSubjectModel, CompositeSubjectModel, PlanetReturnModel],
|
|
233
|
+
active_points_resolved: List[AstrologicalPoint],
|
|
234
|
+
active_aspects_resolved: List[ActiveAspect],
|
|
235
|
+
aspects_settings: List[dict],
|
|
236
|
+
axis_orb_limit: Optional[float],
|
|
237
|
+
celestial_points: List[dict]
|
|
238
|
+
) -> DualChartAspectsModel:
|
|
239
|
+
"""
|
|
240
|
+
Create the complete dual chart aspects model with all calculations.
|
|
241
|
+
|
|
242
|
+
Args:
|
|
243
|
+
first_subject: First astrological subject
|
|
244
|
+
second_subject: Second astrological subject
|
|
245
|
+
active_points_resolved: Resolved list of active celestial points
|
|
246
|
+
active_aspects_resolved: Resolved list of active aspects with orbs
|
|
247
|
+
aspects_settings: Chart aspect configuration settings
|
|
248
|
+
axis_orb_limit: Orb threshold for chart axes
|
|
249
|
+
celestial_points: Celestial points configuration
|
|
250
|
+
|
|
251
|
+
Returns:
|
|
252
|
+
DualChartAspectsModel: Complete model containing filtered aspects data
|
|
253
|
+
"""
|
|
254
|
+
all_aspects = AspectsFactory._calculate_dual_chart_aspects(
|
|
255
|
+
first_subject, second_subject, active_points_resolved, active_aspects_resolved,
|
|
256
|
+
aspects_settings, celestial_points
|
|
257
|
+
)
|
|
258
|
+
filtered_aspects = AspectsFactory._filter_relevant_aspects(
|
|
259
|
+
all_aspects,
|
|
260
|
+
axis_orb_limit,
|
|
261
|
+
apply_axis_orb_filter=False,
|
|
262
|
+
)
|
|
263
|
+
|
|
264
|
+
return DualChartAspectsModel(
|
|
265
|
+
first_subject=first_subject,
|
|
266
|
+
second_subject=second_subject,
|
|
267
|
+
aspects=filtered_aspects,
|
|
268
|
+
active_points=active_points_resolved,
|
|
269
|
+
active_aspects=active_aspects_resolved,
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
@staticmethod
|
|
273
|
+
def _calculate_single_chart_aspects(
|
|
274
|
+
subject: Union[AstrologicalSubjectModel, CompositeSubjectModel, PlanetReturnModel],
|
|
275
|
+
active_points: List[AstrologicalPoint],
|
|
276
|
+
active_aspects: List[ActiveAspect],
|
|
277
|
+
aspects_settings: List[dict],
|
|
278
|
+
celestial_points: List[dict]
|
|
279
|
+
) -> List[AspectModel]:
|
|
280
|
+
"""
|
|
281
|
+
Calculate all aspects within a single chart.
|
|
282
|
+
|
|
283
|
+
This method handles all aspect calculations including settings updates,
|
|
284
|
+
opposite pair filtering, and planet ID resolution for single charts.
|
|
285
|
+
Works with any chart type (natal, return, composite, etc.).
|
|
286
|
+
|
|
287
|
+
Returns:
|
|
288
|
+
List of all calculated AspectModel instances
|
|
289
|
+
"""
|
|
290
|
+
active_points_list = get_active_points_list(subject, active_points)
|
|
291
|
+
|
|
292
|
+
# Update aspects settings with active aspects orbs
|
|
293
|
+
filtered_settings = AspectsFactory._update_aspect_settings(aspects_settings, active_aspects)
|
|
294
|
+
|
|
295
|
+
# Create a lookup dictionary for planet IDs to optimize performance
|
|
296
|
+
planet_id_lookup = {planet["name"]: planet["id"] for planet in celestial_points}
|
|
297
|
+
|
|
298
|
+
# Define opposite pairs that should be skipped for single chart aspects
|
|
299
|
+
opposite_pairs = {
|
|
300
|
+
("Ascendant", "Descendant"),
|
|
301
|
+
("Descendant", "Ascendant"),
|
|
302
|
+
("Medium_Coeli", "Imum_Coeli"),
|
|
303
|
+
("Imum_Coeli", "Medium_Coeli"),
|
|
304
|
+
("True_North_Lunar_Node", "True_South_Lunar_Node"),
|
|
305
|
+
("Mean_North_Lunar_Node", "Mean_South_Lunar_Node"),
|
|
306
|
+
("True_South_Lunar_Node", "True_North_Lunar_Node"),
|
|
307
|
+
("Mean_South_Lunar_Node", "Mean_North_Lunar_Node"),
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
all_aspects_list = []
|
|
311
|
+
|
|
312
|
+
for first in range(len(active_points_list)):
|
|
313
|
+
# Generate aspects list without repetitions (single chart - same chart)
|
|
314
|
+
for second in range(first + 1, len(active_points_list)):
|
|
315
|
+
# Skip predefined opposite pairs (AC/DC, MC/IC, North/South nodes)
|
|
316
|
+
first_name = active_points_list[first]["name"]
|
|
317
|
+
second_name = active_points_list[second]["name"]
|
|
318
|
+
|
|
319
|
+
if (first_name, second_name) in opposite_pairs:
|
|
320
|
+
continue
|
|
321
|
+
|
|
322
|
+
aspect = get_aspect_from_two_points(
|
|
323
|
+
filtered_settings,
|
|
324
|
+
active_points_list[first]["abs_pos"],
|
|
325
|
+
active_points_list[second]["abs_pos"]
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
if aspect["verdict"]:
|
|
329
|
+
# Get planet IDs using lookup dictionary for better performance
|
|
330
|
+
first_planet_id = planet_id_lookup.get(first_name, 0)
|
|
331
|
+
second_planet_id = planet_id_lookup.get(second_name, 0)
|
|
332
|
+
|
|
333
|
+
# Calculate aspect movement (applying/separating/exact)
|
|
334
|
+
aspect_movement = calculate_aspect_movement(
|
|
335
|
+
active_points_list[first]["abs_pos"],
|
|
336
|
+
active_points_list[second]["abs_pos"],
|
|
337
|
+
aspect["aspect_degrees"]
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
aspect_model = AspectModel(
|
|
341
|
+
p1_name=first_name,
|
|
342
|
+
p1_owner=subject.name,
|
|
343
|
+
p1_abs_pos=active_points_list[first]["abs_pos"],
|
|
344
|
+
p2_name=second_name,
|
|
345
|
+
p2_owner=subject.name,
|
|
346
|
+
p2_abs_pos=active_points_list[second]["abs_pos"],
|
|
347
|
+
aspect=aspect["name"],
|
|
348
|
+
orbit=aspect["orbit"],
|
|
349
|
+
aspect_degrees=aspect["aspect_degrees"],
|
|
350
|
+
diff=aspect["diff"],
|
|
351
|
+
p1=first_planet_id,
|
|
352
|
+
p2=second_planet_id,
|
|
353
|
+
aspect_movement=aspect_movement,
|
|
354
|
+
)
|
|
355
|
+
all_aspects_list.append(aspect_model)
|
|
356
|
+
|
|
357
|
+
return all_aspects_list
|
|
358
|
+
|
|
359
|
+
@staticmethod
|
|
360
|
+
def _calculate_dual_chart_aspects(
|
|
361
|
+
first_subject: Union[AstrologicalSubjectModel, CompositeSubjectModel, PlanetReturnModel],
|
|
362
|
+
second_subject: Union[AstrologicalSubjectModel, CompositeSubjectModel, PlanetReturnModel],
|
|
363
|
+
active_points: List[AstrologicalPoint],
|
|
364
|
+
active_aspects: List[ActiveAspect],
|
|
365
|
+
aspects_settings: List[dict],
|
|
366
|
+
celestial_points: List[dict]
|
|
367
|
+
) -> List[AspectModel]:
|
|
368
|
+
"""
|
|
369
|
+
Calculate all aspects between two charts.
|
|
370
|
+
|
|
371
|
+
This method performs comprehensive aspect calculations between all active points
|
|
372
|
+
of both subjects, applying the specified orb settings and creating detailed
|
|
373
|
+
aspect models with planet IDs and positional information.
|
|
374
|
+
Works with any chart types (synastry, transits, comparisons, etc.).
|
|
375
|
+
|
|
376
|
+
Args:
|
|
377
|
+
first_subject: First astrological subject
|
|
378
|
+
second_subject: Second astrological subject
|
|
379
|
+
active_points: List of celestial points to include in calculations
|
|
380
|
+
active_aspects: List of aspect types with their orb settings
|
|
381
|
+
aspects_settings: Base aspect configuration settings
|
|
382
|
+
celestial_points: Celestial points configuration with IDs
|
|
383
|
+
|
|
384
|
+
Returns:
|
|
385
|
+
List[AspectModel]: Complete list of all calculated aspect instances
|
|
386
|
+
"""
|
|
387
|
+
# Get active points lists for both subjects
|
|
388
|
+
first_active_points_list = get_active_points_list(first_subject, active_points)
|
|
389
|
+
second_active_points_list = get_active_points_list(second_subject, active_points)
|
|
390
|
+
|
|
391
|
+
# Create a lookup dictionary for planet IDs to optimize performance
|
|
392
|
+
planet_id_lookup = {planet["name"]: planet["id"] for planet in celestial_points}
|
|
393
|
+
|
|
394
|
+
# Update aspects settings with active aspects orbs
|
|
395
|
+
filtered_settings = AspectsFactory._update_aspect_settings(aspects_settings, active_aspects)
|
|
396
|
+
|
|
397
|
+
all_aspects_list = []
|
|
398
|
+
for first in range(len(first_active_points_list)):
|
|
399
|
+
# Generate aspects list between all points of first and second subjects
|
|
400
|
+
for second in range(len(second_active_points_list)):
|
|
401
|
+
aspect = get_aspect_from_two_points(
|
|
402
|
+
filtered_settings,
|
|
403
|
+
first_active_points_list[first]["abs_pos"],
|
|
404
|
+
second_active_points_list[second]["abs_pos"],
|
|
405
|
+
)
|
|
406
|
+
|
|
407
|
+
if aspect["verdict"]:
|
|
408
|
+
first_name = first_active_points_list[first]["name"]
|
|
409
|
+
second_name = second_active_points_list[second]["name"]
|
|
410
|
+
|
|
411
|
+
# Get planet IDs using lookup dictionary for better performance
|
|
412
|
+
first_planet_id = planet_id_lookup.get(first_name, 0)
|
|
413
|
+
second_planet_id = planet_id_lookup.get(second_name, 0)
|
|
414
|
+
|
|
415
|
+
# Calculate aspect movement (applying/separating/exact)
|
|
416
|
+
aspect_movement = calculate_aspect_movement(
|
|
417
|
+
first_active_points_list[first]["abs_pos"],
|
|
418
|
+
second_active_points_list[second]["abs_pos"],
|
|
419
|
+
aspect["aspect_degrees"]
|
|
420
|
+
)
|
|
421
|
+
|
|
422
|
+
aspect_model = AspectModel(
|
|
423
|
+
p1_name=first_name,
|
|
424
|
+
p1_owner=first_subject.name,
|
|
425
|
+
p1_abs_pos=first_active_points_list[first]["abs_pos"],
|
|
426
|
+
p2_name=second_name,
|
|
427
|
+
p2_owner=second_subject.name,
|
|
428
|
+
p2_abs_pos=second_active_points_list[second]["abs_pos"],
|
|
429
|
+
aspect=aspect["name"],
|
|
430
|
+
orbit=aspect["orbit"],
|
|
431
|
+
aspect_degrees=aspect["aspect_degrees"],
|
|
432
|
+
diff=aspect["diff"],
|
|
433
|
+
p1=first_planet_id,
|
|
434
|
+
p2=second_planet_id,
|
|
435
|
+
aspect_movement=aspect_movement,
|
|
436
|
+
)
|
|
437
|
+
all_aspects_list.append(aspect_model)
|
|
438
|
+
|
|
439
|
+
return all_aspects_list
|
|
440
|
+
|
|
441
|
+
@staticmethod
|
|
442
|
+
def _update_aspect_settings(
|
|
443
|
+
aspects_settings: List[dict],
|
|
444
|
+
active_aspects: List[ActiveAspect]
|
|
445
|
+
) -> List[dict]:
|
|
446
|
+
"""
|
|
447
|
+
Update aspects settings with active aspects orbs.
|
|
448
|
+
|
|
449
|
+
This is a common utility method used by both single chart and dual chart calculations.
|
|
450
|
+
|
|
451
|
+
Args:
|
|
452
|
+
aspects_settings: Base aspect settings
|
|
453
|
+
active_aspects: Active aspects with their orb configurations
|
|
454
|
+
|
|
455
|
+
Returns:
|
|
456
|
+
List of filtered and updated aspect settings
|
|
457
|
+
"""
|
|
458
|
+
filtered_settings = []
|
|
459
|
+
for aspect_setting in aspects_settings:
|
|
460
|
+
for active_aspect in active_aspects:
|
|
461
|
+
if aspect_setting["name"] == active_aspect["name"]:
|
|
462
|
+
aspect_setting = aspect_setting.copy() # Don't modify original
|
|
463
|
+
aspect_setting["orb"] = active_aspect["orb"]
|
|
464
|
+
filtered_settings.append(aspect_setting)
|
|
465
|
+
break
|
|
466
|
+
return filtered_settings
|
|
467
|
+
|
|
468
|
+
@staticmethod
|
|
469
|
+
def _filter_relevant_aspects(
|
|
470
|
+
all_aspects: List[AspectModel],
|
|
471
|
+
axis_orb_limit: Optional[float],
|
|
472
|
+
*,
|
|
473
|
+
apply_axis_orb_filter: bool,
|
|
474
|
+
) -> List[AspectModel]:
|
|
475
|
+
"""
|
|
476
|
+
Filter aspects based on orb thresholds for axes and comprehensive criteria.
|
|
477
|
+
|
|
478
|
+
This method consolidates all filtering logic including axes checks and orb thresholds
|
|
479
|
+
for both single chart and dual chart aspects in a single comprehensive filtering method.
|
|
480
|
+
|
|
481
|
+
Args:
|
|
482
|
+
all_aspects: Complete list of calculated aspects
|
|
483
|
+
axis_orb_limit: Optional orb threshold for axes aspects
|
|
484
|
+
apply_axis_orb_filter: Whether to apply the axis-specific orb filtering logic
|
|
485
|
+
|
|
486
|
+
Returns:
|
|
487
|
+
Filtered list of relevant aspects
|
|
488
|
+
"""
|
|
489
|
+
logging.debug("Calculating relevant aspects by filtering orbs...")
|
|
490
|
+
|
|
491
|
+
relevant_aspects = []
|
|
492
|
+
|
|
493
|
+
if not apply_axis_orb_filter or axis_orb_limit is None:
|
|
494
|
+
return list(all_aspects)
|
|
495
|
+
|
|
496
|
+
for aspect in all_aspects:
|
|
497
|
+
# Check if aspect involves any of the chart axes and apply stricter orb limits
|
|
498
|
+
aspect_involves_axes = (aspect.p1_name in AXES_LIST or aspect.p2_name in AXES_LIST)
|
|
499
|
+
|
|
500
|
+
if aspect_involves_axes and abs(aspect.orbit) >= axis_orb_limit:
|
|
501
|
+
continue
|
|
502
|
+
|
|
503
|
+
relevant_aspects.append(aspect)
|
|
504
|
+
|
|
505
|
+
return relevant_aspects
|
|
506
|
+
|
|
507
|
+
# Legacy methods for temporary backward compatibility
|
|
508
|
+
@staticmethod
|
|
509
|
+
def natal_aspects(
|
|
510
|
+
subject: Union[AstrologicalSubjectModel, CompositeSubjectModel, PlanetReturnModel],
|
|
511
|
+
*,
|
|
512
|
+
active_points: Optional[List[AstrologicalPoint]] = None,
|
|
513
|
+
active_aspects: Optional[List[ActiveAspect]] = None,
|
|
514
|
+
axis_orb_limit: Optional[float] = None,
|
|
515
|
+
) -> NatalAspectsModel:
|
|
516
|
+
"""
|
|
517
|
+
Legacy method - use single_chart_aspects() instead.
|
|
518
|
+
|
|
519
|
+
⚠️ DEPRECATION WARNING ⚠️
|
|
520
|
+
This method is deprecated. Use AspectsFactory.single_chart_aspects() instead.
|
|
521
|
+
"""
|
|
522
|
+
return AspectsFactory.single_chart_aspects(
|
|
523
|
+
subject,
|
|
524
|
+
active_points=active_points,
|
|
525
|
+
active_aspects=active_aspects,
|
|
526
|
+
axis_orb_limit=axis_orb_limit,
|
|
527
|
+
)
|
|
528
|
+
|
|
529
|
+
@staticmethod
|
|
530
|
+
def synastry_aspects(
|
|
531
|
+
first_subject: Union[AstrologicalSubjectModel, CompositeSubjectModel, PlanetReturnModel],
|
|
532
|
+
second_subject: Union[AstrologicalSubjectModel, CompositeSubjectModel, PlanetReturnModel],
|
|
533
|
+
*,
|
|
534
|
+
active_points: Optional[List[AstrologicalPoint]] = None,
|
|
535
|
+
active_aspects: Optional[List[ActiveAspect]] = None,
|
|
536
|
+
axis_orb_limit: Optional[float] = None,
|
|
537
|
+
) -> SynastryAspectsModel:
|
|
538
|
+
"""
|
|
539
|
+
Legacy method - use dual_chart_aspects() instead.
|
|
540
|
+
|
|
541
|
+
⚠️ DEPRECATION WARNING ⚠️
|
|
542
|
+
This method is deprecated. Use AspectsFactory.dual_chart_aspects() instead.
|
|
543
|
+
"""
|
|
544
|
+
return AspectsFactory.dual_chart_aspects(
|
|
545
|
+
first_subject,
|
|
546
|
+
second_subject,
|
|
547
|
+
active_points=active_points,
|
|
548
|
+
active_aspects=active_aspects,
|
|
549
|
+
axis_orb_limit=axis_orb_limit,
|
|
550
|
+
)
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
if __name__ == "__main__":
|
|
554
|
+
from kerykeion.utilities import setup_logging
|
|
555
|
+
|
|
556
|
+
setup_logging(level="debug")
|
|
557
|
+
|
|
558
|
+
# Test single chart aspects (replaces natal aspects)
|
|
559
|
+
johnny = AstrologicalSubjectFactory.from_birth_data("Johnny Depp", 1963, 6, 9, 0, 0, city="Owensboro", nation="US")
|
|
560
|
+
single_chart_aspects = AspectsFactory.single_chart_aspects(johnny)
|
|
561
|
+
print(f"Single chart aspects: {len(single_chart_aspects.aspects)}")
|
|
562
|
+
|
|
563
|
+
# Test dual chart aspects (replaces synastry aspects)
|
|
564
|
+
john = AstrologicalSubjectFactory.from_birth_data("John", 1940, 10, 9, 10, 30, "Liverpool", "GB")
|
|
565
|
+
yoko = AstrologicalSubjectFactory.from_birth_data("Yoko", 1933, 2, 18, 10, 30, "Tokyo", "JP")
|
|
566
|
+
dual_chart_aspects = AspectsFactory.dual_chart_aspects(john, yoko)
|
|
567
|
+
print(f"Dual chart aspects: {len(dual_chart_aspects.aspects)}")
|
|
568
|
+
|