Skip to main content

Quickly produce both human-readable and JSON-formatted astrology chart data based on the Swiss Ephemeris and astro.com.

Project description

Immanuel is a Python >= 3.10 package to painlessly provide your application with simple yet detailed chart-centric astrology data for planets, points, signs, houses, aspects, weightings, etc. all based on the Swiss Ephemeris. Extra calculations, notably secondary progressions and dignity scores, are modeled on those of astro.com and Astro Gold.

Data for natal charts, solar returns, progressions, and composites are available, as well as the ability to point the aspects from any one chart instance to the planets in another, creating a flexible method to build synastries.

Simply pass in a date and coordinates to one of the available chart classes, and the returned instance will contain all data necessary to construct a full astrological chart. A serializer is bundled to easily output all data as JSON, or it can simply be printed out as human-readable text.

Documentation

Full documentation is available here, or follow the Quick Start below to see how to quickly generate a natal chart.

Translations

Immanuel is currently available in the following locales / languages:

  • en_US: (default) US English
  • pt_BR: Brazilian Portuguese
  • Coming soon: Spanish translation

See the documentation on how to switch. The documentation itself is not currently available in other translations. To contribute translations, see below.

Quick Start

You can get started with full natal chart data in minutes. Simply install Immanuel:

pip install immanuel

Once you've imported Immanuel's chart classes into your application, you will need to hand them a person or event. This is made easy with the Subject class, which takes a date and geographical coordinates. The date can be an ISO-formatted string or a Python datetime instance, and coordinates can be strings or decimals.

from immanuel import charts


native = charts.Subject(
        date_time='2000-01-01 10:00',
        latitude='32n43',
        longitude='117w09'
    )

natal = charts.Natal(native)

for object in natal.objects.values():
    print(object)

This will output all the chart objects (planets, points, asteroids etc.) in this format:

Sun 10°37'26" in Capricorn, 11th House, Direct
Moon 16°19'29" in Scorpio, 8th House, Direct
Mercury 02°16'43" in Capricorn, 10th House, Direct
Venus 01°52'05" in Sagittarius, 9th House, Direct
Mars 28°09'26" in Aquarius, 12th House, Direct
Jupiter 25°15'48" in Aries, 2nd House, Direct
Saturn 10°23'27" in Taurus, 2nd House, Retrograde
Uranus 14°49'19" in Aquarius, 12th House, Direct
Neptune 03°12'07" in Aquarius, 12th House, Direct
Pluto 11°27'49" in Sagittarius, 9th House, Direct
...

Add asteroid Ceres into the mix:

from immanuel import charts
from immanuel.const import chart
from immanuel.setup import settings


native = charts.Subject(
        date_time='2000-01-01 10:00',
        latitude='32n43',
        longitude='117w09'
    )

settings.objects.append(chart.CERES)
natal = charts.Natal(native)

for object in natal.objects.values():
    print(object)

Now you will see this appended to the list:

Ceres 04°30'28" in Libra, 7th House, Direct

More on the settings & constants in the full documentation - for now, we can see much more data by serializing the chart's objects property to JSON like this:

import json

from immanuel.classes.serialize import ToJSON
from immanuel import charts


native = charts.Subject(
        date_time='2000-01-01 10:00',
        latitude='32n43',
        longitude='117w09'
    )

natal = charts.Natal(native)

print(json.dumps(natal.objects, cls=ToJSON, indent=4))

Which will output each of the chart's objects in this format:

{
    "index": 4000001,
    "name": "Sun",
    "type": {
        "index": 4000000,
        "name": "Planet"
    },
    "latitude": {
        "raw": 0.0002259471008556382,
        "formatted": "00\u00b000'01\"",
        "direction": "+",
        "degrees": 0,
        "minutes": 0,
        "seconds": 1
    },
    "longitude": {
        "raw": 280.6237802656368,
        "formatted": "280\u00b037'26\"",
        "direction": "+",
        "degrees": 280,
        "minutes": 37,
        "seconds": 26
    },
    "sign_longitude": {
        "raw": 10.62378026563681,
        "formatted": "10\u00b037'26\"",
        "direction": "+",
        "degrees": 10,
        "minutes": 37,
        "seconds": 26
    },
    "sign": {
        "number": 10,
        "name": "Capricorn",
        "element": "Earth",
        "modality": "Cardinal"
    },
    "decan": {
        "number": 2,
        "name": "2nd Decan"
    },
    "house": {
        "index": 2000011,
        "number": 11,
        "name": "11th House"
    },
    "distance": 0.9833259257690341,
    "speed": 1.0194579691359147,
    "movement": {
        "direct": true,
        "stationary": false,
        "retrograde": false,
        "formatted": "Direct"
    },
    "declination": {
        "raw": -23.01236501586868,
        "formatted": "-23\u00b000'45\"",
        "direction": "-",
        "degrees": 23,
        "minutes": 0,
        "seconds": 45
    },
    "out_of_bounds": false,
    "dignities": {
        "ruler": false,
        "exalted": false,
        "triplicity_ruler": false,
        "term_ruler": false,
        "face_ruler": false,
        "mutual_reception_ruler": false,
        "mutual_reception_exalted": false,
        "mutual_reception_triplicity_ruler": true,
        "mutual_reception_term_ruler": false,
        "mutual_reception_face_ruler": false,
        "detriment": false,
        "fall": false,
        "peregrine": false,
        "formatted": [
            "Triplicity Ruler by mutual reception"
        ]
    },
    "score": 3
}

