Skip to content

Commit

Permalink
Refined Chart.house_for().
Browse files Browse the repository at this point in the history
  • Loading branch information
theriftlab committed Jan 20, 2024
1 parent 5c093fd commit 24361e3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Simply pass in a date and coordinates to one of the available chart classes, and

## Documentation

Full documentation is available [here](https://github.com/theriftlab/immanuel-python/tree/v1.2.0/docs/0-contents.md), or follow the Quick Start below to see how to quickly generate a natal chart.
Full documentation is available [here](https://github.com/theriftlab/immanuel-python/tree/v1.2.1/docs/0-contents.md), or follow the Quick Start below to see how to quickly generate a natal chart.

## Quick Start

Expand Down
2 changes: 1 addition & 1 deletion docs/3-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ native_chart = charts.Natal(native, aspects_to=partner_chart)

Now `native_chart`'s planets/objects will aspect `partner_chart`'s planets/objects instead of its own. This makes things very flexible - a synastry chart can be created as above, with two natal charts, or a natal+transits chart can be created by passing a transits chart into a natal chart. It might also be useful to pass transits into a progressed or composite chart. You could even pass a composite chart into another composite chart to view synastry aspects between them.

All chart instances additionally feature a `house_for()` method which takes a chart object as a parameter. This simply returns the house object for where the passed chart object would appear in the current chart. This can be useful in conjunction with the above functionality to see which houses a transiting planet is in, or which houses in your chart a partner's planets appear.
All chart instances additionally feature a `house_for()` method which takes a chart object as a parameter. This simply returns the index of the current chart's house where the passed chart object would appear. This can be useful in conjunction with the above functionality to see which houses a transiting planet is in, or which houses in your chart a partner's planets appear.

## Human-Readable

Expand Down
9 changes: 5 additions & 4 deletions immanuel/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ def __init__(self, type: int, aspects_to: 'Chart' = None) -> None:
self.generate()
self.wrap()

def house_for(self, object: wrap.Object) -> wrap.Object:
""" Returns the house where any passed arbitrary object would appear in
the current chart. Useful for synastries and transit charts. """
return wrap.Object(object=position.house(object.longitude.raw, self._houses))
def house_for(self, object: wrap.Object) -> int:
""" Returns the index of the house where any passed arbitrary object
would appear in the current chart. Useful for synastries and
transit charts. """
return position.house(object.longitude.raw, self._houses)['index']

def generate(self) -> None:
""" Generating the raw data is each descendant class's responsibility,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "immanuel"
version = "1.2.0"
version = "1.2.1"
description = "Quickly produce both human-readable and JSON-formatted astrology chart data based on the Swiss Ephemeris and astro.com."
authors = [
{ name = "Robert Davies", email = "[email protected]" },
Expand Down
8 changes: 4 additions & 4 deletions tests/test_charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ def test_synastry(native, partner):
assert native_chart.aspects[chart.MOON][chart.MERCURY].aspect == calc.SQUARE

# Spot-check house_for() against astro.com
assert native_chart.house_for(partner_chart.objects[chart.SUN]).number == 12
assert partner_chart.house_for(native_chart.objects[chart.SUN]).number == 11
assert native_chart.house_for(partner_chart.objects[chart.SUN]) == chart.HOUSE12
assert partner_chart.house_for(native_chart.objects[chart.SUN]) == chart.HOUSE11

assert native_chart.house_for(partner_chart.objects[chart.MOON]).number == 9
assert partner_chart.house_for(native_chart.objects[chart.MOON]).number == 9
assert native_chart.house_for(partner_chart.objects[chart.MOON]) == chart.HOUSE9
assert partner_chart.house_for(native_chart.objects[chart.MOON]) == chart.HOUSE9

0 comments on commit 24361e3

Please sign in to comment.