kerykeion.aspects.natal_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 pathlib import Path
  7from kerykeion import AstrologicalSubject
  8import logging
  9from typing import Union
 10from kerykeion.settings.kerykeion_settings import get_settings
 11from dataclasses import dataclass
 12from functools import cached_property
 13from kerykeion.aspects.aspects_utils import planet_id_decoder, get_aspect_from_two_points, get_active_points_list
 14
 15
 16AXES_LIST = [
 17    "First_House",
 18    "Tenth_House",
 19    "Seventh_House",
 20    "Fourth_House",
 21]
 22
 23
 24@dataclass
 25class NatalAspects:
 26    """
 27    Generates an object with all the aspects of a birthcart.
 28    """
 29
 30    user: AstrologicalSubject
 31    new_settings_file: Union[Path, None] = None
 32
 33    def __post_init__(self):
 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    @cached_property
 41    def all_aspects(self):
 42        """
 43        Return all the aspects of the points in the natal chart in a dictionary,
 44        first all the individual aspects of each planet, second the aspects
 45        without repetitions.
 46        """
 47
 48        active_points_list = get_active_points_list(self.user, self.settings)
 49
 50        self.all_aspects_list = []
 51
 52        for first in range(len(active_points_list)):
 53            # Generates the aspects list without repetitions
 54            for second in range(first + 1, len(active_points_list)):
 55                verdict, name, orbit, aspect_degrees, aid, diff = get_aspect_from_two_points(
 56                    self.aspects_settings, active_points_list[first]["abs_pos"], active_points_list[second]["abs_pos"]
 57                )
 58
 59                if verdict == True:
 60                    d_asp = {
 61                        "p1_name": active_points_list[first]["name"],
 62                        "p1_abs_pos": active_points_list[first]["abs_pos"],
 63                        "p2_name": active_points_list[second]["name"],
 64                        "p2_abs_pos": active_points_list[second]["abs_pos"],
 65                        "aspect": name,
 66                        "orbit": orbit,
 67                        "aspect_degrees": aspect_degrees,
 68                        "aid": aid,
 69                        "diff": diff,
 70                        "p1": planet_id_decoder(self.celestial_points, active_points_list[first]["name"]),
 71                        "p2": planet_id_decoder(
 72                            self.celestial_points,
 73                            active_points_list[second]["name"],
 74                        ),
 75                    }
 76
 77                    self.all_aspects_list.append(d_asp)
 78
 79        return self.all_aspects_list
 80
 81    @cached_property
 82    def relevant_aspects(self):
 83        """
 84        Filters the aspects list with the desired points, in this case
 85        the most important are hardcoded.
 86        Set the list with set_points and creating a list with the names
 87        or the numbers of the houses.
 88        """
 89
 90        logging.debug("Relevant aspects not already calculated, calculating now...")
 91        self.all_aspects
 92
 93        aspects_filtered = []
 94        for a in self.all_aspects_list:
 95            if self.aspects_settings[a["aid"]]["is_active"] == True:
 96                aspects_filtered.append(a)
 97
 98        axes_list = AXES_LIST
 99        counter = 0
100
101        aspects_list_subtract = []
102        for a in aspects_filtered:
103            counter += 1
104            name_p1 = str(a["p1_name"])
105            name_p2 = str(a["p2_name"])
106
107            if name_p1 in axes_list:
108                if abs(a["orbit"]) >= self.axes_orbit_settings:
109                    aspects_list_subtract.append(a)
110
111            elif name_p2 in axes_list:
112                if abs(a["orbit"]) >= self.axes_orbit_settings:
113                    aspects_list_subtract.append(a)
114
115        self.aspects = [item for item in aspects_filtered if item not in aspects_list_subtract]
116
117        return self.aspects
118
119
120if __name__ == "__main__":
121    from kerykeion.utilities import setup_logging
122    setup_logging(level="debug")
123
124    johnny = AstrologicalSubject("Johnny Depp", 1963, 6, 9, 0, 0, "Owensboro", "US")
125
126    # All aspects
127    aspects = NatalAspects(johnny)
128    print(aspects.all_aspects)
129
130    print("\n")
131
132    # Relevant aspects
133    aspects = NatalAspects(johnny)
134    print(aspects.relevant_aspects)
AXES_LIST = ['First_House', 'Tenth_House', 'Seventh_House', 'Fourth_House']
@dataclass
class NatalAspects:
 25@dataclass
 26class NatalAspects:
 27    """
 28    Generates an object with all the aspects of a birthcart.
 29    """
 30
 31    user: AstrologicalSubject
 32    new_settings_file: Union[Path, None] = None
 33
 34    def __post_init__(self):
 35        self.settings = get_settings(self.new_settings_file)
 36
 37        self.celestial_points = self.settings["celestial_points"]
 38        self.aspects_settings = self.settings["aspects"]
 39        self.axes_orbit_settings = self.settings["general_settings"]["axes_orbit"]
 40
 41    @cached_property
 42    def all_aspects(self):
 43        """
 44        Return all the aspects of the points in the natal chart in a dictionary,
 45        first all the individual aspects of each planet, second the aspects
 46        without repetitions.
 47        """
 48
 49        active_points_list = get_active_points_list(self.user, self.settings)
 50
 51        self.all_aspects_list = []
 52
 53        for first in range(len(active_points_list)):
 54            # Generates the aspects list without repetitions
 55            for second in range(first + 1, len(active_points_list)):
 56                verdict, name, orbit, aspect_degrees, aid, diff = get_aspect_from_two_points(
 57                    self.aspects_settings, active_points_list[first]["abs_pos"], active_points_list[second]["abs_pos"]
 58                )
 59
 60                if verdict == True:
 61                    d_asp = {
 62                        "p1_name": active_points_list[first]["name"],
 63                        "p1_abs_pos": active_points_list[first]["abs_pos"],
 64                        "p2_name": active_points_list[second]["name"],
 65                        "p2_abs_pos": active_points_list[second]["abs_pos"],
 66                        "aspect": name,
 67                        "orbit": orbit,
 68                        "aspect_degrees": aspect_degrees,
 69                        "aid": aid,
 70                        "diff": diff,
 71                        "p1": planet_id_decoder(self.celestial_points, active_points_list[first]["name"]),
 72                        "p2": planet_id_decoder(
 73                            self.celestial_points,
 74                            active_points_list[second]["name"],
 75                        ),
 76                    }
 77
 78                    self.all_aspects_list.append(d_asp)
 79
 80        return self.all_aspects_list
 81
 82    @cached_property
 83    def relevant_aspects(self):
 84        """
 85        Filters the aspects list with the desired points, in this case
 86        the most important are hardcoded.
 87        Set the list with set_points and creating a list with the names
 88        or the numbers of the houses.
 89        """
 90
 91        logging.debug("Relevant aspects not already calculated, calculating now...")
 92        self.all_aspects
 93
 94        aspects_filtered = []
 95        for a in self.all_aspects_list:
 96            if self.aspects_settings[a["aid"]]["is_active"] == True:
 97                aspects_filtered.append(a)
 98
 99        axes_list = AXES_LIST
