kerykeion.aspects.synastry_aspects

This is part of Kerykeion (C) 2024 Giacomo Battaglia

  1# -*- coding: utf-8 -*-
  2"""
  3    This is part of Kerykeion (C) 2024 Giacomo Battaglia
  4"""
  5
  6from kerykeion import AstrologicalSubject
  7from pathlib import Path
  8from typing import Union
  9from functools import cached_property
 10
 11from kerykeion.aspects.natal_aspects import NatalAspects
 12from kerykeion.settings.kerykeion_settings import get_settings
 13from kerykeion.aspects.aspects_utils import planet_id_decoder, get_aspect_from_two_points, get_active_points_list
 14
 15
 16class SynastryAspects(NatalAspects):
 17    """
 18    Generates an object with all the aspects between two persons.
 19    """
 20
 21    def __init__(
 22        self,
 23        kr_object_one: AstrologicalSubject,
 24        kr_object_two: AstrologicalSubject,
 25        new_settings_file: Union[Path, None] = None,
 26    ):
 27        # Subjects
 28        self.first_user = kr_object_one
 29        self.second_user = kr_object_two
 30
 31        # Settings
 32        self.new_settings_file = new_settings_file
 33        self.settings = get_settings(self.new_settings_file)
 34
 35        self.celestial_points = self.settings["celestial_points"]
 36        self.aspects_settings = self.settings["aspects"]
 37        self.axes_orbit_settings = self.settings["general_settings"]["axes_orbit"]
 38
 39        # Private variables of the aspects
 40        self._all_aspects: Union[list, None] = None
 41        self._relevant_aspects: Union[list, None] = None
 42
 43    @cached_property
 44    def all_aspects(self):
 45        """
 46        Return all the aspects of the points in the natal chart in a dictionary,
 47        first all the individual aspects of each planet, second the aspects
 48        whiteout repetitions.
 49        """
 50
 51        if self._all_aspects is not None:
 52            return self._all_aspects
 53
 54        # Celestial Points Lists
 55        first_active_points_list = get_active_points_list(self.first_user, self.settings)
 56        second_active_points_list = get_active_points_list(self.second_user, self.settings)
 57
 58        self.all_aspects_list = []
 59
 60        for first in range(len(first_active_points_list)):
 61            # Generates the aspects list whitout repetitions
 62            for second in range(len(second_active_points_list)):
 63                verdict, name, orbit, aspect_degrees, aid, diff = get_aspect_from_two_points(
 64                    self.aspects_settings,
 65                    first_active_points_list[first]["abs_pos"],
 66                    second_active_points_list[second]["abs_pos"],
 67                )
 68
 69                if verdict == True:
 70                    d_asp = {
 71                        "p1_name": first_active_points_list[first]["name"],
 72                        "p1_abs_pos": first_active_points_list[first]["abs_pos"],
 73                        "p2_name": second_active_points_list[second]["name"],
 74                        "p2_abs_pos": second_active_points_list[second]["abs_pos"],
 75                        "aspect": name,
 76                        "orbit": orbit,
 77                        "aspect_degrees": aspect_degrees,
 78                        "aid": aid,
 79                        "diff": diff,
 80                        "p1": planet_id_decoder(
 81                            self.settings.celestial_points, first_active_points_list[first]["name"]
 82                        ),
 83                        "p2": planet_id_decoder(
 84                            self.settings.celestial_points,
 85                            second_active_points_list[second]["name"],
 86                        ),
 87                    }
 88
 89                    self.all_aspects_list.append(d_asp)
 90
 91        return self.all_aspects_list
 92
 93
 94if __name__ == "__main__":
 95    from kerykeion.utilities import setup_logging
 96    setup_logging(level="debug")
 97
 98    john = AstrologicalSubject("John", 1940, 10, 9, 18, 30, "Liverpool")
 99    yoko = AstrologicalSubject("Yoko", 1933, 2, 18, 18, 30, "Tokyo")