Note that the entire chart can also be serialized to JSON, eg.:

print(json.dumps(natal, cls=ToJSON, indent=4))

Chart Types

Currently Immanuel supports the following chart types:

  • Natal
  • Solar return
  • Progressed
  • Composite
  • Transits

Synastry is also available with an extra step - all chart classes allow an instance of another chart class to be passed as an argument, which will then calculate the main chart's aspects in relation to the passed chart. This way synastry (and transit) charts can be generated with great flexibility.

Returned Chart Data

The various chart types return their own sets of data, but you can expect to receive at least the following in all of them:

  • Chart date
  • Chart coordinates
  • House system
  • Chart shape type (eg. bowl, splash etc.)
  • Whether the chart is diurnal (ie. daytime)
  • Moon phase
  • All chart objects (eg. planets, asteroids, primary angles etc.) and their positions & dignities if applicable
  • Houses
  • Aspects
  • Weightings (ie. which objects are in which elements / modalities etc.)

All properties are available in both human-readable and JSON format as demonstrated above.

Calculations

Immanuel offers the same three methods for MC progression as astro.com, and will produce the same progressed date, sidereal time, and house positions.

Planetary dignity scores are based on those of Astro Gold, although these are somewhat flexible via the settings.

Settings

The full documentation covers settings in detail, but much of the output can be customized. The settings class allows you to specify and personalize:

  • The house system to use
  • What data each chart returns
  • What planets, points, asteroid etc. to include
  • Details of the aspect calculations
  • Which dignities to use and their scores
  • The progression method to use for secondary progressions
  • ...and much more.

Tests

Tests are available via pytest. If you have cloned the repo, simply run pytest from the root:

python -m pytest

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

Credits

Immanuel is forever indebted to the pioneering work of Alois Treindl and Dieter Koch at Astrodienst, and to João Ventura for the incredibly detailed flatlib which first inspired the development of this package.

A big thank-you goes to Nathan Octavio who suggested translations, and who translated Immanuel into Brazilian Portuguese.

Contributions

New translations for Immanuel's output are always welcome, although it is currently geared to Western-European languages. If you would like to contribute a translation, follow these steps:

  • Fork the repo.
  • Create a branch named after the locale, eg. translations/pr_BR - locale names for various languages can be found online, for example here, although you should use an underscore rather than a hyphen.
  • Create a subdirectory in /immanuel/locales named after your locale code, and another sub-directory under this called LC_MESSAGES.
  • Copy locales/immanuel.pot into the new LC_MESSAGES sub-directory and rename it immanuel.po.
  • Within immanuel.po, for every English word or sentence in a msgid string, if there is a direct translation in your language, enter it in the following empty msgstr. For gendered adjectives, you will need to add all gendered variants using msgctxt like this:
msgctxt "masculine"
msgid "Applicative"
msgstr "Aplicativo"

msgctxt "feminine"
msgid "Applicative"
msgstr "Aplicativa"
  • To map genders, a file mappings.py will need to be created under your new locale directory alongside LC_MESSAGES. See existing mapping files for an example of how to assign all of Immanuel's objects a gender for your language.
  • Once all translations and gender-mapping is complete, you can either compile your .po file to an .mo file or simply leave this out and I will compile it. Commit your changes and create a pull request.
  • If everything looks good, I will merge to master & prep a new release!

Contact

Please post any issues, feature requests, PRs etc. on GitHub. For anything else email robert@theriftlab.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

immanuel-1.3.2.tar.gz (9.1 MB view hashes)

Uploaded Source

Built Distribution

immanuel-1.3.2-py3-none-any.whl (9.1 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page