Skip to content

Commit 09467b7

Browse files
committed
Extra calculation function.
1 parent 587a02c commit 09467b7

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

immanuel/const/calc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@
7575
RETROGRADE = 1
7676
STATIONARY = 2
7777

78+
""" Relative planetary rising / setting. """
79+
OCCIDENTAL = 0
80+
ORIENTAL = 1
81+
7882
""" MC progression formulae. """
7983
NAIBOD = 0
8084
SOLAR_ARC = 1

immanuel/tools/calculate.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ def object_movement_typical(object: dict) -> bool:
7070
return movement == calc.RETROGRADE if is_node else movement == calc.DIRECT
7171

7272

73+
def relative_position(object1: dict | float, object2: dict | float) -> int:
74+
""" Calculate which side of object1 object2 is. """
75+
lon1 = object1['lon'] if isinstance(object1, dict) else object1
76+
lon2 = object2['lon'] if isinstance(object2, dict) else object2
77+
78+
return calc.OCCIDENTAL if swe.difdegn(lon1, lon2) > 180 else calc.ORIENTAL
79+
80+
7381
def is_out_of_bounds(object: dict | float, jd: float = None, obliquity: float = None) -> bool:
7482
""" Returns whether the passed object is out of bounds either on the passed
7583
Julian date or relative to the passed obliquity. """

0 commit comments

Comments
 (0)