kerykeion 4.6.2__py3-none-any.whl → 4.8.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/astrological_subject.py +5 -5
- kerykeion/charts/charts_utils.py +256 -18
- kerykeion/charts/kerykeion_chart_svg.py +236 -299
- kerykeion/charts/templates/chart.xml +39 -12
- kerykeion/kr_types/chart_types.py +11 -1
- kerykeion/kr_types/settings_models.py +1 -3
- {kerykeion-4.6.2.dist-info → kerykeion-4.8.0.dist-info}/METADATA +2 -1
- {kerykeion-4.6.2.dist-info → kerykeion-4.8.0.dist-info}/RECORD +11 -11
- {kerykeion-4.6.2.dist-info → kerykeion-4.8.0.dist-info}/LICENSE +0 -0
- {kerykeion-4.6.2.dist-info → kerykeion-4.8.0.dist-info}/WHEEL +0 -0
- {kerykeion-4.6.2.dist-info → kerykeion-4.8.0.dist-info}/entry_points.txt +0 -0
|
@@ -170,7 +170,7 @@ class AstrologicalSubject:
|
|
|
170
170
|
|
|
171
171
|
# This message is set to encourage the user to set a custom geonames username
|
|
172
172
|
if geonames_username is None and online:
|
|
173
|
-
logging.
|
|
173
|
+
logging.warning(
|
|
174
174
|
"\n"
|
|
175
175
|
"********" +
|
|
176
176
|
"\n" +
|
|
@@ -191,19 +191,19 @@ class AstrologicalSubject:
|
|
|
191
191
|
|
|
192
192
|
if not self.city:
|
|
193
193
|
self.city = "London"
|
|
194
|
-
logging.
|
|
194
|
+
logging.info("No city specified, using London as default")
|
|
195
195
|
|
|
196
196
|
if not self.nation:
|
|
197
197
|
self.nation = "GB"
|
|
198
|
-
logging.
|
|
198
|
+
logging.info("No nation specified, using GB as default")
|
|
199
199
|
|
|
200
200
|
if not self.lat:
|
|
201
201
|
self.lat = 51.5074
|
|
202
|
-
logging.
|
|
202
|
+
logging.info("No latitude specified, using London as default")
|
|
203
203
|
|
|
204
204
|
if not self.lng:
|
|
205
205
|
self.lng = 0
|
|
206
|
-
logging.
|
|
206
|
+
logging.info("No longitude specified, using London as default")
|
|
207
207
|
|
|
208
208
|
if (not self.online) and (not tz_str):
|
|
209
209
|
raise KerykeionException(
|
kerykeion/charts/charts_utils.py
CHANGED
|
@@ -3,6 +3,7 @@ import datetime
|
|
|
3
3
|
from kerykeion.kr_types import KerykeionException, ChartType
|
|
4
4
|
from typing import Union
|
|
5
5
|
|
|
6
|
+
|
|
6
7
|
def decHourJoin(inH: int, inM: int, inS: int) -> float:
|
|
7
8
|
"""Join hour, minutes, seconds, timezone integer to hour float.
|
|
8
9
|
|
|
@@ -20,6 +21,7 @@ def decHourJoin(inH: int, inM: int, inS: int) -> float:
|
|
|
20
21
|
output = dh + dm + ds
|
|
21
22
|
return output
|
|
22
23
|
|
|
24
|
+
|
|
23
25
|
def degreeDiff(a: Union[int, float], b: Union[int, float]) -> float:
|
|
24
26
|
"""Calculate the difference between two degrees.
|
|
25
27
|
|
|
@@ -40,6 +42,7 @@ def degreeDiff(a: Union[int, float], b: Union[int, float]) -> float:
|
|
|
40
42
|
out = 360.0 - out
|
|
41
43
|
return out
|
|
42
44
|
|
|
45
|
+
|
|
43
46
|
def offsetToTz(datetime_offset: Union[datetime.timedelta, None]) -> float:
|
|
44
47
|
"""Convert datetime offset to float in hours.
|
|
45
48
|
|
|
@@ -61,9 +64,9 @@ def offsetToTz(datetime_offset: Union[datetime.timedelta, None]) -> float:
|
|
|
61
64
|
output = dh + sh
|
|
62
65
|
return output
|
|
63
66
|
|
|
67
|
+
|
|
64
68
|
def sliceToX(slice: Union[int, float], radius: Union[int, float], offset: Union[int, float]) -> float:
|
|
65
|
-
"""
|
|
66
|
-
Calculates the x-coordinate of a point on a circle based on the slice, radius, and offset.
|
|
69
|
+
"""Calculates the x-coordinate of a point on a circle based on the slice, radius, and offset.
|
|
67
70
|
|
|
68
71
|
Args:
|
|
69
72
|
- slice (int | float): Represents the
|
|
@@ -86,9 +89,9 @@ def sliceToX(slice: Union[int, float], radius: Union[int, float], offset: Union[
|
|
|
86
89
|
radial = ((math.pi / 6) * slice) + plus
|
|
87
90
|
return radius * (math.cos(radial) + 1)
|
|
88
91
|
|
|
92
|
+
|
|
89
93
|
def sliceToY(slice: Union[int, float], r: Union[int, float], offset: Union[int, float]) -> float:
|
|
90
|
-
"""
|
|
91
|
-
Calculates the y-coordinate of a point on a circle based on the slice, radius, and offset.
|
|
94
|
+
"""Calculates the y-coordinate of a point on a circle based on the slice, radius, and offset.
|
|
92
95
|
|
|
93
96
|
Args:
|
|
94
97
|
- slice (int | float): Represents the slice of the circle to calculate
|
|
@@ -111,22 +114,21 @@ def sliceToY(slice: Union[int, float], r: Union[int, float], offset: Union[int,
|
|
|
111
114
|
|
|
112
115
|
|
|
113
116
|
def draw_zodiac_slice(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
"""
|
|
123
|
-
Draws a zodiac slice based on the given parameters.
|
|
117
|
+
c1: Union[int, float],
|
|
118
|
+
chart_type: ChartType,
|
|
119
|
+
seventh_house_degree_ut: Union[int, float],
|
|
120
|
+
num: int,
|
|
121
|
+
r: Union[int, float],
|
|
122
|
+
style: str,
|
|
123
|
+
type: str,
|
|
124
|
+
) -> str:
|
|
125
|
+
"""Draws a zodiac slice based on the given parameters.
|
|
124
126
|
|
|
125
127
|
Args:
|
|
126
128
|
- c1 (Union[int, float]): The value of c1.
|
|
127
129
|
- chart_type (Literal["Natal", "ExternalNatal", "Synastry", "Transit"]): The type of chart.
|
|
128
|
-
-
|
|
129
|
-
- num (int): The number of the sign. Note: In OpenAstro it did refer to self.zodiac,
|
|
130
|
+
- seventh_house_degree_ut (Union[int, float]): The degree of the seventh house.
|
|
131
|
+
- num (int): The number of the sign. Note: In OpenAstro it did refer to self.zodiac,
|
|
130
132
|
which is a list of the signs in order, starting with Aries. Eg:
|
|
131
133
|
{"name": "aries", "element": "fire"}
|
|
132
134
|
- r (Union[int, float]): The value of r.
|
|
@@ -139,7 +141,7 @@ def draw_zodiac_slice(
|
|
|
139
141
|
"""
|
|
140
142
|
|
|
141
143
|
# pie slices
|
|
142
|
-
offset = 360 -
|
|
144
|
+
offset = 360 - seventh_house_degree_ut
|
|
143
145
|
# check transit
|
|
144
146
|
if chart_type == "Transit" or chart_type == "Synastry":
|
|
145
147
|
dropin = 0
|
|
@@ -156,4 +158,240 @@ def draw_zodiac_slice(
|
|
|
156
158
|
dropin = 18 + c1
|
|
157
159
|
sign = f'<g transform="translate(-16,-16)"><use x="{str(dropin + sliceToX(num, r - dropin, offset))}" y="{str(dropin + sliceToY(num, r - dropin, offset))}" xlink:href="#{type}" /></g>'
|
|
158
160
|
|
|
159
|
-
return slice + "" + sign
|
|
161
|
+
return slice + "" + sign
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def convert_latitude_coordinate_to_string(coord: Union[int, float], north_label: str, south_label: str) -> str:
|
|
165
|
+
"""Converts a floating point latitude to string with
|
|
166
|
+
degree, minutes and seconds and the appropriate sign
|
|
167
|
+
(north or south). Eg. 52.1234567 -> 52°7'25" N
|
|
168
|
+
|
|
169
|
+
Args:
|
|
170
|
+
- coord (float | int): latitude in floating or integer format
|
|
171
|
+
- north_label (str): String label for north
|
|
172
|
+
- south_label (str): String label for south
|
|
173
|
+
Returns:
|
|
174
|
+
- str: latitude in string format with degree, minutes,
|
|
175
|
+
seconds and sign (N/S)
|
|
176
|
+
"""
|
|
177
|
+
|
|
178
|
+
sign = north_label
|
|
179
|
+
if coord < 0.0:
|
|
180
|
+
sign = south_label
|
|
181
|
+
coord = abs(coord)
|
|
182
|
+
deg = int(coord)
|
|
183
|
+
min = int((float(coord) - deg) * 60)
|
|
184
|
+
sec = int(round(float(((float(coord) - deg) * 60) - min) * 60.0))
|
|
185
|
+
return f"{deg}°{min}'{sec}\" {sign}"
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def convert_longitude_coordinate_to_string(coord: Union[int, float], east_label: str, west_label: str) -> str:
|
|
189
|
+
"""Converts a floating point longitude to string with
|
|
190
|
+
degree, minutes and seconds and the appropriate sign
|
|
191
|
+
(east or west). Eg. 52.1234567 -> 52°7'25" E
|
|
192
|
+
|
|
193
|
+
Args:
|
|
194
|
+
- coord (float|int): longitude in floating point format
|
|
195
|
+
- east_label (str): String label for east
|
|
196
|
+
- west_label (str): String label for west
|
|
197
|
+
Returns:
|
|
198
|
+
str: longitude in string format with degree, minutes,
|
|
199
|
+
seconds and sign (E/W)
|
|
200
|
+
"""
|
|
201
|
+
|
|
202
|
+
sign = east_label
|
|
203
|
+
if coord < 0.0:
|
|
204
|
+
sign = west_label
|
|
205
|
+
coord = abs(coord)
|
|
206
|
+
deg = int(coord)
|
|
207
|
+
min = int((float(coord) - deg) * 60)
|
|
208
|
+
sec = int(round(float(((float(coord) - deg) * 60) - min) * 60.0))
|
|
209
|
+
return f"{deg}°{min}'{sec}\" {sign}"
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def draw_aspect_line(
|
|
213
|
+
r: Union[int, float],
|
|
214
|
+
ar: Union[int, float],
|
|
215
|
+
degA: Union[int, float],
|
|
216
|
+
degB: Union[int, float],
|
|
217
|
+
color: str,
|
|
218
|
+
seventh_house_degree_ut: Union[int, float],
|
|
219
|
+
) -> str:
|
|
220
|
+
"""Draws svg aspects: ring, aspect ring, degreeA degreeB
|
|
221
|
+
|
|
222
|
+
Args:
|
|
223
|
+
- r (Union[int, float]): The value of r.
|
|
224
|
+
- ar (Union[int, float]): The value of ar.
|
|
225
|
+
- degA (Union[int, float]): The degree of A.
|
|
226
|
+
- degB (Union[int, float]): The degree of B.
|
|
227
|
+
- color (str): The color of the aspect.
|
|
228
|
+
- seventh_house_degree_ut (Union[int, float]): The degree of the seventh house.
|
|
229
|
+
|
|
230
|
+
Returns:
|
|
231
|
+
str: The SVG line element as a string.
|
|
232
|
+
"""
|
|
233
|
+
|
|
234
|
+
first_offset = (int(seventh_house_degree_ut) / -1) + int(degA)
|
|
235
|
+
x1 = sliceToX(0, ar, first_offset) + (r - ar)
|
|
236
|
+
y1 = sliceToY(0, ar, first_offset) + (r - ar)
|
|
237
|
+
|
|
238
|
+
second_offset = (int(seventh_house_degree_ut) / -1) + int(degB)
|
|
239
|
+
x2 = sliceToX(0, ar, second_offset) + (r - ar)
|
|
240
|
+
y2 = sliceToY(0, ar, second_offset) + (r - ar)
|
|
241
|
+
|
|
242
|
+
out = f'<line class="aspect" x1="{x1}" y1="{y1}" x2="{x2}" y2="{y2}" style="stroke: {color}; stroke-width: 1; stroke-opacity: .9;"/>'
|
|
243
|
+
|
|
244
|
+
return out
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def draw_elements_percentages(
|
|
248
|
+
fire_label: str,
|
|
249
|
+
fire_points: float,
|
|
250
|
+
earth_label: str,
|
|
251
|
+
earth_points: float,
|
|
252
|
+
air_label: str,
|
|
253
|
+
air_points: float,
|
|
254
|
+
water_label: str,
|
|
255
|
+
water_points: float,
|
|
256
|
+
) -> str:
|
|
257
|
+
"""Draw the elements grid.
|
|
258
|
+
|
|
259
|
+
Args:
|
|
260
|
+
- fire_label (str): Label for fire
|
|
261
|
+
- fire_points (float): Points for fire
|
|
262
|
+
- earth_label (str): Label for earth
|
|
263
|
+
- earth_points (float): Points for earth
|
|
264
|
+
- air_label (str): Label for air
|
|
265
|
+
- air_points (float): Points for air
|
|
266
|
+
- water_label (str): Label for water
|
|
267
|
+
- water_points (float): Points for water
|
|
268
|
+
|
|
269
|
+
Returns:
|
|
270
|
+
str: The SVG elements grid as a string.
|
|
271
|
+
"""
|
|
272
|
+
total = fire_points + earth_points + air_points + water_points
|
|
273
|
+
|
|
274
|
+
fire_percentage = int(round(100 * fire_points / total))
|
|
275
|
+
earth_percentage = int(round(100 * earth_points / total))
|
|
276
|
+
air_percentage = int(round(100 * air_points / total))
|
|
277
|
+
water_percentage = int(round(100 * water_points / total))
|
|
278
|
+
|
|
279
|
+
out = '<g transform="translate(-30,79)">'
|
|
280
|
+
out += f'<text y="0" style="fill:#ff6600; font-size: 10px;">{fire_label} {str(fire_percentage)}%</text>'
|
|
281
|
+
out += f'<text y="12" style="fill:#6a2d04; font-size: 10px;">{earth_label} {str(earth_percentage)}%</text>'
|
|
282
|
+
out += f'<text y="24" style="fill:#6f76d1; font-size: 10px;">{air_label} {str(air_percentage)}%</text>'
|
|
283
|
+
out += f'<text y="36" style="fill:#630e73; font-size: 10px;">{water_label} {str(water_percentage)}%</text>'
|
|
284
|
+
out += "</g>"
|
|
285
|
+
|
|
286
|
+
return out
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
def convert_decimal_to_degree_string(dec: float, type="3") -> str:
|
|
290
|
+
"""
|
|
291
|
+
Coverts decimal float to degrees in format a°b'c".
|
|
292
|
+
|
|
293
|
+
Args:
|
|
294
|
+
- dec (float): decimal float
|
|
295
|
+
- type (str): type of format:
|
|
296
|
+
- 1: a°
|
|
297
|
+
- 2: a°b'
|
|
298
|
+
- 3: a°b'c"
|
|
299
|
+
|
|
300
|
+
Returns:
|
|
301
|
+
str: degrees in format a°b'c"
|
|
302
|
+
"""
|
|
303
|
+
|
|
304
|
+
dec = float(dec)
|
|
305
|
+
a = int(dec)
|
|
306
|
+
a_new = (dec - float(a)) * 60.0
|
|
307
|
+
b_rounded = int(round(a_new))
|
|
308
|
+
b = int(a_new)
|
|
309
|
+
c = int(round((a_new - float(b)) * 60.0))
|
|
310
|
+
|
|
311
|
+
if type == "3":
|
|
312
|
+
out = f"{a:02d}°{b:02d}'{c:02d}""
|
|
313
|
+
elif type == "2":
|
|
314
|
+
out = f"{a:02d}°{b_rounded:02d}'"
|
|
315
|
+
elif type == "1":
|
|
316
|
+
out = f"{a:02d}°"
|
|
317
|
+
else:
|
|
318
|
+
raise KerykeionException(f"Wrong type: {type}, it must be 1, 2 or 3.")
|
|
319
|
+
|
|
320
|
+
return str(out)
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
def draw_transit_ring_degree_steps(r: Union[int, float], seventh_house_degree_ut: Union[int, float]) -> str:
|
|
324
|
+
"""Draws the transit ring degree steps.
|
|
325
|
+
|
|
326
|
+
Args:
|
|
327
|
+
- r (Union[int, float]): The value of r.
|
|
328
|
+
- seventh_house_degree_ut (Union[int, float]): The degree of the seventh house.
|
|
329
|
+
|
|
330
|
+
Returns:
|
|
331
|
+
str: The SVG path of the transit ring degree steps.
|
|
332
|
+
"""
|
|
333
|
+
|
|
334
|
+
out = '<g id="transitRingDegreeSteps">'
|
|
335
|
+
for i in range(72):
|
|
336
|
+
offset = float(i * 5) - seventh_house_degree_ut
|
|
337
|
+
if offset < 0:
|
|
338
|
+
offset = offset + 360.0
|
|
339
|
+
elif offset > 360:
|
|
340
|
+
offset = offset - 360.0
|
|
341
|
+
x1 = sliceToX(0, r, offset)
|
|
342
|
+
y1 = sliceToY(0, r, offset)
|
|
343
|
+
x2 = sliceToX(0, r + 2, offset) - 2
|
|
344
|
+
y2 = sliceToY(0, r + 2, offset) - 2
|
|
345
|
+
out += f'<line x1="{x1}" y1="{y1}" x2="{x2}" y2="{y2}" style="stroke: #F00; stroke-width: 1px; stroke-opacity:.9;"/>'
|
|
346
|
+
out += "</g>"
|
|
347
|
+
|
|
348
|
+
return out
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
def draw_degree_ring(r: Union[int, float], c1: Union[int, float], seventh_house_degree_ut: Union[int, float], stroke_color: str) -> str:
|
|
352
|
+
"""Draws the degree ring.
|
|
353
|
+
|
|
354
|
+
Args:
|
|
355
|
+
- r (Union[int, float]): The value of r.
|
|
356
|
+
- c1 (Union[int, float]): The value of c1.
|
|
357
|
+
- seventh_house_degree_ut (Union[int, float]): The degree of the seventh house.
|
|
358
|
+
- stroke_color (str): The color of the stroke.
|
|
359
|
+
|
|
360
|
+
Returns:
|
|
361
|
+
str: The SVG path of the degree ring.
|
|
362
|
+
"""
|
|
363
|
+
out = '<g id="degreeRing">'
|
|
364
|
+
for i in range(72):
|
|
365
|
+
offset = float(i * 5) - seventh_house_degree_ut
|
|
366
|
+
if offset < 0:
|
|
367
|
+
offset = offset + 360.0
|
|
368
|
+
elif offset > 360:
|
|
369
|
+
offset = offset - 360.0
|
|
370
|
+
x1 = sliceToX(0, r - c1, offset) + c1
|
|
371
|
+
y1 = sliceToY(0, r - c1, offset) + c1
|
|
372
|
+
x2 = sliceToX(0, r + 2 - c1, offset) - 2 + c1
|
|
373
|
+
y2 = sliceToY(0, r + 2 - c1, offset) - 2 + c1
|
|
374
|
+
|
|
375
|
+
out += f'<line x1="{x1}" y1="{y1}" x2="{x2}" y2="{y2}" style="stroke: {stroke_color}; stroke-width: 1px; stroke-opacity:.9;"/>'
|
|
376
|
+
out += "</g>"
|
|
377
|
+
|
|
378
|
+
return out
|
|
379
|
+
|
|
380
|
+
def draw_transit_ring(r: Union[int, float], paper_1_color: str, zodiac_transit_ring_3_color: str) -> str:
|
|
381
|
+
"""
|
|
382
|
+
Draws the transit ring.
|
|
383
|
+
|
|
384
|
+
Args:
|
|
385
|
+
- r (Union[int, float]): The value of r.
|
|
386
|
+
- paper_1_color (str): The color of paper 1.
|
|
387
|
+
- zodiac_transit_ring_3_color (str): The color of the zodiac transit ring
|
|
388
|
+
|
|
389
|
+
Returns:
|
|
390
|
+
str: The SVG path of the transit ring.
|
|
391
|
+
"""
|
|
392
|
+
radius_offset = 18
|
|
393
|
+
|
|
394
|
+
out = f'<circle cx="{r}" cy="{r}" r="{r - radius_offset}" style="fill: none; stroke: {paper_1_color}; stroke-width: 36px; stroke-opacity: .4;"/>'
|
|
395
|
+
out += f'<circle cx="{r}" cy="{r}" r="{r}" style="fill: none; stroke: {zodiac_transit_ring_3_color}; stroke-width: 1px; stroke-opacity: .6;"/>'
|
|
396
|
+
|
|
397
|
+
return out
|