kerykeion 4.8.1__py3-none-any.whl → 4.12.3__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.

@@ -33,6 +33,7 @@ from pathlib import Path
33
33
  from scour.scour import scourString
34
34
  from string import Template
35
35
  from typing import Union, List
36
+ from datetime import datetime
36
37
 
37
38
 
38
39
 
@@ -45,9 +46,9 @@ class KerykeionChartSVG:
45
46
  - first_obj: First kerykeion object
46
47
  - chart_type: Natal, ExternalNatal, Transit, Synastry (Default: Type="Natal").
47
48
  - second_obj: Second kerykeion object (Not required if type is Natal)
48
- - new_output_directory: Set the output directory (default: output_directory)
49
- - lang: language settings (default: "EN")
50
- - new_settings_file: Set the settings file (default: kr.config.json)
49
+ - new_output_directory: Set the output directory (default: home directory).
50
+ - new_settings_file: Set the settings file (default: kr.config.json).
51
+ In the settings file you can set the language, colors, planets, aspects, etc.
51
52
  """
52
53
 
53
54
  # Constants
@@ -218,7 +219,6 @@ class KerykeionChartSVG:
218
219
  self.t_houses_sign_graph.append(h["sign_num"])
219
220
 
220
221
  # screen size
221
-
222
222
  self.height = self._DEFAULT_HEIGHT
223
223
  if self.chart_type == "Synastry" or self.chart_type == "Transit":
224
224
  self.width = self._DEFAULT_FULL_WIDTH
@@ -1018,7 +1018,7 @@ class KerykeionChartSVG:
1018
1018
  li = 10
1019
1019
  offset = 0
1020
1020
 
1021
- out = '<g transform="translate(500,-20)">'
1021
+ out = '<g transform="translate(510,-20)">'
1022
1022
  out += '<g transform="translate(140, -15)">'
1023
1023
  out += f'<text text-anchor="end" style="fill:{self.chart_colors_settings["paper_0"]}; font-size: 14px;">{self.language_settings["planets_and_house"]} {self.user.name}:</text>'
1024
1024
  out += "</g>"
@@ -1109,7 +1109,7 @@ class KerykeionChartSVG:
1109
1109
  Returns:
1110
1110
  str: The SVG code for the grid of houses.
1111
1111
  """
1112
- out = '<g transform="translate(600,-20)">'
1112
+ out = '<g transform="translate(610,-20)">'
1113
1113
 
1114
1114
  li = 10
1115
1115
  for i in range(12):
@@ -1127,8 +1127,10 @@ class KerykeionChartSVG:
1127
1127
  out += "</g>"
1128
1128
 
1129
1129
  if self.chart_type == "Synastry":
1130
- out += '<g transform="translate(840, -20)">'
1130
+ out += '<!-- Synastry Houses -->'
1131
+ out += '<g transform="translate(850, -20)">'
1131
1132
  li = 10
1133
+
1132
1134
  for i in range(12):
1133
1135
  if i < 9:
1134
1136
  cusp = "&#160;&#160;" + str(i + 1)
@@ -1159,7 +1161,6 @@ class KerykeionChartSVG:
1159
1161
  svgHeight = "100%"
1160
1162
  svgWidth = "100%"
1161
1163
  rotate = "0"
1162
- translate = "0"
1163
1164
 
1164
1165
  # To increase the size of the chart, change the viewbox
1165
1166
  if self.chart_type == "Natal" or self.chart_type == "ExternalNatal":
@@ -1218,6 +1219,7 @@ class KerykeionChartSVG:
1218
1219
  td["svgHeight"] = str(svgHeight)
1219
1220
  td["viewbox"] = viewbox
1220
1221
 
1222
+ # Chart Title
1221
1223
  if self.chart_type == "Synastry":
1222
1224
  td["stringTitle"] = f"{self.user.name} {self.language_settings['and_word']} {self.t_user.name}"
1223
1225
 
@@ -1227,17 +1229,26 @@ class KerykeionChartSVG:
1227
1229
  else:
1228
1230
  td["stringTitle"] = self.user.name
1229
1231
 
1230
- # Tipo di carta
1232
+ # Chart Name
1231
1233
  if self.chart_type == "Synastry" or self.chart_type == "Transit":
1232
1234
  td["stringName"] = f"{self.user.name}:"
1233
1235
  else:
1234
1236
  td["stringName"] = f'{self.language_settings["info"]}:'
1235
1237
 
