kerykeion 4.6.0__tar.gz → 4.6.1__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.

Files changed (30) hide show
  1. {kerykeion-4.6.0 → kerykeion-4.6.1}/PKG-INFO +1 -1
  2. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/charts/charts_utils.py +50 -1
  3. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/charts/kerykeion_chart_svg.py +63 -60
  4. {kerykeion-4.6.0 → kerykeion-4.6.1}/pyproject.toml +1 -1
  5. {kerykeion-4.6.0 → kerykeion-4.6.1}/LICENSE +0 -0
  6. {kerykeion-4.6.0 → kerykeion-4.6.1}/README.md +0 -0
  7. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/__init__.py +0 -0
  8. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/aspects/__init__.py +0 -0
  9. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/aspects/aspects_utils.py +0 -0
  10. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/aspects/natal_aspects.py +0 -0
  11. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/aspects/synastry_aspects.py +0 -0
  12. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/astrological_subject.py +0 -0
  13. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/charts/__init__.py +0 -0
  14. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/charts/templates/chart.xml +0 -0
  15. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/enums.py +0 -0
  16. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/fetch_geonames.py +0 -0
  17. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/kr_types/__init__.py +0 -0
  18. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/kr_types/chart_types.py +0 -0
  19. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/kr_types/kerykeion_exception.py +0 -0
  20. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/kr_types/kr_literals.py +0 -0
  21. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/kr_types/kr_models.py +0 -0
  22. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/kr_types/settings_models.py +0 -0
  23. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/relationship_score.py +0 -0
  24. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/report.py +0 -0
  25. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/settings/__init__.py +0 -0
  26. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/settings/kerykeion_settings.py +0 -0
  27. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/settings/kr.config.json +0 -0
  28. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/sweph/README.md +0 -0
  29. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/sweph/seas_18.se1 +0 -0
  30. {kerykeion-4.6.0 → kerykeion-4.6.1}/kerykeion/utilities.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kerykeion
3
- Version: 4.6.0
3
+ Version: 4.6.1
4
4
  Summary: A python library for astrology.
5
5
  Home-page: https://github.com/g-battaglia/kerykeion
6
6
  License: AGPL-3.0
@@ -1,6 +1,6 @@
1
1
  import math
2
2
  import datetime
3
- from kerykeion.kr_types import KerykeionException
3
+ from kerykeion.kr_types import KerykeionException, ChartType
4
4
  from typing import Union
5
5
 
6
6
  def decHourJoin(inH: int, inM: int, inS: int) -> float:
