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.

Files changed (75) hide show
  1. kerykeion/__init__.py +58 -141
  2. kerykeion/aspects/__init__.py +14 -0
  3. kerykeion/aspects/aspects_factory.py +568 -0
  4. kerykeion/aspects/aspects_utils.py +164 -0
  5. kerykeion/astrological_subject_factory.py +1901 -0
  6. kerykeion/backword.py +820 -0
  7. kerykeion/chart_data_factory.py +552 -0
  8. kerykeion/charts/__init__.py +5 -0
  9. kerykeion/charts/chart_drawer.py +2794 -0
  10. kerykeion/charts/charts_utils.py +1840 -0
  11. kerykeion/charts/draw_planets.py +658 -0
  12. kerykeion/charts/templates/aspect_grid_only.xml +596 -0
  13. kerykeion/charts/templates/chart.xml +741 -0
  14. kerykeion/charts/templates/wheel_only.xml +653 -0
  15. kerykeion/charts/themes/black-and-white.css +148 -0
  16. kerykeion/charts/themes/classic.css +113 -0
  17. kerykeion/charts/themes/dark-high-contrast.css +159 -0
  18. kerykeion/charts/themes/dark.css +160 -0
  19. kerykeion/charts/themes/light.css +160 -0
  20. kerykeion/charts/themes/strawberry.css +158 -0
  21. kerykeion/composite_subject_factory.py +408 -0
  22. kerykeion/ephemeris_data_factory.py +443 -0
  23. kerykeion/fetch_geonames.py +105 -61
  24. kerykeion/house_comparison/__init__.py +6 -0
  25. kerykeion/house_comparison/house_comparison_factory.py +103 -0
  26. kerykeion/house_comparison/house_comparison_utils.py +126 -0
  27. kerykeion/kr_types/__init__.py +70 -0
  28. kerykeion/kr_types/chart_template_model.py +20 -0
  29. kerykeion/kr_types/kerykeion_exception.py +20 -0
  30. kerykeion/kr_types/kr_literals.py +20 -0
  31. kerykeion/kr_types/kr_models.py +20 -0
  32. kerykeion/kr_types/settings_models.py +20 -0
  33. kerykeion/planetary_return_factory.py +805 -0
  34. kerykeion/relationship_score_factory.py +301 -0
  35. kerykeion/report.py +779 -0
  36. kerykeion/schemas/__init__.py +106 -0
  37. kerykeion/schemas/chart_template_model.py +367 -0
  38. kerykeion/schemas/kerykeion_exception.py +20 -0
  39. kerykeion/schemas/kr_literals.py +181 -0
  40. kerykeion/schemas/kr_models.py +603 -0
  41. kerykeion/schemas/settings_models.py +188 -0
  42. kerykeion/settings/__init__.py +20 -0
  43. kerykeion/settings/chart_defaults.py +444 -0
  44. kerykeion/settings/config_constants.py +152 -0
  45. kerykeion/settings/kerykeion_settings.py +51 -0
  46. kerykeion/settings/translation_strings.py +1499 -0
  47. kerykeion/settings/translations.py +74 -0
  48. kerykeion/sweph/README.md +3 -0
  49. kerykeion/sweph/ast136/s136108s.se1 +0 -0
  50. kerykeion/sweph/ast136/s136199s.se1 +0 -0
  51. kerykeion/sweph/ast136/s136472s.se1 +0 -0
  52. kerykeion/sweph/ast28/se28978s.se1 +0 -0
  53. kerykeion/sweph/ast50/se50000s.se1 +0 -0
  54. kerykeion/sweph/ast90/se90377s.se1 +0 -0
  55. kerykeion/sweph/ast90/se90482s.se1 +0 -0
  56. kerykeion/sweph/seas_18.se1 +0 -0
  57. kerykeion/sweph/sefstars.txt +1602 -0
  58. kerykeion/transits_time_range_factory.py +302 -0
  59. kerykeion/utilities.py +762 -130
  60. kerykeion-5.1.9.dist-info/METADATA +1793 -0
  61. kerykeion-5.1.9.dist-info/RECORD +63 -0
  62. {kerykeion-3.1.1.dist-info → kerykeion-5.1.9.dist-info}/WHEEL +1 -2
  63. kerykeion-5.1.9.dist-info/licenses/LICENSE +661 -0
  64. kerykeion/aspects.py +0 -331
  65. kerykeion/charts/charts_svg.py +0 -1607
  66. kerykeion/charts/templates/basic.xml +0 -285
  67. kerykeion/charts/templates/extended.xml +0 -294
  68. kerykeion/kr.config.json +0 -464
  69. kerykeion/main.py +0 -595
  70. kerykeion/print_all_data.py +0 -44
  71. kerykeion/relationship_score.py +0 -219
  72. kerykeion/types.py +0 -190
  73. kerykeion-3.1.1.dist-info/METADATA +0 -204
  74. kerykeion-3.1.1.dist-info/RECORD +0 -17
  75. kerykeion-3.1.1.dist-info/top_level.txt +0 -1