1236
- # bottom left
1237
- td["bottomLeft1"] = ""
1238
- td["bottomLeft2"] = ""
1239
- td["bottomLeft3"] = f'{self.language_settings.get("lunar_phase", "Lunar Phase")}: {self.language_settings.get("day", "Day")} {self.user.lunar_phase.get("moon_phase", "")}'
1240
- td["bottomLeft4"] = ""
1238
+ # Bottom Left Corner
1239
+ if self.chart_type == "Natal" or self.chart_type == "ExternalNatal" or self.chart_type == "Synastry":
1240
+ td["bottomLeft0"] = f"{self.user.zodiac_type if self.user.zodiac_type == 'Tropic' else self.user.zodiac_type + ' ' + self.user.sidereal_mode}"
1241
+ td["bottomLeft1"] = f"{self.user.houses_system_name}"
1242
+ td["bottomLeft2"] = f'{self.language_settings.get("lunar_phase", "Lunar Phase")}: {self.language_settings.get("day", "Day")} {self.user.lunar_phase.get("moon_phase", "")}'
1243
+ td["bottomLeft3"] = f'{self.language_settings.get("lunar_phase", "Lunar Phase")}: {self.user.lunar_phase.moon_phase_name}'
1244
+ td["bottomLeft4"] = f'{self.user.perspective_type}'
1245
+
1246
+ else:
1247
+ td["bottomLeft0"] = f"{self.user.zodiac_type if self.user.zodiac_type == 'Tropic' else self.user.zodiac_type + ' ' + self.user.sidereal_mode}"
1248
+ td["bottomLeft1"] = f"{self.user.houses_system_name}"
1249
+ td["bottomLeft2"] = f'{self.language_settings.get("lunar_phase", "Lunar Phase")}: {self.language_settings.get("day", "Day")} {self.t_user.lunar_phase.get("moon_phase", "")}'
1250
+ td["bottomLeft3"] = f'{self.language_settings.get("lunar_phase", "Lunar Phase")}: {self.t_user.lunar_phase.moon_phase_name}'
1251
+ td["bottomLeft4"] = f'{self.t_user.perspective_type}'
1241
1252
 
1242
1253
  # lunar phase
1243
1254
  deg = self.user.lunar_phase["degrees_between_s_m"]
@@ -1305,8 +1316,6 @@ class KerykeionChartSVG:
1305
1316
  else:
1306
1317
  td["stringLocation"] = self.location
1307
1318
 
1308
- td["stringDateTime"] = f"{self.user.year}-{self.user.month}-{self.user.day} {self.user.hour:02d}:{self.user.minute:02d}"
1309
-
1310
1319
  if self.chart_type == "Synastry":
1311
1320
  td["stringLat"] = f"{self.t_user.name}: "
1312
1321
  td["stringLon"] = self.t_user.city
@@ -1348,7 +1357,6 @@ class KerykeionChartSVG:
1348
1357
  # config
1349
1358
  td["cfgZoom"] = str(self.zoom)
1350
1359
  td["cfgRotate"] = rotate
1351
- td["cfgTranslate"] = translate
1352
1360
 
1353
1361
  # ---
1354
1362
  # Drawing Functions
@@ -1371,6 +1379,12 @@ class KerykeionChartSVG:
1371
1379
  )
1372
1380
  td["makePlanetGrid"] = self._makePlanetGrid()
1373
1381
 
1382
+ # Date time String
1383
+ dt = datetime.fromisoformat(self.user.iso_formatted_local_datetime)
1384
+ custom_format = dt.strftime('%Y-%-m-%-d %H:%M [%z]') # Note the use of '-' to remove leading zeros
1385
+ custom_format = custom_format[:-3] + ':' + custom_format[-3:]
1386
+ td["stringDateTime"] = f"{custom_format}"
1387
+
1374
1388
  return td
1375
1389
 
1376
1390
  def makeTemplate(self, minify: bool = False) -> str:
@@ -1401,7 +1415,7 @@ class KerykeionChartSVG:
1401
1415
  if not (self.template):
1402
1416
  self.template = self.makeTemplate(minify)
1403
1417
 
1404
- self.chartname = self.output_directory / f"{self.user.name}{self.chart_type}Chart.svg"
1418
+ self.chartname = self.output_directory / f"{self.user.name} - {self.chart_type} Chart.svg"
1405
1419
 
1406
1420
  with open(self.chartname, "w", encoding="utf-8", errors="ignore") as output_file:
1407
1421
  output_file.write(self.template)
@@ -1413,7 +1427,7 @@ if __name__ == "__main__":
1413
1427
  from kerykeion.utilities import setup_logging
1414
1428
  setup_logging(level="debug")
1415
1429
 
1416
- first = AstrologicalSubject("John Lennon", 1940, 10, 9, 10, 30, "Liverpool", "GB")
1430
+ first = AstrologicalSubject("John Lennon", 1940, 10, 9, 18, 30, "Liverpool", "GB")
1417
1431
  second = AstrologicalSubject("Paul McCartney", 1942, 6, 18, 15, 30, "Liverpool", "GB")