@@ -108,3 +108,52 @@ def sliceToY(slice: Union[int, float], r: Union[int, float], offset: Union[int,
108
108
  plus = (math.pi * offset) / 180
109
109
  radial = ((math.pi / 6) * slice) + plus
110
110
  return r * ((math.sin(radial) / -1) + 1)
111
+
112
+
113
+ def draw_zodiac_slice(
114
+ c1: Union[int, float],
115
+ chart_type: ChartType,
116
+ sixth_house_degree_ut: Union[int, float],
117
+ num: int,
118
+ r: Union[int, float],
119
+ style: str,
120
+ type: str,
121
+ ):
122
+ """
123
+ Draws a zodiac slice based on the given parameters.
124
+
125
+ Args:
126
+ - c1 (Union[int, float]): The value of c1.
127
+ - chart_type (Literal["Natal", "ExternalNatal", "Synastry", "Transit"]): The type of chart.
128
+ - sixth_house_degree_ut (Union[int, float]): The degree of the sixth house.
129
+ - num (int): The number of the sign. Note: In OpenAstro it did refer to self.zodiac,
130
+ which is a list of the signs in order, starting with Aries. Eg:
131
+ {"name": "aries", "element": "fire"}
132
+ - r (Union[int, float]): The value of r.
133
+ - style (str): The CSS inline style.
134
+ - type (str): The type ?. In OpenAstro, it was the symbol of the sign. Eg: "aries".
135
+ self.zodiac[i]["name"]
136
+
137
+ Returns:
138
+ - str: The zodiac slice and symbol as an SVG path.
139
+ """
140
+
141
+ # pie slices
142
+ offset = 360 - sixth_house_degree_ut
143
+ # check transit
144
+ if chart_type == "Transit" or chart_type == "Synastry":
145
+ dropin = 0
146
+ else:
147
+ dropin = c1
148
+ 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}"/>'
149
+
150
+ # symbols
151
+ offset = offset + 15
152
+ # check transit
153
+ if chart_type == "Transit" or chart_type == "Synastry":
154
+ dropin = 54
155
+ else:
156
+ dropin = 18 + c1
157
+ 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
+
159
+ return slice + "" + sign
@@ -14,7 +14,7 @@ from kerykeion.aspects.natal_aspects import NatalAspects
14
14
  from kerykeion.astrological_subject import AstrologicalSubject
15
15
  from kerykeion.kr_types import KerykeionException, ChartType
16
16
  from kerykeion.kr_types import ChartTemplateDictionary
17
- from kerykeion.charts.charts_utils import decHourJoin, degreeDiff, offsetToTz, sliceToX, sliceToY
17
+ from kerykeion.charts.charts_utils import decHourJoin, degreeDiff, offsetToTz, sliceToX, sliceToY, draw_zodiac_slice
18
18
  from pathlib import Path
19
19
  from string import Template
20
20
  from typing import Union
@@ -371,39 +371,30 @@ class KerykeionChartSVG:
371
371
 
372
372
  return out
373
373
 
374
- def _zodiacSlice(self, num, r, style, type):
375
- # pie slices
376
- offset = 360 - self.user.houses_degree_ut[6]
377
- # check transit
378
- if self.chart_type == "Transit" or self.chart_type == "Synastry":
379
- dropin = 0
380
- else:
381
- dropin = self.c1
382
- 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}"/>'
374
+ def _draw_zodiac_circle_slices(self, r):
375
+ """
376
+ Generate the SVG string representing the zodiac circle
377
+ with the 12 slices for each zodiac sign.
383
378
 
384
- # symbols
385
- offset = offset + 15
386
- # check transit
387
- if self.chart_type == "Transit" or self.chart_type == "Synastry":
388
- dropin = 54
389
- else:
390
- dropin = 18 + self.c1
391
- 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>'
379
+ Args:
380
+ r (float): The radius of the zodiac slices.
392
381
 
393
- return slice + "" + sign
382
+ Returns:
383
+ str: The SVG string representing the zodiac circle.
384
+ """
394
385
 
395
- def _makeZodiac(self, r):
396
386
  output = ""
