kerykeion 4.6.2__tar.gz → 4.8.0__tar.gz
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-4.6.2 → kerykeion-4.8.0}/PKG-INFO +2 -1
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/astrological_subject.py +5 -5
- kerykeion-4.8.0/kerykeion/charts/charts_utils.py +397 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/charts/kerykeion_chart_svg.py +236 -299
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/charts/templates/chart.xml +39 -12
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/kr_types/chart_types.py +11 -1
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/kr_types/settings_models.py +1 -3
- {kerykeion-4.6.2 → kerykeion-4.8.0}/pyproject.toml +3 -2
- kerykeion-4.6.2/kerykeion/charts/charts_utils.py +0 -159
- {kerykeion-4.6.2 → kerykeion-4.8.0}/LICENSE +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/README.md +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/__init__.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/aspects/__init__.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/aspects/aspects_utils.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/aspects/natal_aspects.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/aspects/synastry_aspects.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/charts/__init__.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/enums.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/fetch_geonames.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/kr_types/__init__.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/kr_types/kerykeion_exception.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/kr_types/kr_literals.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/kr_types/kr_models.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/relationship_score.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/report.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/settings/__init__.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/settings/kerykeion_settings.py +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/settings/kr.config.json +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/sweph/README.md +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/sweph/seas_18.se1 +0 -0
- {kerykeion-4.6.2 → kerykeion-4.8.0}/kerykeion/utilities.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: kerykeion
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.8.0
|
|
4
4
|
Summary: A python library for astrology.
|
|
5
5
|
Home-page: https://github.com/g-battaglia/kerykeion
|
|
6
6
|
License: AGPL-3.0
|
|
@@ -30,6 +30,7 @@ Requires-Dist: pyswisseph (>=2.10.3.1,<3.0.0.0)
|
|
|
30
30
|
Requires-Dist: pytz (>=2022.7,<2023.0)
|
|
31
31
|
Requires-Dist: requests (>=2.28.1,<3.0.0)
|
|
32
32
|
Requires-Dist: requests-cache (>=0.9.7,<0.10.0)
|
|
33
|
+
Requires-Dist: scour (>=0.38.2,<0.39.0)
|
|
33
34
|
Requires-Dist: terminaltables (>=3.1.10,<4.0.0)
|
|
34
35
|
Project-URL: Repository, https://github.com/g-battaglia/kerykeion
|
|
35
36
|
Description-Content-Type: text/markdown
|
|
@@ -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(
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import math
|
|
2
|
+
import datetime
|
|
3
|
+
from kerykeion.kr_types import KerykeionException, ChartType
|
|
4
|
+
from typing import Union
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def decHourJoin(inH: int, inM: int, inS: int) -> float:
|
|
8
|
+
"""Join hour, minutes, seconds, timezone integer to hour float.
|
|
9
|
+
|
|
10
|
+
Args:
|
|
11
|
+
- inH (int): hour
|
|
12
|
+
- inM (int): minutes
|
|
13
|
+
- inS (int): seconds
|
|
14
|
+
Returns:
|
|
15
|
+
float: hour in float format
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
dh = float(inH)
|
|
19
|
+
dm = float(inM) / 60
|
|
20
|
+
ds = float(inS) / 3600
|
|
21
|
+
output = dh + dm + ds
|
|
22
|
+
return output
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def degreeDiff(a: Union[int, float], b: Union[int, float]) -> float:
|
|
26
|
+
"""Calculate the difference between two degrees.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
- a (int | float): first degree
|
|
30
|
+
- b (int | float): second degree
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
float: difference between a and b
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
out = float()
|
|
37
|
+
if a > b:
|
|
38
|
+
out = a - b
|
|
39
|
+
if a < b:
|
|
40
|
+
out = b - a
|
|
41
|
+
if out > 180.0:
|
|
42
|
+
out = 360.0 - out
|
|
43
|
+
return out
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def offsetToTz(datetime_offset: Union[datetime.timedelta, None]) -> float:
|
|
47
|
+
"""Convert datetime offset to float in hours.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
- datetime_offset (datetime.timedelta): datetime offset
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
- float: offset in hours
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
if datetime_offset is None:
|
|
57
|
+
raise KerykeionException("datetime_offset is None")
|
|
58
|
+
|
|
59
|
+
# days to hours
|
|
60
|
+
dh = float(datetime_offset.days * 24)
|
|
61
|
+
# seconds to hours
|
|
62
|
+
sh = float(datetime_offset.seconds / 3600.0)
|
|
63
|
+
# total hours
|
|
64
|
+
output = dh + sh
|
|
65
|
+
return output
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def sliceToX(slice: Union[int, float], radius: Union[int, float], offset: Union[int, float]) -> float:
|
|
69
|
+
"""Calculates the x-coordinate of a point on a circle based on the slice, radius, and offset.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
- slice (int | float): Represents the
|
|
73
|
+
slice of the circle to calculate the x-coordinate for.
|
|
74
|
+
It must be between 0 and 11 (inclusive).
|
|
75
|
+
- radius (int | float): Represents the radius of the circle.
|
|
76
|
+
- offset (int | float): Represents the offset in degrees.
|
|
77
|
+
It must be between 0 and 360 (inclusive).
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
float: The x-coordinate of the point on the circle.
|
|
81
|
+
|
|
82
|
+
Example:
|
|
83
|
+
>>> import math
|
|
84
|
+
>>> sliceToX(3, 5, 45)
|
|
85
|
+
2.5000000000000018
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
plus = (math.pi * offset) / 180
|
|
89
|
+
radial = ((math.pi / 6) * slice) + plus
|
|
90
|
+
return radius * (math.cos(radial) + 1)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def sliceToY(slice: Union[int, float], r: Union[int, float], offset: Union[int, float]) -> float:
|
|
94
|
+
"""Calculates the y-coordinate of a point on a circle based on the slice, radius, and offset.
|
|
95
|
+
|
|
96
|
+
Args:
|
|
97
|
+
- slice (int | float): Represents the slice of the circle to calculate
|
|
98
|
+
the y-coordinate for. It must be between 0 and 11 (inclusive).
|
|
99
|
+
- r (int | float): Represents the radius of the circle.
|
|
100
|
+
- offset (int | float): Represents the offset in degrees.
|
|
101
|
+
It must be between 0 and 360 (inclusive).
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
float: The y-coordinate of the point on the circle.
|
|
105
|
+
|
|
106
|
+
Example:
|
|
107
|
+
>>> import math
|
|
108
|
+
>>> __sliceToY(3, 5, 45)
|
|
109
|
+
-4.330127018922194
|
|
110
|
+
"""
|
|
111
|
+
plus = (math.pi * offset) / 180
|
|
112
|
+
radial = ((math.pi / 6) * slice) + plus
|
|
113
|
+
return r * ((math.sin(radial) / -1) + 1)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def draw_zodiac_slice(
|
|
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.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
- c1 (Union[int, float]): The value of c1.
|
|
129
|
+
- chart_type (Literal["Natal", "ExternalNatal", "Synastry", "Transit"]): The type of chart.
|
|
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,
|
|
132
|
+
which is a list of the signs in order, starting with Aries. Eg:
|
|
133
|
+
{"name": "aries", "element": "fire"}
|
|
134
|
+
- r (Union[int, float]): The value of r.
|
|
135
|
+
- style (str): The CSS inline style.
|
|
136
|
+
- type (str): The type ?. In OpenAstro, it was the symbol of the sign. Eg: "aries".
|
|
137
|
+
self.zodiac[i]["name"]
|
|
138
|
+
|
|
139
|
+
Returns:
|
|
140
|
+
- str: The zodiac slice and symbol as an SVG path.
|
|
141
|
+
"""
|
|
142
|
+
|
|
143
|
+
# pie slices
|
|
144
|
+
offset = 360 - seventh_house_degree_ut
|
|
145
|
+
# check transit
|
|
146
|
+
if chart_type == "Transit" or chart_type == "Synastry":
|
|
147
|
+
dropin = 0
|
|
148
|
+
else:
|
|
149
|
+
dropin = c1
|
|
150
|
+
slice = f'<path d="M{str(r)},{str(r)} L{str(dropin + sliceToX(num, r - dropin, offset))},{str(dropin + sliceToY(num, r - dropin, offset))} A{str(r - dropin)},{str(r - dropin)} 0 0,0 {str(dropin + sliceToX(num + 1, r - dropin, offset))},{str(dropin + sliceToY(num + 1, r - dropin, offset))} z" style="{style}"/>'
|
|
151
|
+
|
|
152
|
+
# symbols
|
|
153
|
+
offset = offset + 15
|
|
154
|
+
# check transit
|
|
155
|
+
if chart_type == "Transit" or chart_type == "Synastry":
|
|
156
|
+
dropin = 54
|
|
157
|
+
else:
|
|
158
|
+
dropin = 18 + c1
|
|
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>'
|
|
160
|
+
|
|
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
|