100
101    synastry_aspects = SynastryAspects(john, yoko)
102
103    # All aspects
104    print(synastry_aspects.all_aspects)
105
106    # Relevant aspects
107    print(synastry_aspects.relevant_aspects)
class SynastryAspects(kerykeion.aspects.natal_aspects.NatalAspects):
17class SynastryAspects(NatalAspects):
18    """
19    Generates an object with all the aspects between two persons.
20    """
21
22    def __init__(
23        self,
24        kr_object_one: AstrologicalSubject,
25        kr_object_two: AstrologicalSubject,
26        new_settings_file: Union[Path, None] = None,
27    ):
28        # Subjects
29        self.first_user = kr_object_one
30        self.second_user = kr_object_two
31
32        # Settings
33        self.new_settings_file = new_settings_file
34        self.settings = get_settings(self.new_settings_file)
35
36        self.celestial_points = self.settings["celestial_points"]
37        self.aspects_settings = self.settings["aspects"]
38        self.axes_orbit_settings = self.settings["general_settings"]["axes_orbit"]
39
40        # Private variables of the aspects
41        self._all_aspects: Union[list, None] = None
42        self._relevant_aspects: Union[list, None] = None
43
44    @cached_property
45    def all_aspects(self):
46        """
47        Return all the aspects of the points in the natal chart in a dictionary,
48        first all the individual aspects of each planet, second the aspects
49        whiteout repetitions.
50        """
51
52        if self._all_aspects is not None:
53            return self._all_aspects
54
55        # Celestial Points Lists
56        first_active_points_list = get_active_points_list(self.first_user, self.settings)
57        second_active_points_list = get_active_points_list(self.second_user, self.settings)
58
59        self.all_aspects_list = []
60
61        for first in range(len(first_active_points_list)):
62            # Generates the aspects list whitout repetitions
63            for second in range(len(second_active_points_list)):
64                verdict, name, orbit, aspect_degrees, aid, diff = get_aspect_from_two_points(
65                    self.aspects_settings,
66                    first_active_points_list[first]["abs_pos"],
67                    second_active_points_list[second]["abs_pos"],
68                )
69
70                if verdict == True:
71                    d_asp = {
72                        "p1_name": first_active_points_list[first]["name"],
73                        "p1_abs_pos": first_active_points_list[first]["abs_pos"],
74                        "p2_name": second_active_points_list[second]["name"],
75                        "p2_abs_pos": second_active_points_list[second]["abs_pos"],
76                        "aspect": name,
77                        "orbit": orbit,
78                        "aspect_degrees": aspect_degrees,
79                        "aid": aid,
80                        "diff": diff,
81                        "p1": planet_id_decoder(
82                            self.settings.celestial_points, first_active_points_list[first]["name"]
83                        ),
84                        "p2": planet_id_decoder(
85                            self.settings.celestial_points,
86                            second_active_points_list[second]["name"],
87                        ),
88                    }
89
90                    self.all_aspects_list.append(d_asp)
91
92        return self.all_aspects_list

Generates an object with all the aspects between two persons.

SynastryAspects( kr_object_one: kerykeion.astrological_subject.AstrologicalSubject, kr_object_two: kerykeion.astrological_subject.AstrologicalSubject, new_settings_file: Optional[pathlib.Path] = None)
22    def __init__(
23        self,
24        kr_object_one: AstrologicalSubject,
25        kr_object_two: AstrologicalSubject,
26        new_settings_file: Union[Path, None] = None,
27    ):
28        # Subjects
29        self.first_user = kr_object_one
30        self.second_user = kr_object_two
31
32        # Settings
33        self.new_settings_file = new_settings_file
34        self.settings = get_settings(self.new_settings_file)
35
36        self.celestial_points = self.settings["celestial_points"]
37        self.aspects_settings = self.settings["aspects"]
38        self.axes_orbit_settings = self.settings["general_settings"]["axes_orbit"]
39
40        # Private variables of the aspects
41        self._all_aspects: Union[list, None] = None
42        self._relevant_aspects: Union[list, None] = None
first_user
second_user
new_settings_file = None
settings
celestial_points
aspects_settings
axes_orbit_settings
all_aspects
44    @cached_property
45    def all_aspects(self):
46        """
47        Return all the aspects of the points in the natal chart in a dictionary,
48        first all the individual aspects of each planet, second the aspects
49        whiteout repetitions.
50        """
51
52        if self._all_aspects is not None:
53            return self._all_aspects
54
55        # Celestial Points Lists
56        first_active_points_list = get_active_points_list(self.first_user, self.settings)
57        second_active_points_list = get_active_points_list(self.second_user, self.settings)
58
59        self.all_aspects_list = []
60
61        for first in range(len(first_active_points_list)):
62            # Generates the aspects list whitout repetitions
63            for second in range(len(second_active_points_list)):
64                verdict, name, orbit, aspect_degrees, aid, diff = get_aspect_from_two_points(
65                    self.aspects_settings,
66                    first_active_points_list[first]["abs_pos"],
67                    second_active_points_list[second]["abs_pos"],
68                )
69
70                if verdict == True:
71                    d_asp = {
72                        "p1_name": first_active_points_list[first]["name"],
73                        "p1_abs_pos": first_active_points_list[first]["abs_pos"],
74                        "p2_name": second_active_points_list[second]["name"],
75                        "p2_abs_pos": second_active_points_list[second]["abs_pos"],
76                        "aspect": name,
77                        "orbit": orbit,
78                        "aspect_degrees": aspect_degrees,
79                        "aid": aid,
80                        "diff": diff,
81                        "p1": planet_id_decoder(
82                            self.settings.celestial_points, first_active_points_list[first]["name"]
83                        ),
84                        "p2": planet_id_decoder(
85                            self.settings.celestial_points,
86                            second_active_points_list[second]["name"],
87                        ),
88                    }
89
90                    self.all_aspects_list.append(d_asp)
91
92        return self.all_aspects_list

Return all the aspects of the points in the natal chart in a dictionary, first all the individual aspects of each planet, second the aspects whiteout repetitions.