397
- for i in range(len(self.zodiac)):
398
- output = (
399
- output
400
- + self._zodiacSlice(
401
- i,
402
- r,
403
- f'fill:{self.chart_colors_settings[f"zodiac_bg_{i}"]}; fill-opacity: 0.5;',
404
- self.zodiac[i]["name"],
405
- )
387
+ for i, zodiac_element in enumerate(self.zodiac):
388
+ output += draw_zodiac_slice(
389
+ c1=self.c1,
390
+ chart_type=self.chart_type,
391
+ sixth_house_degree_ut=self.user.houses_degree_ut[6],
392
+ num=i,
393
+ r=r,
394
+ style=f'fill:{self.chart_colors_settings[f"zodiac_bg_{i}"]}; fill-opacity: 0.5;',
395
+ type=zodiac_element["name"],
406
396
  )
397
+
407
398
  return output
408
399
 
409
400
  def _makeHouses(self, r):
@@ -1210,40 +1201,47 @@ class KerykeionChartSVG:
1210
1201
  return out
1211
1202
 
1212
1203
  def _makeHousesGrid(self):
1213
- out = '<g transform="translate(600,-20)">'
1204
+ """
1205
+ Generate SVG code for a grid of astrological houses.
1214
1206
 
1215
- li = 10
1207
+ Returns:
1208
+ str: The SVG code for the grid of houses.
1209
+ """
1210
+ # Initialize the SVG group for the grid
1211
+ grid_svg = '<g transform="translate(600,-20)">'
1212
+
1213
+ # Vertical position of the current house in the grid
1214
+ vertical_position = 10
1215
+
1216
+ # Generate SVG code for each house
1216
1217
  for i in range(12):
1217
- if i < 9:
1218
- cusp = "&#160;&#160;" + str(i + 1)
1219
- else:
1220
- cusp = str(i + 1)
1221
- out += f'<g transform="translate(0,{li})">'
1222
- out += f'<text text-anchor="end" x="40" style="fill:{self.chart_colors_settings["paper_0"]}; font-size: 10px;">{self.language_settings["cusp"]} {cusp}:</text>'
1223
- out += f'<g transform="translate(40,-8)"><use transform="scale(0.3)" xlink:href="#{self.zodiac[self.houses_sign_graph[i]]["name"]}" /></g>'
1224
- out += f'<text x="53" style="fill:{self.chart_colors_settings["paper_0"]}; font-size: 10px;"> {self._dec2deg(self.user.houses_list[i]["position"])}</text>'
1225
- out += "</g>"
1226
- li = li + 14
1218
+ # Add leading spaces to single-digit house numbers for alignment
1219
+ house_number = str(i + 1).rjust(2, ' ')
1227
1220
 
1228
- out += "</g>"
1221
+ # Start a new SVG group for the current house
1222
+ grid_svg += f'<g transform="translate(0,{vertical_position})">'
1229
1223
 
1230
- if self.chart_type == "Synastry":
1231
- out += '<g transform="translate(840, -20)">'
1232
- li = 10
1233
- for i in range(12):
1234
- if i < 9:
1235
- cusp = "&#160;&#160;" + str(i + 1)
1236
- else:
1237
- cusp = str(i + 1)
1238
- out += '<g transform="translate(0,' + str(li) + ')">'
1239
- out += f'<text text-anchor="end" x="40" style="fill:{self.chart_colors_settings["paper_0"]}; font-size: 10px;">{self.language_settings["cusp"]} {cusp}:</text>'
1240
- out += f'<g transform="translate(40,-8)"><use transform="scale(0.3)" xlink:href="#{self.zodiac[self.t_houses_sign_graph[i]]["name"]}" /></g>'
1241
- out += f'<text x="53" style="fill:{self.chart_colors_settings["paper_0"]}; font-size: 10px;"> {self._dec2deg(self.t_user.houses_list[i]["position"])}</text>'
1242
- out += "</g>"
1243
- li = li + 14
1244
- out += "</g>"
1224
+ # Add the house label
1225
+ grid_svg += f'<text text-anchor="end" x="40" style="fill:{self.chart_colors_settings["paper_0"]}; font-size: 10px;">{self.language_settings["cusp"]} {house_number}:</text>'
1245
1226
 
1246
- return out
1227
+ # Add the zodiac sign symbol for the house
1228
+ zodiac_sign = self.zodiac[self.houses_sign_graph[i]]["name"]
1229
+ grid_svg += f'<g transform="translate(40,-8)"><use transform="scale(0.3)" xlink:href="#{zodiac_sign}" /></g>'
1230
+
1231
+ # Add the position of the house
1232
+ house_position = self._dec2deg(self.user.houses_list[i]["position"])
1233
+ grid_svg += f'<text x="53" style="fill:{self.chart_colors_settings["paper_0"]}; font-size: 10px;"> {house_position}</text>'
1234
+
1235
+ # End the SVG group for the current house
1236
+ grid_svg += "</g>"
1237
+
1238
+ # Move down for the next house
1239
+ vertical_position += 14
1240
+
1241
+ # End the SVG group for the grid
1242
+ grid_svg += "</g>"
1243
+
1244
+ return grid_svg
1247
1245
 
1248
1246
  def _createTemplateDictionary(self) -> ChartTemplateDictionary:
1249
1247
  # self.chart_type = "Transit"
@@ -1446,8 +1444,13 @@ class KerykeionChartSVG:
1446
1444
  td["cfgRotate"] = rotate
1447
1445
  td["cfgTranslate"] = translate
1448
1446
 
1449
- # functions
1450
- td["makeZodiac"] = self._makeZodiac(r)
1447
+ # ---
1448
+ # Drawing Functions
1449
+ #---
1450
+
1451
+ # Drawing the Zodiac slices
1452
+ td["makeZodiac"] = self._draw_zodiac_circle_slices(r)
1453
+ # TODO: Add the rest of the functions
1451
1454
  td["makeHouses"] = self._makeHouses(r)
1452
1455
  td["makePlanets"] = self._make_planets(r)
1453
1456
  td["makeElements"] = self._makeElements(r)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "kerykeion"
3
- version = "4.6.0"
3
+ version = "4.6.1"
4
4
  authors = ["Giacomo Battaglia <battaglia.giacomo@yahoo.it>"]
5
5
  description = "A python library for astrology."
6
6
  license = "AGPL-3.0"
File without changes
File without changes
File without changes
File without changes