1418
1432
 
1419
1433
  # Internal Natal Chart
@@ -1426,9 +1440,56 @@ if __name__ == "__main__":
1426
1440
 
1427
1441
  # Synastry Chart
1428
1442
  synastry_chart = KerykeionChartSVG(first, "Synastry", second)
1429
- synastry_chart.makeSVG(minify=True)
1443
+ synastry_chart.makeSVG()
1430
1444
 
1431
1445
  # Transits Chart
1432
1446
  transits_chart = KerykeionChartSVG(first, "Transit", second)
1433
- transits_chart.makeSVG(minify=True)
1434
-
1447
+ transits_chart.makeSVG()
1448
+
1449
+ # Sidereal Birth Chart (Lahiri)
1450
+ sidereal_subject = AstrologicalSubject("John Lennon Lahiri", 1940, 10, 9, 18, 30, "Liverpool", "GB", zodiac_type="Sidereal", sidereal_mode="LAHIRI")
1451
+ sidereal_chart = KerykeionChartSVG(sidereal_subject)
1452
+ sidereal_chart.makeSVG()
1453
+
1454
+ # Sidereal Birth Chart (Fagan-Bradley)
1455
+ sidereal_subject = AstrologicalSubject("John Lennon Fagan-Bradley", 1940, 10, 9, 18, 30, "Liverpool", "GB", zodiac_type="Sidereal", sidereal_mode="FAGAN_BRADLEY")
1456
+ sidereal_chart = KerykeionChartSVG(sidereal_subject)
1457
+ sidereal_chart.makeSVG()
1458
+
1459
+ # Sidereal Birth Chart (DeLuce)
1460
+ sidereal_subject = AstrologicalSubject("John Lennon DeLuce", 1940, 10, 9, 18, 30, "Liverpool", "GB", zodiac_type="Sidereal", sidereal_mode="DELUCE")
1461
+ sidereal_chart = KerykeionChartSVG(sidereal_subject)
1462
+ sidereal_chart.makeSVG()
1463
+
1464
+ # Sidereal Birth Chart (J2000)
1465
+ sidereal_subject = AstrologicalSubject("John Lennon J2000", 1940, 10, 9, 18, 30, "Liverpool", "GB", zodiac_type="Sidereal", sidereal_mode="J2000")
1466
+ sidereal_chart = KerykeionChartSVG(sidereal_subject)
1467
+ sidereal_chart.makeSVG()
1468
+
1469
+ # House System Morinus
1470
+ morinus_house_subject = AstrologicalSubject("John Lennon - House System Morinus", 1940, 10, 9, 18, 30, "Liverpool", "GB", houses_system_identifier="M")
1471
+ morinus_house_chart = KerykeionChartSVG(morinus_house_subject)
1472
+ morinus_house_chart.makeSVG()
1473
+
1474
+ ## To check all the available house systems uncomment the following code:
1475
+ # from kerykeion.kr_types import HousesSystemIdentifier
1476
+ # from typing import get_args
1477
+ # for i in get_args(HousesSystemIdentifier):
1478
+ # alternatives_house_subject = AstrologicalSubject(f"John Lennon - House System {i}", 1940, 10, 9, 18, 30, "Liverpool", "GB", houses_system=i)
1479
+ # alternatives_house_chart = KerykeionChartSVG(alternatives_house_subject)
1480
+ # alternatives_house_chart.makeSVG()
1481
+
1482
+ # With True Geocentric Perspective
1483
+ true_geocentric_subject = AstrologicalSubject("John Lennon - True Geocentric", 1940, 10, 9, 18, 30, "Liverpool", "GB", perspective_type="True Geocentric")
1484
+ true_geocentric_chart = KerykeionChartSVG(true_geocentric_subject)
1485
+ true_geocentric_chart.makeSVG()
1486
+
1487
+ # With Heliocentric Perspective
1488
+ heliocentric_subject = AstrologicalSubject("John Lennon - Heliocentric", 1940, 10, 9, 18, 30, "Liverpool", "GB", perspective_type="Heliocentric")
1489
+ heliocentric_chart = KerykeionChartSVG(heliocentric_subject)
1490
+ heliocentric_chart.makeSVG()
1491
+
1492
+ # With Topocentric Perspective
1493
+ topocentric_subject = AstrologicalSubject("John Lennon - Topocentric", 1940, 10, 9, 18, 30, "Liverpool", "GB", perspective_type="Topocentric")
1494
+ topocentric_chart = KerykeionChartSVG(topocentric_subject)
1495
+ topocentric_chart.makeSVG()