Skip to content

Commit c7d663a

Browse files
committed
Ability to hide object's motion in string output when typical of that object.
1 parent d08d781 commit c7d663a

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

immanuel/classes/wrap.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def __str__(self) -> str:
235235
if hasattr(self, 'house'):
236236
formatted += f', {_(self.house)}'
237237

238-
if hasattr(self, 'movement'):
238+
if hasattr(self, 'movement') and (settings.output_typical_object_motion or not self.movement.typical):
239239
formatted += f', {_(self.movement)}'
240240

241241
return formatted
@@ -247,6 +247,7 @@ def __init__(self, object: dict) -> None:
247247
self.direct = self._movement == calc.DIRECT
248248
self.stationary = self._movement == calc.STATIONARY
249249
self.retrograde = self._movement == calc.RETROGRADE
250+
self.typical = calculate.object_movement_typical(object)
250251
self.formatted = _(names.OBJECT_MOVEMENTS[self._movement], gender(object['index']))
251252

252253
def __str__(self) -> str:

immanuel/setup.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ def __init__(self) -> None:
9696

9797
self.default_longitude = -0.0015
9898

99+
""" Whether or not the stringified output of chart objects should
100+
always display the object's motion even when it is typical for
101+
that object. """
102+
self.output_typical_object_motion = False
103+
99104
""" House system as supported by pyswisseph. """
100105
self.house_system = chart.PLACIDUS
101106

immanuel/tools/calculate.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import swisseph as swe
1313

14-
from immanuel.const import calc
14+
from immanuel.const import calc, chart
1515
from immanuel.tools import ephemeris
1616

1717

@@ -58,6 +58,18 @@ def object_movement(object: dict | float) -> int:
5858
return calc.DIRECT if speed > calc.STATION_SPEED else calc.RETROGRADE
5959

6060

61+
def object_movement_typical(object: dict) -> bool:
62+
""" Returns whether an object's movement is typical, ie. direct for planets,
63+
retrograde for nodes, stationary for Part of Fortune and eclipses. """
64+
if object['index'] in (chart.PARS_FORTUNA, chart.PRE_NATAL_SOLAR_ECLIPSE, chart.PRE_NATAL_LUNAR_ECLIPSE, chart.POST_NATAL_SOLAR_ECLIPSE, chart.POST_NATAL_SOLAR_ECLIPSE):
65+
return True
66+
67+
movement = object_movement(object)
68+
is_node = object['index'] in (chart.NORTH_NODE, chart.SOUTH_NODE, chart.TRUE_NORTH_NODE, chart.TRUE_SOUTH_NODE)
69+
70+
return movement == calc.RETROGRADE if is_node else movement == calc.DIRECT
71+
72+
6173
def is_out_of_bounds(object: dict | float, jd: float = None, obliquity: float = None) -> bool:
6274
""" Returns whether the passed object is out of bounds either on the passed
6375
Julian date or relative to the passed obliquity. """

0 commit comments

Comments
 (0)