@@ -0,0 +1,302 @@
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.schemas: 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, Optional
59
+ from datetime import datetime, timedelta
60
+ from kerykeion.schemas.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.schemas.kr_literals import AstrologicalPoint
65
+ from kerykeion.schemas.kr_models import ActiveAspect, TransitMomentModel, TransitsTimeRangeModel
66
+ from kerykeion.schemas.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
+ axis_orb_limit (float | None, optional): Optional orb threshold applied to chart axes
101
+ during single-chart aspect calculations. Dual-chart calculations ignore this value.
102
+
103
+ Attributes:
104
+ natal_chart: The reference natal chart for transit calculations.
105
+ ephemeris_data_points: Time-series planetary position data.
106
+ active_points: Celestial bodies included in calculations.
107
+ active_aspects: Aspect types considered for analysis.
108
+ settings_file: Configuration settings for the calculations.
109
+ axis_orb_limit: Optional orb override used when calculating single-chart aspects.
110
+
111
+ Examples:
112
+ Basic transit calculation:
113
+
114
+ >>> natal_chart = AstrologicalSubjectFactory.from_birth_data(...)
115
+ >>> ephemeris_data = ephemeris_factory.get_ephemeris_data_as_astrological_subjects()
116
+ >>> factory = TransitsTimeRangeFactory(natal_chart, ephemeris_data)
117
+ >>> transits = factory.get_transit_moments()
118
+
119
+ Custom configuration:
120
+
121
+ >>> from kerykeion.schemas import AstrologicalPoint, ActiveAspect
122
+ >>> custom_points = ["Sun", "Moon"]
123
+ >>> custom_aspects = [ActiveAspect.CONJUNCTION, ActiveAspect.OPPOSITION]
124
+ >>> factory = TransitsTimeRangeFactory(
125
+ ... natal_chart, ephemeris_data,
126
+ ... active_points=custom_points,
127
+ ... active_aspects=custom_aspects
128
+ ... )
129
+
130
+ Note:
131
+ - Calculation time scales with the number of ephemeris data points
132
+ - More active points and aspects increase computational requirements
133
+ - The natal chart's coordinate system should match the ephemeris data
134
+ """
135
+
136
+ def __init__(
137
+ self,
138
+ natal_chart: AstrologicalSubjectModel,
139
+ ephemeris_data_points: List[AstrologicalSubjectModel],
140
+ active_points: List[AstrologicalPoint] = DEFAULT_ACTIVE_POINTS,
141
+ active_aspects: List[ActiveAspect] = DEFAULT_ACTIVE_ASPECTS,
142
+ settings_file: Union[Path, KerykeionSettingsModel, dict, None] = None,
143
+ *,
144
+ axis_orb_limit: Optional[float] = None,
145
+ ):
146
+ """
147
+ Initialize the TransitsTimeRangeFactory with calculation parameters.
148
+
149
+ Sets up the factory with all necessary data and configuration for calculating
150
+ transits across the specified time period. The natal chart serves as the
151
+ reference point, while ephemeris data points provide the transiting positions
152
+ for comparison.
153
+
154
+ Args:
155
+ natal_chart (AstrologicalSubjectModel): Reference natal chart containing
156
+ the baseline planetary positions for transit calculations.
157
+ ephemeris_data_points (List[AstrologicalSubjectModel]): Time-ordered list
158
+ of planetary positions representing different moments in time.
159
+ Typically generated by EphemerisDataFactory.
160
+ active_points (List[AstrologicalPoint], optional): Celestial bodies to
161
+ include in aspect calculations. Determines which planets/points are
162
+ analyzed for aspects. Defaults to DEFAULT_ACTIVE_POINTS.
163
+ active_aspects (List[ActiveAspect], optional): Types of angular relationships
164
+ to calculate between natal and transiting positions. Defaults to
165
+ DEFAULT_ACTIVE_ASPECTS.
166
+ settings_file (Union[Path, KerykeionSettingsModel, dict, None], optional):
167
+ Configuration settings for orb tolerances, calculation methods, and
168
+ other parameters. Defaults to None (uses system defaults).
169
+ axis_orb_limit (float | None, optional): Optional orb threshold for
170
+ chart axes applied during aspect calculations.
171
+
172
+ Note:
173
+ - All ephemeris data points should use the same coordinate system as the natal chart
174
+ - The order of ephemeris_data_points determines the chronological sequence
175
+ - Settings affect orb tolerances and calculation precision
176
+ """
177
+ self.natal_chart = natal_chart
178
+ self.ephemeris_data_points = ephemeris_data_points
179
+ self.active_points = active_points
180
+ self.active_aspects = active_aspects
181
+ self.settings_file = settings_file
182
+ self.axis_orb_limit = axis_orb_limit
183
+
184
+ def get_transit_moments(self) -> TransitsTimeRangeModel:
185
+ """
186
+ Calculate and generate transit data for all configured time points.
187
+
188
+ This method processes each ephemeris data point to identify angular relationships
189
+ (aspects) between transiting celestial bodies and natal chart positions. It
190
+ creates a comprehensive model containing all transit moments with their
191
+ corresponding aspects and timestamps.
192
+
193
+ The calculation process:
194
+ 1. Iterates through each ephemeris data point chronologically
195
+ 2. Compares transiting planetary positions with natal chart positions
196
+ 3. Identifies aspects that fall within the configured orb tolerances
197
+ 4. Creates timestamped transit moment records
198
+ 5. Compiles all data into a structured model for analysis
199
+
200
+ Returns:
201
+ TransitsTimeRangeModel: A comprehensive model containing:
202
+ - dates (List[str]): ISO-formatted datetime strings for all data points
203
+ - subject (AstrologicalSubjectModel): The natal chart used as reference
204
+ - transits (List[TransitMomentModel]): Chronological list of transit moments,
205
+ each containing:
206
+ * date (str): ISO-formatted timestamp for the transit moment
207
+ * aspects (List[RelevantAspect]): All aspects formed at this moment
208
+ between transiting and natal positions
209
+
210
+ Examples:
211
+ Basic usage:
212
+
213
+ >>> factory = TransitsTimeRangeFactory(natal_chart, ephemeris_data)
214
+ >>> results = factory.get_transit_moments()
215
+ >>>
216
+ >>> # Access specific data
217
+ >>> all_dates = results.dates
218
+ >>> first_transit = results.transits[0]
219
+ >>> aspects_at_first_moment = first_transit.aspects
220
+
221
+ Processing results:
222
+
223
+ >>> results = factory.get_transit_moments()
224
+ >>> for transit_moment in results.transits:
225
+ ... print(f"Date: {transit_moment.date}")
226
+ ... for aspect in transit_moment.aspects:
227
+ ... print(f" {aspect.p1_name} {aspect.aspect} {aspect.p2_name}")
228
+
229
+ Performance Notes:
230
+ - Calculation time is proportional to: number of time points × active points × active aspects
231
+ - Large datasets may require significant processing time
232
+ - Memory usage scales with the number of aspects found
233
+ - Consider filtering active_points and active_aspects for better performance
234
+
235
+ See Also:
236
+ TransitMomentModel: Individual transit moment structure
237
+ TransitsTimeRangeModel: Complete transit dataset structure
238
+ AspectsFactory: Underlying aspect calculation engine
239
+ """
240
+ transit_moments = []
241
+
242
+ for ephemeris_point in self.ephemeris_data_points:
243
+ # Calculate aspects between transit positions and natal chart
244
+ aspects = AspectsFactory.dual_chart_aspects(
245
+ ephemeris_point,
246
+ self.natal_chart,
247
+ active_points=self.active_points,
248
+ active_aspects=self.active_aspects,
249
+ axis_orb_limit=self.axis_orb_limit,
250
+ ).aspects
251
+
252
+ # Create a transit moment for this point in time
253
+ transit_moments.append(
254
+ TransitMomentModel(
255
+ date=ephemeris_point.iso_formatted_utc_datetime,
256
+ aspects=aspects,
257
+ )
258
+ )
259
+
260
+ # Create and return the complete transits model
261
+ return TransitsTimeRangeModel(
262
+ dates=[point.iso_formatted_utc_datetime for point in self.ephemeris_data_points],
263
+ subject=self.natal_chart,
264
+ transits=transit_moments
265
+ )
266
+
267
+
268
+ if __name__ == "__main__":
269
+ # Create a natal chart for the subject
270
+ person = AstrologicalSubjectFactory.from_birth_data(
271
+ "Johnny Depp", 1963, 6, 9, 20, 15, "Owensboro", "US"
272
+ )
273
+
274
+ # Define the time period for transit calculation
275
+ start_date = datetime.now()
276
+ end_date = datetime.now() + timedelta(days=30)
277
+
278
+ # Create ephemeris data for the specified time period
279
+ ephemeris_factory = EphemerisDataFactory(
280
+ start_datetime=start_date,
281
+ end_datetime=end_date,
282
+ step_type="days",
283
+ step=1,
284
+ lat=person.lat,
285
+ lng=person.lng,
286
+ tz_str=person.tz_str,
287
+ )
288
+
289
+ ephemeris_data_points = ephemeris_factory.get_ephemeris_data_as_astrological_subjects()
290
+
291
+ # Calculate transits for the subject
292
+ transit_factory = TransitsTimeRangeFactory(
293
+ natal_chart=person,
294
+ ephemeris_data_points=ephemeris_data_points,
295
+ )
296
+
297
+ transit_results = transit_factory.get_transit_moments()
298
+
299
+ # Print example data
300
+ print(transit_results.model_dump()["dates"][2])
301
+ print(transit_results.model_dump()["transits"][2]['date'])
302
+ print(transit_results.model_dump()["transits"][2]['aspects'][0])