kerykeion 5.0.0a10__py3-none-any.whl → 5.0.0a12__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.

Files changed (33) hide show
  1. kerykeion/__init__.py +4 -9
  2. kerykeion/aspects/__init__.py +2 -4
  3. kerykeion/aspects/aspects_factory.py +514 -0
  4. kerykeion/astrological_subject_factory.py +685 -79
  5. kerykeion/charts/draw_planets.py +584 -343
  6. kerykeion/charts/kerykeion_chart_svg.py +10 -16
  7. kerykeion/charts/templates/wheel_only.xml +1 -1
  8. kerykeion/composite_subject_factory.py +228 -9
  9. kerykeion/ephemeris_data_factory.py +431 -0
  10. kerykeion/fetch_geonames.py +27 -8
  11. kerykeion/house_comparison/house_comparison_factory.py +48 -15
  12. kerykeion/house_comparison/house_comparison_models.py +51 -13
  13. kerykeion/house_comparison/house_comparison_utils.py +35 -5
  14. kerykeion/kr_types/kerykeion_exception.py +6 -0
  15. kerykeion/kr_types/kr_models.py +82 -12
  16. kerykeion/planetary_return_factory.py +532 -32
  17. kerykeion/relationship_score_factory.py +98 -44
  18. kerykeion/report.py +7 -0
  19. kerykeion/sweph/sefstars.txt +1602 -0
  20. kerykeion/transits_time_range_factory.py +293 -0
  21. kerykeion/utilities.py +129 -67
  22. {kerykeion-5.0.0a10.dist-info → kerykeion-5.0.0a12.dist-info}/METADATA +49 -22
  23. kerykeion-5.0.0a12.dist-info/RECORD +50 -0
  24. kerykeion/aspects/natal_aspects_factory.py +0 -236
  25. kerykeion/aspects/synastry_aspects_factory.py +0 -234
  26. kerykeion/charts/draw_planets_v2.py +0 -648
  27. kerykeion/charts/draw_planets_v3.py +0 -679
  28. kerykeion/enums.py +0 -57
  29. kerykeion/ephemeris_data.py +0 -238
  30. kerykeion/transits_time_range.py +0 -128
  31. kerykeion-5.0.0a10.dist-info/RECORD +0 -53
  32. {kerykeion-5.0.0a10.dist-info → kerykeion-5.0.0a12.dist-info}/WHEEL +0 -0
  33. {kerykeion-5.0.0a10.dist-info → kerykeion-5.0.0a12.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,293 @@
1
+ """
2
+ Transits Time Range Factory Module
3
+
4
+ This module provides the TransitsTimeRangeFactory class for calculating astrological
5
+ transits over specified time periods. It compares ephemeris data points (planetary
6
+ positions at different times) with a natal chart to identify when celestial bodies
7
+ form specific angular relationships (aspects).
8
+
9
+ Key Features:
10
+ - Time-series transit calculations
11
+ - Configurable celestial points and aspect types
12
+ - Structured output models for data analysis
13
+ - Integration with ephemeris data generation
14
+ - Batch processing of multiple time points
15
+
16
+ The module generates comprehensive transit data by analyzing the angular relationships
17
+ between transiting celestial bodies and natal chart positions, creating timestamped
18
+ records of when specific geometric configurations occur.
19
+
20
+ Classes:
21
+ TransitsTimeRangeFactory: Main factory class for generating transit data
22
+
23
+ Dependencies:
24
+ - kerykeion.AstrologicalSubjectFactory: For creating astrological subjects
25
+ - kerykeion.aspects.AspectsFactory: For calculating angular relationships
26
+ - kerykeion.ephemeris_data_factory: For generating time-series planetary positions
27
+ - kerykeion.kr_types: For type definitions and model structures
28
+ - datetime: For date/time handling
29
+
30
+ Example:
31
+ Basic usage for calculating 30-day transits:
32
+
33
+ >>> from datetime import datetime, timedelta
34
+ >>> from kerykeion import AstrologicalSubjectFactory
35
+ >>> from kerykeion.ephemeris_data_factory import EphemerisDataFactory
36
+ >>> from kerykeion.transits_time_range_factory import TransitsTimeRangeFactory
37
+ >>>
38
+ >>> # Create natal chart
39
+ >>> person = AstrologicalSubjectFactory.from_birth_data(
40
+ ... "Subject", 1990, 1, 1, 12, 0, "New York", "US"
41
+ ... )
42
+ >>>
43
+ >>> # Generate ephemeris data
44
+ >>> start = datetime.now()
45
+ >>> end = start + timedelta(days=30)
46
+ >>> ephemeris_factory = EphemerisDataFactory(start, end)
47
+ >>> ephemeris_data = ephemeris_factory.get_ephemeris_data_as_astrological_subjects()
48
+ >>>
49
+ >>> # Calculate transits
50
+ >>> transit_factory = TransitsTimeRangeFactory(person, ephemeris_data)
51
+ >>> results = transit_factory.get_transit_moments()
52
+
53
+ Author: Giacomo Battaglia
54
+ Copyright: (C) 2025 Kerykeion Project
55
+ License: AGPL-3.0
56
+ """
57
+
58
+ from typing import Union, List
59
+ from datetime import datetime, timedelta
60
+ from kerykeion.kr_types.kr_models import AstrologicalSubjectModel
61
+ from kerykeion.astrological_subject_factory import AstrologicalSubjectFactory
62
+ from kerykeion.aspects import AspectsFactory
63
+ from kerykeion.ephemeris_data_factory import EphemerisDataFactory
64
+ from kerykeion.kr_types.kr_literals import AstrologicalPoint
65
+ from kerykeion.kr_types.kr_models import ActiveAspect, TransitMomentModel, TransitsTimeRangeModel
66
+ from kerykeion.kr_types.settings_models import KerykeionSettingsModel
67
+ from kerykeion.settings.config_constants import DEFAULT_ACTIVE_POINTS, DEFAULT_ACTIVE_ASPECTS
68
+ from pathlib import Path
69
+
70
+
71
+ class TransitsTimeRangeFactory:
72
+ """
73
+ Factory class for calculating astrological transits over time periods.
74
+
75
+ This class analyzes the angular relationships (aspects) between transiting
76
+ celestial bodies and natal chart positions across multiple time points,
77
+ generating structured transit data for astrological analysis.
78
+
79
+ The factory compares ephemeris data points (representing planetary positions
80
+ at different moments) with a natal chart to identify when specific geometric
81
+ configurations occur between transiting and natal celestial bodies.
82
+
83
+ Args:
84
+ natal_chart (AstrologicalSubjectModel): The natal chart used as the reference
85
+ point for transit calculations. All transiting positions are compared
86
+ against this chart's planetary positions.
87
+ ephemeris_data_points (List[AstrologicalSubjectModel]): A list of astrological
88
+ subject models representing different moments in time, typically generated
89
+ by EphemerisDataFactory. Each point contains planetary positions for
90
+ a specific date/time.
91
+ active_points (List[AstrologicalPoint], optional): List of celestial bodies
92
+ to include in aspect calculations (e.g., Sun, Moon, planets, asteroids).
93
+ Defaults to DEFAULT_ACTIVE_POINTS.
94
+ active_aspects (List[ActiveAspect], optional): List of aspect types to
95
+ calculate (e.g., conjunction, opposition, trine, square, sextile).
96
+ Defaults to DEFAULT_ACTIVE_ASPECTS.
97
+ settings_file (Union[Path, KerykeionSettingsModel, dict, None], optional):
98
+ Configuration settings for calculations. Can be a file path, settings
99
+ model, dictionary, or None for defaults. Defaults to None.
100
+
101
+ Attributes:
102
+ natal_chart: The reference natal chart for transit calculations.
103
+ ephemeris_data_points: Time-series planetary position data.
104
+ active_points: Celestial bodies included in calculations.
105
+ active_aspects: Aspect types considered for analysis.
106
+ settings_file: Configuration settings for the calculations.
107
+
108
+ Examples:
109
+ Basic transit calculation:
110
+
111
+ >>> natal_chart = AstrologicalSubjectFactory.from_birth_data(...)
112
+ >>> ephemeris_data = ephemeris_factory.get_ephemeris_data_as_astrological_subjects()
113
+ >>> factory = TransitsTimeRangeFactory(natal_chart, ephemeris_data)
114
+ >>> transits = factory.get_transit_moments()
115
+
116
+ Custom configuration:
117
+
118
+ >>> from kerykeion.kr_types import AstrologicalPoint, ActiveAspect
119
+ >>> custom_points = [AstrologicalPoint.SUN, AstrologicalPoint.MOON]
120
+ >>> custom_aspects = [ActiveAspect.CONJUNCTION, ActiveAspect.OPPOSITION]
121
+ >>> factory = TransitsTimeRangeFactory(
122
+ ... natal_chart, ephemeris_data,
123
+ ... active_points=custom_points,
124
+ ... active_aspects=custom_aspects
125
+ ... )
126
+
127
+ Note:
128
+ - Calculation time scales with the number of ephemeris data points
129
+ - More active points and aspects increase computational requirements
130
+ - The natal chart's coordinate system should match the ephemeris data
131
+ """
132
+
133
+ def __init__(
134
+ self,
135
+ natal_chart: AstrologicalSubjectModel,
136
+ ephemeris_data_points: List[AstrologicalSubjectModel],
137
+ active_points: List[AstrologicalPoint] = DEFAULT_ACTIVE_POINTS,
138
+ active_aspects: List[ActiveAspect] = DEFAULT_ACTIVE_ASPECTS,
139
+ settings_file: Union[Path, KerykeionSettingsModel, dict, None] = None,
140
+ ):
141
+ """
142
+ Initialize the TransitsTimeRangeFactory with calculation parameters.
143
+
144
+ Sets up the factory with all necessary data and configuration for calculating
145
+ transits across the specified time period. The natal chart serves as the
146
+ reference point, while ephemeris data points provide the transiting positions
147
+ for comparison.
148
+
149
+ Args:
150
+ natal_chart (AstrologicalSubjectModel): Reference natal chart containing
151
+ the baseline planetary positions for transit calculations.
152
+ ephemeris_data_points (List[AstrologicalSubjectModel]): Time-ordered list
153
+ of planetary positions representing different moments in time.
154
+ Typically generated by EphemerisDataFactory.
155
+ active_points (List[AstrologicalPoint], optional): Celestial bodies to
156
+ include in aspect calculations. Determines which planets/points are
157
+ analyzed for aspects. Defaults to DEFAULT_ACTIVE_POINTS.
158
+ active_aspects (List[ActiveAspect], optional): Types of angular relationships
159
+ to calculate between natal and transiting positions. Defaults to
160
+ DEFAULT_ACTIVE_ASPECTS.
161
+ settings_file (Union[Path, KerykeionSettingsModel, dict, None], optional):
162
+ Configuration settings for orb tolerances, calculation methods, and
163
+ other parameters. Defaults to None (uses system defaults).
164
+
165
+ Note:
166
+ - All ephemeris data points should use the same coordinate system as the natal chart
167
+ - The order of ephemeris_data_points determines the chronological sequence
168
+ - Settings affect orb tolerances and calculation precision
169
+ """
170
+ self.natal_chart = natal_chart
171
+ self.ephemeris_data_points = ephemeris_data_points
172
+ self.active_points = active_points
173
+ self.active_aspects = active_aspects
174
+ self.settings_file = settings_file
175
+
176
+ def get_transit_moments(self) -> TransitsTimeRangeModel:
177
+ """
178
+ Calculate and generate transit data for all configured time points.
179
+
180
+ This method processes each ephemeris data point to identify angular relationships
181
+ (aspects) between transiting celestial bodies and natal chart positions. It
182
+ creates a comprehensive model containing all transit moments with their
183
+ corresponding aspects and timestamps.
184
+
185
+ The calculation process:
186
+ 1. Iterates through each ephemeris data point chronologically
187
+ 2. Compares transiting planetary positions with natal chart positions
188
+ 3. Identifies aspects that fall within the configured orb tolerances
189
+ 4. Creates timestamped transit moment records
190
+ 5. Compiles all data into a structured model for analysis
191
+
192
+ Returns:
193
+ TransitsTimeRangeModel: A comprehensive model containing:
194
+ - dates (List[str]): ISO-formatted datetime strings for all data points
195
+ - subject (AstrologicalSubjectModel): The natal chart used as reference
196
+ - transits (List[TransitMomentModel]): Chronological list of transit moments,
197
+ each containing:
198
+ * date (str): ISO-formatted timestamp for the transit moment
199
+ * aspects (List[RelevantAspect]): All aspects formed at this moment
200
+ between transiting and natal positions
201
+
202
+ Examples:
203
+ Basic usage:
204
+
205
+ >>> factory = TransitsTimeRangeFactory(natal_chart, ephemeris_data)
206
+ >>> results = factory.get_transit_moments()
207
+ >>>
208
+ >>> # Access specific data
209
+ >>> all_dates = results.dates
210
+ >>> first_transit = results.transits[0]
211
+ >>> aspects_at_first_moment = first_transit.aspects
212
+
213
+ Processing results:
214
+
215
+ >>> results = factory.get_transit_moments()
216
+ >>> for transit_moment in results.transits:
217
+ ... print(f"Date: {transit_moment.date}")
218
+ ... for aspect in transit_moment.aspects:
219
+ ... print(f" {aspect.p1_name} {aspect.aspect} {aspect.p2_name}")
220
+
221
+ Performance Notes:
222
+ - Calculation time is proportional to: number of time points × active points × active aspects
223
+ - Large datasets may require significant processing time
224
+ - Memory usage scales with the number of aspects found
225
+ - Consider filtering active_points and active_aspects for better performance
226
+
227
+ See Also:
228
+ TransitMomentModel: Individual transit moment structure
229
+ TransitsTimeRangeModel: Complete transit dataset structure
230
+ AspectsFactory: Underlying aspect calculation engine
231
+ """
232
+ transit_moments = []
233
+
234
+ for ephemeris_point in self.ephemeris_data_points:
235
+ # Calculate aspects between transit positions and natal chart
236
+ aspects = AspectsFactory.dual_chart_aspects(
237
+ ephemeris_point,
238
+ self.natal_chart,
239
+ active_points=self.active_points,
240
+ active_aspects=self.active_aspects,
241
+ ).relevant_aspects
242
+
243
+ # Create a transit moment for this point in time
244
+ transit_moments.append(
245
+ TransitMomentModel(
246
+ date=ephemeris_point.iso_formatted_utc_datetime,
247
+ aspects=aspects,
248
+ )
249
+ )
250
+
251
+ # Create and return the complete transits model
252
+ return TransitsTimeRangeModel(
253
+ dates=[point.iso_formatted_utc_datetime for point in self.ephemeris_data_points],
254
+ subject=self.natal_chart,
255
+ transits=transit_moments
256
+ )
257
+
258
+
259
+ if __name__ == "__main__":
260
+ # Create a natal chart for the subject
261
+ person = AstrologicalSubjectFactory.from_birth_data(
262
+ "Johnny Depp", 1963, 6, 9, 20, 15, "Owensboro", "US"
263
+ )
264
+
265
+ # Define the time period for transit calculation
266
+ start_date = datetime.now()
267
+ end_date = datetime.now() + timedelta(days=30)
268
+
269
+ # Create ephemeris data for the specified time period
270
+ ephemeris_factory = EphemerisDataFactory(
271
+ start_datetime=start_date,
272
+ end_datetime=end_date,
273
+ step_type="days",
274
+ step=1,
275
+ lat=person.lat,
276
+ lng=person.lng,
277
+ tz_str=person.tz_str,
278
+ )
279
+
280
+ ephemeris_data_points = ephemeris_factory.get_ephemeris_data_as_astrological_subjects()
281
+
282
+ # Calculate transits for the subject
283
+ transit_factory = TransitsTimeRangeFactory(
284
+ natal_chart=person,
285
+ ephemeris_data_points=ephemeris_data_points,
286
+ )
287
+
288
+ transit_results = transit_factory.get_transit_moments()
289
+
290
+ # Print example data
291
+ print(transit_results.model_dump()["dates"][2])
292
+ print(transit_results.model_dump()["transits"][2]['date'])
293
+ print(transit_results.model_dump()["transits"][2]['aspects'][0])