100        counter = 0
101
102        aspects_list_subtract = []
103        for a in aspects_filtered:
104            counter += 1
105            name_p1 = str(a["p1_name"])
106            name_p2 = str(a["p2_name"])
107
108            if name_p1 in axes_list:
109                if abs(a["orbit"]) >= self.axes_orbit_settings:
110                    aspects_list_subtract.append(a)
111
112            elif name_p2 in axes_list:
113                if abs(a["orbit"]) >= self.axes_orbit_settings:
114                    aspects_list_subtract.append(a)
115
116        self.aspects = [item for item in aspects_filtered if item not in aspects_list_subtract]
117
118        return self.aspects

Generates an object with all the aspects of a birthcart.

NatalAspects( user: kerykeion.astrological_subject.AstrologicalSubject, new_settings_file: Optional[pathlib.Path] = None)
new_settings_file: Optional[pathlib.Path] = None
all_aspects
41    @cached_property
42    def all_aspects(self):
43        """
44        Return all the aspects of the points in the natal chart in a dictionary,
45        first all the individual aspects of each planet, second the aspects
46        without repetitions.
47        """
48
49        active_points_list = get_active_points_list(self.user, self.settings)
50
51        self.all_aspects_list = []
52
53        for first in range(len(active_points_list)):
54            # Generates the aspects list without repetitions
55            for second in range(first + 1, len(active_points_list)):
56                verdict, name, orbit, aspect_degrees, aid, diff = get_aspect_from_two_points(
57                    self.aspects_settings, active_points_list[first]["abs_pos"], active_points_list[second]["abs_pos"]
58                )
59
60                if verdict == True:
61                    d_asp = {
62                        "p1_name": active_points_list[first]["name"],
63                        "p1_abs_pos": active_points_list[first]["abs_pos"],
64                        "p2_name": active_points_list[second]["name"],
65                        "p2_abs_pos": active_points_list[second]["abs_pos"],
66                        "aspect": name,
67                        "orbit": orbit,
68                        "aspect_degrees": aspect_degrees,
69                        "aid": aid,
70                        "diff": diff,
71                        "p1": planet_id_decoder(self.celestial_points, active_points_list[first]["name"]),
72                        "p2": planet_id_decoder(
73                            self.celestial_points,
74                            active_points_list[second]["name"],
75                        ),
76                    }
77
78                    self.all_aspects_list.append(d_asp)
79
80        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 without repetitions.

relevant_aspects
 82    @cached_property
 83    def relevant_aspects(self):
 84        """
 85        Filters the aspects list with the desired points, in this case
 86        the most important are hardcoded.
 87        Set the list with set_points and creating a list with the names
 88        or the numbers of the houses.
 89        """
 90
 91        logging.debug("Relevant aspects not already calculated, calculating now...")
 92        self.all_aspects
 93
 94        aspects_filtered = []
 95        for a in self.all_aspects_list:
 96            if self.aspects_settings[a["aid"]]["is_active"] == True:
 97                aspects_filtered.append(a)
 98
 99        axes_list = AXES_LIST
100        counter = 0
101
102        aspects_list_subtract = []
103        for a in aspects_filtered:
104            counter += 1
105            name_p1 = str(a["p1_name"])
106            name_p2 = str(a["p2_name"])
107
108            if name_p1 in axes_list:
109                if abs(a["orbit"]) >= self.axes_orbit_settings:
110                    aspects_list_subtract.append(a)
111
112            elif name_p2 in axes_list:
113                if abs(a["orbit"]) >= self.axes_orbit_settings:
114                    aspects_list_subtract.append(a)
115
116        self.aspects = [item for item in aspects_filtered if item not in aspects_list_subtract]
117
118        return self.aspects

Filters the aspects list with the desired points, in this case the most important are hardcoded. Set the list with set_points and creating a list with the names or the numbers of the houses.