Skip to content

Commit

Permalink
Bugfix: _makeAspectGrid
Browse files Browse the repository at this point in the history
  • Loading branch information
g-battaglia committed Aug 5, 2024
1 parent 1379c89 commit 4849696
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 17 deletions.
26 changes: 16 additions & 10 deletions kerykeion/charts/kerykeion_chart_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,30 +915,36 @@ def _makeAspects(self, r, ar):

def _makeAspectGrid(self, r):
out = ""
style = "stroke:%s; stroke-width: 1px; stroke-opacity:.6; fill:none" % (self.chart_colors_settings["paper_0"])
style = f"stroke:{self.chart_colors_settings['paper_0']}; stroke-width: 1px; stroke-opacity:.6; fill:none"
xindent = 380
yindent = 468
box = 14
revr = list(range(len(self.available_planets_setting)))
revr.reverse()
counter = 0
for a in revr:

actual_planets = []
for planet in self.available_planets_setting:
if planet.is_active:
actual_planets.append(planet)

first_iteration_revers_planets = actual_planets[::-1]
for index, a in enumerate(first_iteration_revers_planets):
counter += 1
out += f'<rect x="{xindent}" y="{yindent}" width="{box}" height="{box}" style="{style}"/>'
out += f'<use transform="scale(0.4)" x="{(xindent+2)*2.5}" y="{(yindent+1)*2.5}" xlink:href="#{self.available_planets_setting[a]["name"]}" />'
out += f'<use transform="scale(0.4)" x="{(xindent+2)*2.5}" y="{(yindent+1)*2.5}" xlink:href="#{a["name"]}" />'

xindent = xindent + box
yindent = yindent - box
revr2 = list(range(a))
revr2.reverse()

xorb = xindent
yorb = yindent + box
for b in revr2:
out += f'<rect x="{xorb}" y="{yorb}" width="{box}" height="{box}" style="{style}"/>'

second_iteration_revers_planets = first_iteration_revers_planets[index+1:]
for b in second_iteration_revers_planets:
out += f'<rect x="{xorb}" y="{yorb}" width="{box}" height="{box}" style="{style}"/>'
xorb = xorb + box

for element in self.aspects_list:
if (element["p1"] == a and element["p2"] == b) or (element["p1"] == b and element["p2"] == a):
if (element["p1"] == a["id"] and element["p2"] == b['id']) or (element["p1"] == b["id"] and element["p2"] == a["id"]):
out += f'<use x="{xorb-box+1}" y="{yorb+1}" xlink:href="#orb{element["aspect_degrees"]}" />'

return out
Expand Down
1 change: 1 addition & 0 deletions kerykeion/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Planets(Enum):
CHIRON = "Chiron"
TRUE_NODE = "True_Node"
MEAN_NODE = "Mean_Node"
MEAN_LILITH = "Mean_Lilith"


class Aspects(Enum):
Expand Down
2 changes: 1 addition & 1 deletion tests/charts/expected_deluce_birth_chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/charts/expected_external_natal_chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/charts/expected_fagan_bradley_birth_chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/charts/expected_j2000_birth_chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/charts/expected_lahiri_birth_chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/charts/expected_morinus_house_system_birth_chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/charts/expected_natal_chart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4849696

Please sign in to comment.