Skip to content

API Reference: Enums

Planet Enum

enums

Enums module for ndastro_engine.

This module provides access to all enum types used in ndastro calculations: - Houses: Astrological houses - Natchaththirams: Nakshatra (lunar mansion) enumerations - Planets: Planetary bodies - Rasis: Zodiac signs (rasis)

Houses

Bases: IntEnum

Enum to hold houses.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/house_enum.py
class Houses(IntEnum):
    """Enum to hold houses."""

    HOUSE1 = 1
    HOUSE2 = 2
    HOUSE3 = 3
    HOUSE4 = 4
    HOUSE5 = 5
    HOUSE6 = 6
    HOUSE7 = 7
    HOUSE8 = 8
    HOUSE9 = 9
    HOUSE10 = 10
    HOUSE11 = 11
    HOUSE12 = 12

    def __str__(self) -> str:
        """Return name of the house.

        Returns:
            str: name of the house

        """
        return self.name

    @property
    def owner(self) -> Planets:
        """Get the owner of a given house.

        Returns:
            Planets: The owner of the house.

        """
        house_to_planet = {
            1: Planets.MARS,
            2: Planets.VENUS,
            3: Planets.MERCURY,
            4: Planets.MOON,
            5: Planets.SUN,
            6: Planets.MERCURY,
            7: Planets.VENUS,
            8: Planets.MARS,
            9: Planets.JUPITER,
            10: Planets.SATURN,
            11: Planets.SATURN,
            12: Planets.JUPITER,
        }
        return house_to_planet[self.value]
owner property

Get the owner of a given house.

Returns:

Name Type Description
Planets Planets

The owner of the house.

__str__()

Return name of the house.

Returns:

Name Type Description
str str

name of the house

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/house_enum.py
def __str__(self) -> str:
    """Return name of the house.

    Returns:
        str: name of the house

    """
    return self.name

Natchaththirams

Bases: Enum

Enum to hold stars.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
class Natchaththirams(Enum):
    """Enum to hold stars."""

    ASWINNI = 1
    BHARANI = 2
    KAARTHIKAI = 3
    ROGHINI = 4
    MIRUGASIRISAM = 5
    THIRUVAATHIRAI = 6
    PUNARPOOSAM = 7
    POOSAM = 8
    AAYILYAM = 9
    MAGAM = 10
    POORAM = 11
    UTHTHIRAM = 12
    ASTHTHAM = 13
    CHITHTHIRAI = 14
    SUVAATHI = 15
    VISAAGAM = 16
    ANUSHAM = 17
    KETTAI = 18
    MOOLAM = 19
    POORAADAM = 20
    UTHTHIRAADAM = 21
    THIRUVONAM = 22
    AVITTAM = 23
    SHATHAYAM = 24
    POORATTAATHI = 25
    UTHTHIRATTAATHI = 26
    REVATHI = 27

    def __str__(self) -> str:
        """Return the display name of the star.

        Returns:
            str: The display name of the star.

        """
        return self.name

    @property
    def owner(self) -> Planets:
        """Return the owner (planet) of the star.

        Returns:
            str: The name of the planet that owns the star.

        """
        owners = {
            1: "kethu",
            2: "venus",
            3: "sun",
            4: "moon",
            5: "mars barycenter",
            6: "rahu",
            7: "jupiter barycenter",
            8: "saturn barycenter",
            9: "mercury",
            10: "kethu",
            11: "venus",
            12: "sun",
            13: "moon",
            14: "mars barycenter",
            15: "rahu",
            16: "jupiter barycenter",
            17: "saturn barycenter",
            18: "mercury",
            19: "kethu",
            20: "venus",
            21: "sun",
            22: "moon",
            23: "mars barycenter",
            24: "rahu",
            25: "jupiter barycenter",
            26: "saturn barycenter",
            27: "mercury",
        }

        return Planets.from_code(owners[self.value])

    @staticmethod
    def to_string(num: int) -> str:
        """Convert star number to display name of the star.

        Args:
            num (int): the star number

        Returns:
            str: return the star name

        """
        return Natchaththirams(num).name

    @staticmethod
    def to_list() -> list[str]:
        """Convert enum to list of enum item name.

        Returns:
            list[str]: list of enum item name

        """
        return [el.name for el in Natchaththirams]
owner property

Return the owner (planet) of the star.

Returns:

Name Type Description
str Planets

The name of the planet that owns the star.

__str__()

Return the display name of the star.

Returns:

Name Type Description
str str

The display name of the star.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
def __str__(self) -> str:
    """Return the display name of the star.

    Returns:
        str: The display name of the star.

    """
    return self.name
to_list() staticmethod

Convert enum to list of enum item name.

Returns:

Type Description
list[str]

list[str]: list of enum item name

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
@staticmethod
def to_list() -> list[str]:
    """Convert enum to list of enum item name.

    Returns:
        list[str]: list of enum item name

    """
    return [el.name for el in Natchaththirams]
to_string(num) staticmethod

Convert star number to display name of the star.

Parameters:

Name Type Description Default
num int

the star number

required

Returns:

Name Type Description
str str

return the star name

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
@staticmethod
def to_string(num: int) -> str:
    """Convert star number to display name of the star.

    Args:
        num (int): the star number

    Returns:
        str: return the star name

    """
    return Natchaththirams(num).name

Planets

Bases: IntEnum

Enum to hold planets.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
class Planets(IntEnum):
    """Enum to hold planets."""

    EMPTY = -1
    ASCENDANT = 0
    SUN = 1
    MOON = 2
    MARS = 3
    MERCURY = 4
    JUPITER = 5
    VENUS = 6
    SATURN = 7
    RAHU = 8
    KETHU = 9

    @staticmethod
    def to_string(num: int) -> str:
        """Convert planet number to display name of the planet.

        Args:
            num (int): the planet number

        Returns:
            str: return the planet name

        """
        return Planets(num).name if num in Planets._value2member_map_ else "empty"

    @staticmethod
    def from_code(code: str) -> "Planets":
        """Convert planet code to planet enum.

        Args:
            code (str): the planet code

        Returns:
            Planets: the corresponding planet enum

        """
        planet_codes = {
            "empty": Planets.EMPTY,
            "ascendant": Planets.ASCENDANT,
            "sun": Planets.SUN,
            "moon": Planets.MOON,
            "mars barycenter": Planets.MARS,
            "mercury": Planets.MERCURY,
            "jupiter barycenter": Planets.JUPITER,
            "venus": Planets.VENUS,
            "saturn barycenter": Planets.SATURN,
            "rahu": Planets.RAHU,
            "kethu": Planets.KETHU,
        }

        return planet_codes.get(code, Planets.EMPTY)

    @staticmethod
    def to_list() -> list[str]:
        """Convert planet enum to list of planet name.

        Returns:
            list[str]: list of planet names

        """
        return [el.name for el in Planets]

    @property
    def code(self) -> str:
        """Return the planet code.

        Returns:
            str: the planet code

        """
        planet_codes = {
            Planets.EMPTY: "empty",
            Planets.ASCENDANT: "ascendant",
            Planets.SUN: "sun",
            Planets.MOON: "moon",
            Planets.MARS: "mars barycenter",
            Planets.MERCURY: "mercury",
            Planets.JUPITER: "jupiter barycenter",
            Planets.VENUS: "venus",
            Planets.SATURN: "saturn barycenter",
            Planets.RAHU: "rahu",
            Planets.KETHU: "kethu",
        }

        return planet_codes.get(self, "empty")

    @property
    def color(self) -> str:
        """Return the planet color code.

        Returns:
            str: the planet color code

        """
        planet_colors = {
            Planets.EMPTY: "#000000",  # Black
            Planets.ASCENDANT: "#FFFFFF",  # White
            Planets.SUN: "#FFD700",  # Gold
            Planets.MOON: "#C0C0C0",  # Silver
            Planets.MARS: "#FF0000",  # Red
            Planets.MERCURY: "#008000",  # Green
            Planets.JUPITER: "#FFFF00",  # Yellow
            Planets.VENUS: "#FF69B4",  # Pink
            Planets.SATURN: "#00008B",  # DarkBlue
            Planets.RAHU: "#8A2BE2",  # BlueViolet
            Planets.KETHU: "#8B0000",  # DarkRed
        }

        return planet_colors.get(self, "#000000")  # Default to Black
code property

Return the planet code.

Returns:

Name Type Description
str str

the planet code

color property

Return the planet color code.

Returns:

Name Type Description
str str

the planet color code

from_code(code) staticmethod

Convert planet code to planet enum.

Parameters:

Name Type Description Default
code str

the planet code

required

Returns:

Name Type Description
Planets Planets

the corresponding planet enum

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
@staticmethod
def from_code(code: str) -> "Planets":
    """Convert planet code to planet enum.

    Args:
        code (str): the planet code

    Returns:
        Planets: the corresponding planet enum

    """
    planet_codes = {
        "empty": Planets.EMPTY,
        "ascendant": Planets.ASCENDANT,
        "sun": Planets.SUN,
        "moon": Planets.MOON,
        "mars barycenter": Planets.MARS,
        "mercury": Planets.MERCURY,
        "jupiter barycenter": Planets.JUPITER,
        "venus": Planets.VENUS,
        "saturn barycenter": Planets.SATURN,
        "rahu": Planets.RAHU,
        "kethu": Planets.KETHU,
    }

    return planet_codes.get(code, Planets.EMPTY)
to_list() staticmethod

Convert planet enum to list of planet name.

Returns:

Type Description
list[str]

list[str]: list of planet names

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
@staticmethod
def to_list() -> list[str]:
    """Convert planet enum to list of planet name.

    Returns:
        list[str]: list of planet names

    """
    return [el.name for el in Planets]
to_string(num) staticmethod

Convert planet number to display name of the planet.

Parameters:

Name Type Description Default
num int

the planet number

required

Returns:

Name Type Description
str str

return the planet name

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
@staticmethod
def to_string(num: int) -> str:
    """Convert planet number to display name of the planet.

    Args:
        num (int): the planet number

    Returns:
        str: return the planet name

    """
    return Planets(num).name if num in Planets._value2member_map_ else "empty"

Rasis

Bases: IntEnum

Enum to represent Rasis.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
class Rasis(IntEnum):
    """Enum to represent Rasis."""

    ARIES = 1
    TAURUS = 2
    GEMINI = 3
    CANCER = 4
    LEO = 5
    VIRGO = 6
    LIBRA = 7
    SCORPIO = 8
    SAGITTARIUS = 9
    CAPRICORN = 10
    AQUARIUS = 11
    PISCES = 12

    def __str__(self) -> str:
        """Return a localized string representation of the Rasi.

        Returns:
            str: Localized name of the Rasi.

        """
        return self.name

    @property
    def owner(self) -> Planets | None:
        """Get the owner planet of a given Rasi.

        Args:
            rasi (int): The Rasi number.

        Returns:
            Planets | None: The owner planet of the Rasi or None if invalid Rasi.

        """
        rasi_to_planet = {
            1: Planets.MARS,
            2: Planets.VENUS,
            3: Planets.MERCURY,
            4: Planets.MOON,
            5: Planets.SUN,
            6: Planets.MERCURY,
            7: Planets.VENUS,
            8: Planets.MARS,
            9: Planets.JUPITER,
            10: Planets.SATURN,
            11: Planets.SATURN,
            12: Planets.JUPITER,
        }
        return rasi_to_planet[self.value]

    @classmethod
    def from_string(cls, rasi: str) -> Rasis:
        """Convert a Rasi name to its corresponding enum member.

        Args:
            rasi (str): The name of the Rasi.

        Returns:
            Rasis: The corresponding enum member.

        """
        return cls[rasi.upper()]

    @classmethod
    def to_string(cls) -> str:
        """Convert a Rasi enum member to its localized display name.

        Returns:
            str: Localized name of the Rasi.

        """
        return cls.name.name

    @staticmethod
    def to_list() -> list[str]:
        """Get a list of all Rasi names.

        Returns:
            list[str]: List of all Rasi names.

        """
        return [el.name for el in Rasis]

    @staticmethod
    def to_4x4list() -> list[list[str]]:
        """Get a 4x4 grid representation of Rasi names.

        Returns:
            list[list[str]]: 4x4 grid of Rasi names.

        """
        rasis = Rasis.to_list()

        return [
            [rasis[11], rasis[0], rasis[1], rasis[2]],
            [rasis[10], "", "", rasis[3]],
            [rasis[9], "", "", rasis[4]],
            [rasis[8], rasis[7], rasis[6], rasis[5]],
        ]
owner property

Get the owner planet of a given Rasi.

Parameters:

Name Type Description Default
rasi int

The Rasi number.

required

Returns:

Type Description
Planets | None

Planets | None: The owner planet of the Rasi or None if invalid Rasi.

__str__()

Return a localized string representation of the Rasi.

Returns:

Name Type Description
str str

Localized name of the Rasi.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
def __str__(self) -> str:
    """Return a localized string representation of the Rasi.

    Returns:
        str: Localized name of the Rasi.

    """
    return self.name
from_string(rasi) classmethod

Convert a Rasi name to its corresponding enum member.

Parameters:

Name Type Description Default
rasi str

The name of the Rasi.

required

Returns:

Name Type Description
Rasis Rasis

The corresponding enum member.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@classmethod
def from_string(cls, rasi: str) -> Rasis:
    """Convert a Rasi name to its corresponding enum member.

    Args:
        rasi (str): The name of the Rasi.

    Returns:
        Rasis: The corresponding enum member.

    """
    return cls[rasi.upper()]
to_4x4list() staticmethod

Get a 4x4 grid representation of Rasi names.

Returns:

Type Description
list[list[str]]

list[list[str]]: 4x4 grid of Rasi names.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@staticmethod
def to_4x4list() -> list[list[str]]:
    """Get a 4x4 grid representation of Rasi names.

    Returns:
        list[list[str]]: 4x4 grid of Rasi names.

    """
    rasis = Rasis.to_list()

    return [
        [rasis[11], rasis[0], rasis[1], rasis[2]],
        [rasis[10], "", "", rasis[3]],
        [rasis[9], "", "", rasis[4]],
        [rasis[8], rasis[7], rasis[6], rasis[5]],
    ]
to_list() staticmethod

Get a list of all Rasi names.

Returns:

Type Description
list[str]

list[str]: List of all Rasi names.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@staticmethod
def to_list() -> list[str]:
    """Get a list of all Rasi names.

    Returns:
        list[str]: List of all Rasi names.

    """
    return [el.name for el in Rasis]
to_string() classmethod

Convert a Rasi enum member to its localized display name.

Returns:

Name Type Description
str str

Localized name of the Rasi.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@classmethod
def to_string(cls) -> str:
    """Convert a Rasi enum member to its localized display name.

    Returns:
        str: Localized name of the Rasi.

    """
    return cls.name.name

House Enum

enums

Enums module for ndastro_engine.

This module provides access to all enum types used in ndastro calculations: - Houses: Astrological houses - Natchaththirams: Nakshatra (lunar mansion) enumerations - Planets: Planetary bodies - Rasis: Zodiac signs (rasis)

Houses

Bases: IntEnum

Enum to hold houses.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/house_enum.py
class Houses(IntEnum):
    """Enum to hold houses."""

    HOUSE1 = 1
    HOUSE2 = 2
    HOUSE3 = 3
    HOUSE4 = 4
    HOUSE5 = 5
    HOUSE6 = 6
    HOUSE7 = 7
    HOUSE8 = 8
    HOUSE9 = 9
    HOUSE10 = 10
    HOUSE11 = 11
    HOUSE12 = 12

    def __str__(self) -> str:
        """Return name of the house.

        Returns:
            str: name of the house

        """
        return self.name

    @property
    def owner(self) -> Planets:
        """Get the owner of a given house.

        Returns:
            Planets: The owner of the house.

        """
        house_to_planet = {
            1: Planets.MARS,
            2: Planets.VENUS,
            3: Planets.MERCURY,
            4: Planets.MOON,
            5: Planets.SUN,
            6: Planets.MERCURY,
            7: Planets.VENUS,
            8: Planets.MARS,
            9: Planets.JUPITER,
            10: Planets.SATURN,
            11: Planets.SATURN,
            12: Planets.JUPITER,
        }
        return house_to_planet[self.value]
owner property

Get the owner of a given house.

Returns:

Name Type Description
Planets Planets

The owner of the house.

__str__()

Return name of the house.

Returns:

Name Type Description
str str

name of the house

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/house_enum.py
def __str__(self) -> str:
    """Return name of the house.

    Returns:
        str: name of the house

    """
    return self.name

Natchaththirams

Bases: Enum

Enum to hold stars.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
class Natchaththirams(Enum):
    """Enum to hold stars."""

    ASWINNI = 1
    BHARANI = 2
    KAARTHIKAI = 3
    ROGHINI = 4
    MIRUGASIRISAM = 5
    THIRUVAATHIRAI = 6
    PUNARPOOSAM = 7
    POOSAM = 8
    AAYILYAM = 9
    MAGAM = 10
    POORAM = 11
    UTHTHIRAM = 12
    ASTHTHAM = 13
    CHITHTHIRAI = 14
    SUVAATHI = 15
    VISAAGAM = 16
    ANUSHAM = 17
    KETTAI = 18
    MOOLAM = 19
    POORAADAM = 20
    UTHTHIRAADAM = 21
    THIRUVONAM = 22
    AVITTAM = 23
    SHATHAYAM = 24
    POORATTAATHI = 25
    UTHTHIRATTAATHI = 26
    REVATHI = 27

    def __str__(self) -> str:
        """Return the display name of the star.

        Returns:
            str: The display name of the star.

        """
        return self.name

    @property
    def owner(self) -> Planets:
        """Return the owner (planet) of the star.

        Returns:
            str: The name of the planet that owns the star.

        """
        owners = {
            1: "kethu",
            2: "venus",
            3: "sun",
            4: "moon",
            5: "mars barycenter",
            6: "rahu",
            7: "jupiter barycenter",
            8: "saturn barycenter",
            9: "mercury",
            10: "kethu",
            11: "venus",
            12: "sun",
            13: "moon",
            14: "mars barycenter",
            15: "rahu",
            16: "jupiter barycenter",
            17: "saturn barycenter",
            18: "mercury",
            19: "kethu",
            20: "venus",
            21: "sun",
            22: "moon",
            23: "mars barycenter",
            24: "rahu",
            25: "jupiter barycenter",
            26: "saturn barycenter",
            27: "mercury",
        }

        return Planets.from_code(owners[self.value])

    @staticmethod
    def to_string(num: int) -> str:
        """Convert star number to display name of the star.

        Args:
            num (int): the star number

        Returns:
            str: return the star name

        """
        return Natchaththirams(num).name

    @staticmethod
    def to_list() -> list[str]:
        """Convert enum to list of enum item name.

        Returns:
            list[str]: list of enum item name

        """
        return [el.name for el in Natchaththirams]
owner property

Return the owner (planet) of the star.

Returns:

Name Type Description
str Planets

The name of the planet that owns the star.

__str__()

Return the display name of the star.

Returns:

Name Type Description
str str

The display name of the star.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
def __str__(self) -> str:
    """Return the display name of the star.

    Returns:
        str: The display name of the star.

    """
    return self.name
to_list() staticmethod

Convert enum to list of enum item name.

Returns:

Type Description
list[str]

list[str]: list of enum item name

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
@staticmethod
def to_list() -> list[str]:
    """Convert enum to list of enum item name.

    Returns:
        list[str]: list of enum item name

    """
    return [el.name for el in Natchaththirams]
to_string(num) staticmethod

Convert star number to display name of the star.

Parameters:

Name Type Description Default
num int

the star number

required

Returns:

Name Type Description
str str

return the star name

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
@staticmethod
def to_string(num: int) -> str:
    """Convert star number to display name of the star.

    Args:
        num (int): the star number

    Returns:
        str: return the star name

    """
    return Natchaththirams(num).name

Planets

Bases: IntEnum

Enum to hold planets.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
class Planets(IntEnum):
    """Enum to hold planets."""

    EMPTY = -1
    ASCENDANT = 0
    SUN = 1
    MOON = 2
    MARS = 3
    MERCURY = 4
    JUPITER = 5
    VENUS = 6
    SATURN = 7
    RAHU = 8
    KETHU = 9

    @staticmethod
    def to_string(num: int) -> str:
        """Convert planet number to display name of the planet.

        Args:
            num (int): the planet number

        Returns:
            str: return the planet name

        """
        return Planets(num).name if num in Planets._value2member_map_ else "empty"

    @staticmethod
    def from_code(code: str) -> "Planets":
        """Convert planet code to planet enum.

        Args:
            code (str): the planet code

        Returns:
            Planets: the corresponding planet enum

        """
        planet_codes = {
            "empty": Planets.EMPTY,
            "ascendant": Planets.ASCENDANT,
            "sun": Planets.SUN,
            "moon": Planets.MOON,
            "mars barycenter": Planets.MARS,
            "mercury": Planets.MERCURY,
            "jupiter barycenter": Planets.JUPITER,
            "venus": Planets.VENUS,
            "saturn barycenter": Planets.SATURN,
            "rahu": Planets.RAHU,
            "kethu": Planets.KETHU,
        }

        return planet_codes.get(code, Planets.EMPTY)

    @staticmethod
    def to_list() -> list[str]:
        """Convert planet enum to list of planet name.

        Returns:
            list[str]: list of planet names

        """
        return [el.name for el in Planets]

    @property
    def code(self) -> str:
        """Return the planet code.

        Returns:
            str: the planet code

        """
        planet_codes = {
            Planets.EMPTY: "empty",
            Planets.ASCENDANT: "ascendant",
            Planets.SUN: "sun",
            Planets.MOON: "moon",
            Planets.MARS: "mars barycenter",
            Planets.MERCURY: "mercury",
            Planets.JUPITER: "jupiter barycenter",
            Planets.VENUS: "venus",
            Planets.SATURN: "saturn barycenter",
            Planets.RAHU: "rahu",
            Planets.KETHU: "kethu",
        }

        return planet_codes.get(self, "empty")

    @property
    def color(self) -> str:
        """Return the planet color code.

        Returns:
            str: the planet color code

        """
        planet_colors = {
            Planets.EMPTY: "#000000",  # Black
            Planets.ASCENDANT: "#FFFFFF",  # White
            Planets.SUN: "#FFD700",  # Gold
            Planets.MOON: "#C0C0C0",  # Silver
            Planets.MARS: "#FF0000",  # Red
            Planets.MERCURY: "#008000",  # Green
            Planets.JUPITER: "#FFFF00",  # Yellow
            Planets.VENUS: "#FF69B4",  # Pink
            Planets.SATURN: "#00008B",  # DarkBlue
            Planets.RAHU: "#8A2BE2",  # BlueViolet
            Planets.KETHU: "#8B0000",  # DarkRed
        }

        return planet_colors.get(self, "#000000")  # Default to Black
code property

Return the planet code.

Returns:

Name Type Description
str str

the planet code

color property

Return the planet color code.

Returns:

Name Type Description
str str

the planet color code

from_code(code) staticmethod

Convert planet code to planet enum.

Parameters:

Name Type Description Default
code str

the planet code

required

Returns:

Name Type Description
Planets Planets

the corresponding planet enum

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
@staticmethod
def from_code(code: str) -> "Planets":
    """Convert planet code to planet enum.

    Args:
        code (str): the planet code

    Returns:
        Planets: the corresponding planet enum

    """
    planet_codes = {
        "empty": Planets.EMPTY,
        "ascendant": Planets.ASCENDANT,
        "sun": Planets.SUN,
        "moon": Planets.MOON,
        "mars barycenter": Planets.MARS,
        "mercury": Planets.MERCURY,
        "jupiter barycenter": Planets.JUPITER,
        "venus": Planets.VENUS,
        "saturn barycenter": Planets.SATURN,
        "rahu": Planets.RAHU,
        "kethu": Planets.KETHU,
    }

    return planet_codes.get(code, Planets.EMPTY)
to_list() staticmethod

Convert planet enum to list of planet name.

Returns:

Type Description
list[str]

list[str]: list of planet names

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
@staticmethod
def to_list() -> list[str]:
    """Convert planet enum to list of planet name.

    Returns:
        list[str]: list of planet names

    """
    return [el.name for el in Planets]
to_string(num) staticmethod

Convert planet number to display name of the planet.

Parameters:

Name Type Description Default
num int

the planet number

required

Returns:

Name Type Description
str str

return the planet name

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
@staticmethod
def to_string(num: int) -> str:
    """Convert planet number to display name of the planet.

    Args:
        num (int): the planet number

    Returns:
        str: return the planet name

    """
    return Planets(num).name if num in Planets._value2member_map_ else "empty"

Rasis

Bases: IntEnum

Enum to represent Rasis.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
class Rasis(IntEnum):
    """Enum to represent Rasis."""

    ARIES = 1
    TAURUS = 2
    GEMINI = 3
    CANCER = 4
    LEO = 5
    VIRGO = 6
    LIBRA = 7
    SCORPIO = 8
    SAGITTARIUS = 9
    CAPRICORN = 10
    AQUARIUS = 11
    PISCES = 12

    def __str__(self) -> str:
        """Return a localized string representation of the Rasi.

        Returns:
            str: Localized name of the Rasi.

        """
        return self.name

    @property
    def owner(self) -> Planets | None:
        """Get the owner planet of a given Rasi.

        Args:
            rasi (int): The Rasi number.

        Returns:
            Planets | None: The owner planet of the Rasi or None if invalid Rasi.

        """
        rasi_to_planet = {
            1: Planets.MARS,
            2: Planets.VENUS,
            3: Planets.MERCURY,
            4: Planets.MOON,
            5: Planets.SUN,
            6: Planets.MERCURY,
            7: Planets.VENUS,
            8: Planets.MARS,
            9: Planets.JUPITER,
            10: Planets.SATURN,
            11: Planets.SATURN,
            12: Planets.JUPITER,
        }
        return rasi_to_planet[self.value]

    @classmethod
    def from_string(cls, rasi: str) -> Rasis:
        """Convert a Rasi name to its corresponding enum member.

        Args:
            rasi (str): The name of the Rasi.

        Returns:
            Rasis: The corresponding enum member.

        """
        return cls[rasi.upper()]

    @classmethod
    def to_string(cls) -> str:
        """Convert a Rasi enum member to its localized display name.

        Returns:
            str: Localized name of the Rasi.

        """
        return cls.name.name

    @staticmethod
    def to_list() -> list[str]:
        """Get a list of all Rasi names.

        Returns:
            list[str]: List of all Rasi names.

        """
        return [el.name for el in Rasis]

    @staticmethod
    def to_4x4list() -> list[list[str]]:
        """Get a 4x4 grid representation of Rasi names.

        Returns:
            list[list[str]]: 4x4 grid of Rasi names.

        """
        rasis = Rasis.to_list()

        return [
            [rasis[11], rasis[0], rasis[1], rasis[2]],
            [rasis[10], "", "", rasis[3]],
            [rasis[9], "", "", rasis[4]],
            [rasis[8], rasis[7], rasis[6], rasis[5]],
        ]
owner property

Get the owner planet of a given Rasi.

Parameters:

Name Type Description Default
rasi int

The Rasi number.

required

Returns:

Type Description
Planets | None

Planets | None: The owner planet of the Rasi or None if invalid Rasi.

__str__()

Return a localized string representation of the Rasi.

Returns:

Name Type Description
str str

Localized name of the Rasi.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
def __str__(self) -> str:
    """Return a localized string representation of the Rasi.

    Returns:
        str: Localized name of the Rasi.

    """
    return self.name
from_string(rasi) classmethod

Convert a Rasi name to its corresponding enum member.

Parameters:

Name Type Description Default
rasi str

The name of the Rasi.

required

Returns:

Name Type Description
Rasis Rasis

The corresponding enum member.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@classmethod
def from_string(cls, rasi: str) -> Rasis:
    """Convert a Rasi name to its corresponding enum member.

    Args:
        rasi (str): The name of the Rasi.

    Returns:
        Rasis: The corresponding enum member.

    """
    return cls[rasi.upper()]
to_4x4list() staticmethod

Get a 4x4 grid representation of Rasi names.

Returns:

Type Description
list[list[str]]

list[list[str]]: 4x4 grid of Rasi names.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@staticmethod
def to_4x4list() -> list[list[str]]:
    """Get a 4x4 grid representation of Rasi names.

    Returns:
        list[list[str]]: 4x4 grid of Rasi names.

    """
    rasis = Rasis.to_list()

    return [
        [rasis[11], rasis[0], rasis[1], rasis[2]],
        [rasis[10], "", "", rasis[3]],
        [rasis[9], "", "", rasis[4]],
        [rasis[8], rasis[7], rasis[6], rasis[5]],
    ]
to_list() staticmethod

Get a list of all Rasi names.

Returns:

Type Description
list[str]

list[str]: List of all Rasi names.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@staticmethod
def to_list() -> list[str]:
    """Get a list of all Rasi names.

    Returns:
        list[str]: List of all Rasi names.

    """
    return [el.name for el in Rasis]
to_string() classmethod

Convert a Rasi enum member to its localized display name.

Returns:

Name Type Description
str str

Localized name of the Rasi.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@classmethod
def to_string(cls) -> str:
    """Convert a Rasi enum member to its localized display name.

    Returns:
        str: Localized name of the Rasi.

    """
    return cls.name.name

Nakshatra Enum

enums

Enums module for ndastro_engine.

This module provides access to all enum types used in ndastro calculations: - Houses: Astrological houses - Natchaththirams: Nakshatra (lunar mansion) enumerations - Planets: Planetary bodies - Rasis: Zodiac signs (rasis)

Houses

Bases: IntEnum

Enum to hold houses.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/house_enum.py
class Houses(IntEnum):
    """Enum to hold houses."""

    HOUSE1 = 1
    HOUSE2 = 2
    HOUSE3 = 3
    HOUSE4 = 4
    HOUSE5 = 5
    HOUSE6 = 6
    HOUSE7 = 7
    HOUSE8 = 8
    HOUSE9 = 9
    HOUSE10 = 10
    HOUSE11 = 11
    HOUSE12 = 12

    def __str__(self) -> str:
        """Return name of the house.

        Returns:
            str: name of the house

        """
        return self.name

    @property
    def owner(self) -> Planets:
        """Get the owner of a given house.

        Returns:
            Planets: The owner of the house.

        """
        house_to_planet = {
            1: Planets.MARS,
            2: Planets.VENUS,
            3: Planets.MERCURY,
            4: Planets.MOON,
            5: Planets.SUN,
            6: Planets.MERCURY,
            7: Planets.VENUS,
            8: Planets.MARS,
            9: Planets.JUPITER,
            10: Planets.SATURN,
            11: Planets.SATURN,
            12: Planets.JUPITER,
        }
        return house_to_planet[self.value]
owner property

Get the owner of a given house.

Returns:

Name Type Description
Planets Planets

The owner of the house.

__str__()

Return name of the house.

Returns:

Name Type Description
str str

name of the house

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/house_enum.py
def __str__(self) -> str:
    """Return name of the house.

    Returns:
        str: name of the house

    """
    return self.name

Natchaththirams

Bases: Enum

Enum to hold stars.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
class Natchaththirams(Enum):
    """Enum to hold stars."""

    ASWINNI = 1
    BHARANI = 2
    KAARTHIKAI = 3
    ROGHINI = 4
    MIRUGASIRISAM = 5
    THIRUVAATHIRAI = 6
    PUNARPOOSAM = 7
    POOSAM = 8
    AAYILYAM = 9
    MAGAM = 10
    POORAM = 11
    UTHTHIRAM = 12
    ASTHTHAM = 13
    CHITHTHIRAI = 14
    SUVAATHI = 15
    VISAAGAM = 16
    ANUSHAM = 17
    KETTAI = 18
    MOOLAM = 19
    POORAADAM = 20
    UTHTHIRAADAM = 21
    THIRUVONAM = 22
    AVITTAM = 23
    SHATHAYAM = 24
    POORATTAATHI = 25
    UTHTHIRATTAATHI = 26
    REVATHI = 27

    def __str__(self) -> str:
        """Return the display name of the star.

        Returns:
            str: The display name of the star.

        """
        return self.name

    @property
    def owner(self) -> Planets:
        """Return the owner (planet) of the star.

        Returns:
            str: The name of the planet that owns the star.

        """
        owners = {
            1: "kethu",
            2: "venus",
            3: "sun",
            4: "moon",
            5: "mars barycenter",
            6: "rahu",
            7: "jupiter barycenter",
            8: "saturn barycenter",
            9: "mercury",
            10: "kethu",
            11: "venus",
            12: "sun",
            13: "moon",
            14: "mars barycenter",
            15: "rahu",
            16: "jupiter barycenter",
            17: "saturn barycenter",
            18: "mercury",
            19: "kethu",
            20: "venus",
            21: "sun",
            22: "moon",
            23: "mars barycenter",
            24: "rahu",
            25: "jupiter barycenter",
            26: "saturn barycenter",
            27: "mercury",
        }

        return Planets.from_code(owners[self.value])

    @staticmethod
    def to_string(num: int) -> str:
        """Convert star number to display name of the star.

        Args:
            num (int): the star number

        Returns:
            str: return the star name

        """
        return Natchaththirams(num).name

    @staticmethod
    def to_list() -> list[str]:
        """Convert enum to list of enum item name.

        Returns:
            list[str]: list of enum item name

        """
        return [el.name for el in Natchaththirams]
owner property

Return the owner (planet) of the star.

Returns:

Name Type Description
str Planets

The name of the planet that owns the star.

__str__()

Return the display name of the star.

Returns:

Name Type Description
str str

The display name of the star.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
def __str__(self) -> str:
    """Return the display name of the star.

    Returns:
        str: The display name of the star.

    """
    return self.name
to_list() staticmethod

Convert enum to list of enum item name.

Returns:

Type Description
list[str]

list[str]: list of enum item name

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
@staticmethod
def to_list() -> list[str]:
    """Convert enum to list of enum item name.

    Returns:
        list[str]: list of enum item name

    """
    return [el.name for el in Natchaththirams]
to_string(num) staticmethod

Convert star number to display name of the star.

Parameters:

Name Type Description Default
num int

the star number

required

Returns:

Name Type Description
str str

return the star name

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
@staticmethod
def to_string(num: int) -> str:
    """Convert star number to display name of the star.

    Args:
        num (int): the star number

    Returns:
        str: return the star name

    """
    return Natchaththirams(num).name

Planets

Bases: IntEnum

Enum to hold planets.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
class Planets(IntEnum):
    """Enum to hold planets."""

    EMPTY = -1
    ASCENDANT = 0
    SUN = 1
    MOON = 2
    MARS = 3
    MERCURY = 4
    JUPITER = 5
    VENUS = 6
    SATURN = 7
    RAHU = 8
    KETHU = 9

    @staticmethod
    def to_string(num: int) -> str:
        """Convert planet number to display name of the planet.

        Args:
            num (int): the planet number

        Returns:
            str: return the planet name

        """
        return Planets(num).name if num in Planets._value2member_map_ else "empty"

    @staticmethod
    def from_code(code: str) -> "Planets":
        """Convert planet code to planet enum.

        Args:
            code (str): the planet code

        Returns:
            Planets: the corresponding planet enum

        """
        planet_codes = {
            "empty": Planets.EMPTY,
            "ascendant": Planets.ASCENDANT,
            "sun": Planets.SUN,
            "moon": Planets.MOON,
            "mars barycenter": Planets.MARS,
            "mercury": Planets.MERCURY,
            "jupiter barycenter": Planets.JUPITER,
            "venus": Planets.VENUS,
            "saturn barycenter": Planets.SATURN,
            "rahu": Planets.RAHU,
            "kethu": Planets.KETHU,
        }

        return planet_codes.get(code, Planets.EMPTY)

    @staticmethod
    def to_list() -> list[str]:
        """Convert planet enum to list of planet name.

        Returns:
            list[str]: list of planet names

        """
        return [el.name for el in Planets]

    @property
    def code(self) -> str:
        """Return the planet code.

        Returns:
            str: the planet code

        """
        planet_codes = {
            Planets.EMPTY: "empty",
            Planets.ASCENDANT: "ascendant",
            Planets.SUN: "sun",
            Planets.MOON: "moon",
            Planets.MARS: "mars barycenter",
            Planets.MERCURY: "mercury",
            Planets.JUPITER: "jupiter barycenter",
            Planets.VENUS: "venus",
            Planets.SATURN: "saturn barycenter",
            Planets.RAHU: "rahu",
            Planets.KETHU: "kethu",
        }

        return planet_codes.get(self, "empty")

    @property
    def color(self) -> str:
        """Return the planet color code.

        Returns:
            str: the planet color code

        """
        planet_colors = {
            Planets.EMPTY: "#000000",  # Black
            Planets.ASCENDANT: "#FFFFFF",  # White
            Planets.SUN: "#FFD700",  # Gold
            Planets.MOON: "#C0C0C0",  # Silver
            Planets.MARS: "#FF0000",  # Red
            Planets.MERCURY: "#008000",  # Green
            Planets.JUPITER: "#FFFF00",  # Yellow
            Planets.VENUS: "#FF69B4",  # Pink
            Planets.SATURN: "#00008B",  # DarkBlue
            Planets.RAHU: "#8A2BE2",  # BlueViolet
            Planets.KETHU: "#8B0000",  # DarkRed
        }

        return planet_colors.get(self, "#000000")  # Default to Black
code property

Return the planet code.

Returns:

Name Type Description
str str

the planet code

color property

Return the planet color code.

Returns:

Name Type Description
str str

the planet color code

from_code(code) staticmethod

Convert planet code to planet enum.

Parameters:

Name Type Description Default
code str

the planet code

required

Returns:

Name Type Description
Planets Planets

the corresponding planet enum

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
@staticmethod
def from_code(code: str) -> "Planets":
    """Convert planet code to planet enum.

    Args:
        code (str): the planet code

    Returns:
        Planets: the corresponding planet enum

    """
    planet_codes = {
        "empty": Planets.EMPTY,
        "ascendant": Planets.ASCENDANT,
        "sun": Planets.SUN,
        "moon": Planets.MOON,
        "mars barycenter": Planets.MARS,
        "mercury": Planets.MERCURY,
        "jupiter barycenter": Planets.JUPITER,
        "venus": Planets.VENUS,
        "saturn barycenter": Planets.SATURN,
        "rahu": Planets.RAHU,
        "kethu": Planets.KETHU,
    }

    return planet_codes.get(code, Planets.EMPTY)
to_list() staticmethod

Convert planet enum to list of planet name.

Returns:

Type Description
list[str]

list[str]: list of planet names

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
@staticmethod
def to_list() -> list[str]:
    """Convert planet enum to list of planet name.

    Returns:
        list[str]: list of planet names

    """
    return [el.name for el in Planets]
to_string(num) staticmethod

Convert planet number to display name of the planet.

Parameters:

Name Type Description Default
num int

the planet number

required

Returns:

Name Type Description
str str

return the planet name

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
@staticmethod
def to_string(num: int) -> str:
    """Convert planet number to display name of the planet.

    Args:
        num (int): the planet number

    Returns:
        str: return the planet name

    """
    return Planets(num).name if num in Planets._value2member_map_ else "empty"

Rasis

Bases: IntEnum

Enum to represent Rasis.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
class Rasis(IntEnum):
    """Enum to represent Rasis."""

    ARIES = 1
    TAURUS = 2
    GEMINI = 3
    CANCER = 4
    LEO = 5
    VIRGO = 6
    LIBRA = 7
    SCORPIO = 8
    SAGITTARIUS = 9
    CAPRICORN = 10
    AQUARIUS = 11
    PISCES = 12

    def __str__(self) -> str:
        """Return a localized string representation of the Rasi.

        Returns:
            str: Localized name of the Rasi.

        """
        return self.name

    @property
    def owner(self) -> Planets | None:
        """Get the owner planet of a given Rasi.

        Args:
            rasi (int): The Rasi number.

        Returns:
            Planets | None: The owner planet of the Rasi or None if invalid Rasi.

        """
        rasi_to_planet = {
            1: Planets.MARS,
            2: Planets.VENUS,
            3: Planets.MERCURY,
            4: Planets.MOON,
            5: Planets.SUN,
            6: Planets.MERCURY,
            7: Planets.VENUS,
            8: Planets.MARS,
            9: Planets.JUPITER,
            10: Planets.SATURN,
            11: Planets.SATURN,
            12: Planets.JUPITER,
        }
        return rasi_to_planet[self.value]

    @classmethod
    def from_string(cls, rasi: str) -> Rasis:
        """Convert a Rasi name to its corresponding enum member.

        Args:
            rasi (str): The name of the Rasi.

        Returns:
            Rasis: The corresponding enum member.

        """
        return cls[rasi.upper()]

    @classmethod
    def to_string(cls) -> str:
        """Convert a Rasi enum member to its localized display name.

        Returns:
            str: Localized name of the Rasi.

        """
        return cls.name.name

    @staticmethod
    def to_list() -> list[str]:
        """Get a list of all Rasi names.

        Returns:
            list[str]: List of all Rasi names.

        """
        return [el.name for el in Rasis]

    @staticmethod
    def to_4x4list() -> list[list[str]]:
        """Get a 4x4 grid representation of Rasi names.

        Returns:
            list[list[str]]: 4x4 grid of Rasi names.

        """
        rasis = Rasis.to_list()

        return [
            [rasis[11], rasis[0], rasis[1], rasis[2]],
            [rasis[10], "", "", rasis[3]],
            [rasis[9], "", "", rasis[4]],
            [rasis[8], rasis[7], rasis[6], rasis[5]],
        ]
owner property

Get the owner planet of a given Rasi.

Parameters:

Name Type Description Default
rasi int

The Rasi number.

required

Returns:

Type Description
Planets | None

Planets | None: The owner planet of the Rasi or None if invalid Rasi.

__str__()

Return a localized string representation of the Rasi.

Returns:

Name Type Description
str str

Localized name of the Rasi.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
def __str__(self) -> str:
    """Return a localized string representation of the Rasi.

    Returns:
        str: Localized name of the Rasi.

    """
    return self.name
from_string(rasi) classmethod

Convert a Rasi name to its corresponding enum member.

Parameters:

Name Type Description Default
rasi str

The name of the Rasi.

required

Returns:

Name Type Description
Rasis Rasis

The corresponding enum member.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@classmethod
def from_string(cls, rasi: str) -> Rasis:
    """Convert a Rasi name to its corresponding enum member.

    Args:
        rasi (str): The name of the Rasi.

    Returns:
        Rasis: The corresponding enum member.

    """
    return cls[rasi.upper()]
to_4x4list() staticmethod

Get a 4x4 grid representation of Rasi names.

Returns:

Type Description
list[list[str]]

list[list[str]]: 4x4 grid of Rasi names.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@staticmethod
def to_4x4list() -> list[list[str]]:
    """Get a 4x4 grid representation of Rasi names.

    Returns:
        list[list[str]]: 4x4 grid of Rasi names.

    """
    rasis = Rasis.to_list()

    return [
        [rasis[11], rasis[0], rasis[1], rasis[2]],
        [rasis[10], "", "", rasis[3]],
        [rasis[9], "", "", rasis[4]],
        [rasis[8], rasis[7], rasis[6], rasis[5]],
    ]
to_list() staticmethod

Get a list of all Rasi names.

Returns:

Type Description
list[str]

list[str]: List of all Rasi names.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@staticmethod
def to_list() -> list[str]:
    """Get a list of all Rasi names.

    Returns:
        list[str]: List of all Rasi names.

    """
    return [el.name for el in Rasis]
to_string() classmethod

Convert a Rasi enum member to its localized display name.

Returns:

Name Type Description
str str

Localized name of the Rasi.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@classmethod
def to_string(cls) -> str:
    """Convert a Rasi enum member to its localized display name.

    Returns:
        str: Localized name of the Rasi.

    """
    return cls.name.name

Rasi Enum

enums

Enums module for ndastro_engine.

This module provides access to all enum types used in ndastro calculations: - Houses: Astrological houses - Natchaththirams: Nakshatra (lunar mansion) enumerations - Planets: Planetary bodies - Rasis: Zodiac signs (rasis)

Houses

Bases: IntEnum

Enum to hold houses.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/house_enum.py
class Houses(IntEnum):
    """Enum to hold houses."""

    HOUSE1 = 1
    HOUSE2 = 2
    HOUSE3 = 3
    HOUSE4 = 4
    HOUSE5 = 5
    HOUSE6 = 6
    HOUSE7 = 7
    HOUSE8 = 8
    HOUSE9 = 9
    HOUSE10 = 10
    HOUSE11 = 11
    HOUSE12 = 12

    def __str__(self) -> str:
        """Return name of the house.

        Returns:
            str: name of the house

        """
        return self.name

    @property
    def owner(self) -> Planets:
        """Get the owner of a given house.

        Returns:
            Planets: The owner of the house.

        """
        house_to_planet = {
            1: Planets.MARS,
            2: Planets.VENUS,
            3: Planets.MERCURY,
            4: Planets.MOON,
            5: Planets.SUN,
            6: Planets.MERCURY,
            7: Planets.VENUS,
            8: Planets.MARS,
            9: Planets.JUPITER,
            10: Planets.SATURN,
            11: Planets.SATURN,
            12: Planets.JUPITER,
        }
        return house_to_planet[self.value]
owner property

Get the owner of a given house.

Returns:

Name Type Description
Planets Planets

The owner of the house.

__str__()

Return name of the house.

Returns:

Name Type Description
str str

name of the house

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/house_enum.py
def __str__(self) -> str:
    """Return name of the house.

    Returns:
        str: name of the house

    """
    return self.name

Natchaththirams

Bases: Enum

Enum to hold stars.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
class Natchaththirams(Enum):
    """Enum to hold stars."""

    ASWINNI = 1
    BHARANI = 2
    KAARTHIKAI = 3
    ROGHINI = 4
    MIRUGASIRISAM = 5
    THIRUVAATHIRAI = 6
    PUNARPOOSAM = 7
    POOSAM = 8
    AAYILYAM = 9
    MAGAM = 10
    POORAM = 11
    UTHTHIRAM = 12
    ASTHTHAM = 13
    CHITHTHIRAI = 14
    SUVAATHI = 15
    VISAAGAM = 16
    ANUSHAM = 17
    KETTAI = 18
    MOOLAM = 19
    POORAADAM = 20
    UTHTHIRAADAM = 21
    THIRUVONAM = 22
    AVITTAM = 23
    SHATHAYAM = 24
    POORATTAATHI = 25
    UTHTHIRATTAATHI = 26
    REVATHI = 27

    def __str__(self) -> str:
        """Return the display name of the star.

        Returns:
            str: The display name of the star.

        """
        return self.name

    @property
    def owner(self) -> Planets:
        """Return the owner (planet) of the star.

        Returns:
            str: The name of the planet that owns the star.

        """
        owners = {
            1: "kethu",
            2: "venus",
            3: "sun",
            4: "moon",
            5: "mars barycenter",
            6: "rahu",
            7: "jupiter barycenter",
            8: "saturn barycenter",
            9: "mercury",
            10: "kethu",
            11: "venus",
            12: "sun",
            13: "moon",
            14: "mars barycenter",
            15: "rahu",
            16: "jupiter barycenter",
            17: "saturn barycenter",
            18: "mercury",
            19: "kethu",
            20: "venus",
            21: "sun",
            22: "moon",
            23: "mars barycenter",
            24: "rahu",
            25: "jupiter barycenter",
            26: "saturn barycenter",
            27: "mercury",
        }

        return Planets.from_code(owners[self.value])

    @staticmethod
    def to_string(num: int) -> str:
        """Convert star number to display name of the star.

        Args:
            num (int): the star number

        Returns:
            str: return the star name

        """
        return Natchaththirams(num).name

    @staticmethod
    def to_list() -> list[str]:
        """Convert enum to list of enum item name.

        Returns:
            list[str]: list of enum item name

        """
        return [el.name for el in Natchaththirams]
owner property

Return the owner (planet) of the star.

Returns:

Name Type Description
str Planets

The name of the planet that owns the star.

__str__()

Return the display name of the star.

Returns:

Name Type Description
str str

The display name of the star.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
def __str__(self) -> str:
    """Return the display name of the star.

    Returns:
        str: The display name of the star.

    """
    return self.name
to_list() staticmethod

Convert enum to list of enum item name.

Returns:

Type Description
list[str]

list[str]: list of enum item name

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
@staticmethod
def to_list() -> list[str]:
    """Convert enum to list of enum item name.

    Returns:
        list[str]: list of enum item name

    """
    return [el.name for el in Natchaththirams]
to_string(num) staticmethod

Convert star number to display name of the star.

Parameters:

Name Type Description Default
num int

the star number

required

Returns:

Name Type Description
str str

return the star name

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/nakshatra_enum.py
@staticmethod
def to_string(num: int) -> str:
    """Convert star number to display name of the star.

    Args:
        num (int): the star number

    Returns:
        str: return the star name

    """
    return Natchaththirams(num).name

Planets

Bases: IntEnum

Enum to hold planets.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
class Planets(IntEnum):
    """Enum to hold planets."""

    EMPTY = -1
    ASCENDANT = 0
    SUN = 1
    MOON = 2
    MARS = 3
    MERCURY = 4
    JUPITER = 5
    VENUS = 6
    SATURN = 7
    RAHU = 8
    KETHU = 9

    @staticmethod
    def to_string(num: int) -> str:
        """Convert planet number to display name of the planet.

        Args:
            num (int): the planet number

        Returns:
            str: return the planet name

        """
        return Planets(num).name if num in Planets._value2member_map_ else "empty"

    @staticmethod
    def from_code(code: str) -> "Planets":
        """Convert planet code to planet enum.

        Args:
            code (str): the planet code

        Returns:
            Planets: the corresponding planet enum

        """
        planet_codes = {
            "empty": Planets.EMPTY,
            "ascendant": Planets.ASCENDANT,
            "sun": Planets.SUN,
            "moon": Planets.MOON,
            "mars barycenter": Planets.MARS,
            "mercury": Planets.MERCURY,
            "jupiter barycenter": Planets.JUPITER,
            "venus": Planets.VENUS,
            "saturn barycenter": Planets.SATURN,
            "rahu": Planets.RAHU,
            "kethu": Planets.KETHU,
        }

        return planet_codes.get(code, Planets.EMPTY)

    @staticmethod
    def to_list() -> list[str]:
        """Convert planet enum to list of planet name.

        Returns:
            list[str]: list of planet names

        """
        return [el.name for el in Planets]

    @property
    def code(self) -> str:
        """Return the planet code.

        Returns:
            str: the planet code

        """
        planet_codes = {
            Planets.EMPTY: "empty",
            Planets.ASCENDANT: "ascendant",
            Planets.SUN: "sun",
            Planets.MOON: "moon",
            Planets.MARS: "mars barycenter",
            Planets.MERCURY: "mercury",
            Planets.JUPITER: "jupiter barycenter",
            Planets.VENUS: "venus",
            Planets.SATURN: "saturn barycenter",
            Planets.RAHU: "rahu",
            Planets.KETHU: "kethu",
        }

        return planet_codes.get(self, "empty")

    @property
    def color(self) -> str:
        """Return the planet color code.

        Returns:
            str: the planet color code

        """
        planet_colors = {
            Planets.EMPTY: "#000000",  # Black
            Planets.ASCENDANT: "#FFFFFF",  # White
            Planets.SUN: "#FFD700",  # Gold
            Planets.MOON: "#C0C0C0",  # Silver
            Planets.MARS: "#FF0000",  # Red
            Planets.MERCURY: "#008000",  # Green
            Planets.JUPITER: "#FFFF00",  # Yellow
            Planets.VENUS: "#FF69B4",  # Pink
            Planets.SATURN: "#00008B",  # DarkBlue
            Planets.RAHU: "#8A2BE2",  # BlueViolet
            Planets.KETHU: "#8B0000",  # DarkRed
        }

        return planet_colors.get(self, "#000000")  # Default to Black
code property

Return the planet code.

Returns:

Name Type Description
str str

the planet code

color property

Return the planet color code.

Returns:

Name Type Description
str str

the planet color code

from_code(code) staticmethod

Convert planet code to planet enum.

Parameters:

Name Type Description Default
code str

the planet code

required

Returns:

Name Type Description
Planets Planets

the corresponding planet enum

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
@staticmethod
def from_code(code: str) -> "Planets":
    """Convert planet code to planet enum.

    Args:
        code (str): the planet code

    Returns:
        Planets: the corresponding planet enum

    """
    planet_codes = {
        "empty": Planets.EMPTY,
        "ascendant": Planets.ASCENDANT,
        "sun": Planets.SUN,
        "moon": Planets.MOON,
        "mars barycenter": Planets.MARS,
        "mercury": Planets.MERCURY,
        "jupiter barycenter": Planets.JUPITER,
        "venus": Planets.VENUS,
        "saturn barycenter": Planets.SATURN,
        "rahu": Planets.RAHU,
        "kethu": Planets.KETHU,
    }

    return planet_codes.get(code, Planets.EMPTY)
to_list() staticmethod

Convert planet enum to list of planet name.

Returns:

Type Description
list[str]

list[str]: list of planet names

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
@staticmethod
def to_list() -> list[str]:
    """Convert planet enum to list of planet name.

    Returns:
        list[str]: list of planet names

    """
    return [el.name for el in Planets]
to_string(num) staticmethod

Convert planet number to display name of the planet.

Parameters:

Name Type Description Default
num int

the planet number

required

Returns:

Name Type Description
str str

return the planet name

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/planet_enum.py
@staticmethod
def to_string(num: int) -> str:
    """Convert planet number to display name of the planet.

    Args:
        num (int): the planet number

    Returns:
        str: return the planet name

    """
    return Planets(num).name if num in Planets._value2member_map_ else "empty"

Rasis

Bases: IntEnum

Enum to represent Rasis.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
class Rasis(IntEnum):
    """Enum to represent Rasis."""

    ARIES = 1
    TAURUS = 2
    GEMINI = 3
    CANCER = 4
    LEO = 5
    VIRGO = 6
    LIBRA = 7
    SCORPIO = 8
    SAGITTARIUS = 9
    CAPRICORN = 10
    AQUARIUS = 11
    PISCES = 12

    def __str__(self) -> str:
        """Return a localized string representation of the Rasi.

        Returns:
            str: Localized name of the Rasi.

        """
        return self.name

    @property
    def owner(self) -> Planets | None:
        """Get the owner planet of a given Rasi.

        Args:
            rasi (int): The Rasi number.

        Returns:
            Planets | None: The owner planet of the Rasi or None if invalid Rasi.

        """
        rasi_to_planet = {
            1: Planets.MARS,
            2: Planets.VENUS,
            3: Planets.MERCURY,
            4: Planets.MOON,
            5: Planets.SUN,
            6: Planets.MERCURY,
            7: Planets.VENUS,
            8: Planets.MARS,
            9: Planets.JUPITER,
            10: Planets.SATURN,
            11: Planets.SATURN,
            12: Planets.JUPITER,
        }
        return rasi_to_planet[self.value]

    @classmethod
    def from_string(cls, rasi: str) -> Rasis:
        """Convert a Rasi name to its corresponding enum member.

        Args:
            rasi (str): The name of the Rasi.

        Returns:
            Rasis: The corresponding enum member.

        """
        return cls[rasi.upper()]

    @classmethod
    def to_string(cls) -> str:
        """Convert a Rasi enum member to its localized display name.

        Returns:
            str: Localized name of the Rasi.

        """
        return cls.name.name

    @staticmethod
    def to_list() -> list[str]:
        """Get a list of all Rasi names.

        Returns:
            list[str]: List of all Rasi names.

        """
        return [el.name for el in Rasis]

    @staticmethod
    def to_4x4list() -> list[list[str]]:
        """Get a 4x4 grid representation of Rasi names.

        Returns:
            list[list[str]]: 4x4 grid of Rasi names.

        """
        rasis = Rasis.to_list()

        return [
            [rasis[11], rasis[0], rasis[1], rasis[2]],
            [rasis[10], "", "", rasis[3]],
            [rasis[9], "", "", rasis[4]],
            [rasis[8], rasis[7], rasis[6], rasis[5]],
        ]
owner property

Get the owner planet of a given Rasi.

Parameters:

Name Type Description Default
rasi int

The Rasi number.

required

Returns:

Type Description
Planets | None

Planets | None: The owner planet of the Rasi or None if invalid Rasi.

__str__()

Return a localized string representation of the Rasi.

Returns:

Name Type Description
str str

Localized name of the Rasi.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
def __str__(self) -> str:
    """Return a localized string representation of the Rasi.

    Returns:
        str: Localized name of the Rasi.

    """
    return self.name
from_string(rasi) classmethod

Convert a Rasi name to its corresponding enum member.

Parameters:

Name Type Description Default
rasi str

The name of the Rasi.

required

Returns:

Name Type Description
Rasis Rasis

The corresponding enum member.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@classmethod
def from_string(cls, rasi: str) -> Rasis:
    """Convert a Rasi name to its corresponding enum member.

    Args:
        rasi (str): The name of the Rasi.

    Returns:
        Rasis: The corresponding enum member.

    """
    return cls[rasi.upper()]
to_4x4list() staticmethod

Get a 4x4 grid representation of Rasi names.

Returns:

Type Description
list[list[str]]

list[list[str]]: 4x4 grid of Rasi names.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@staticmethod
def to_4x4list() -> list[list[str]]:
    """Get a 4x4 grid representation of Rasi names.

    Returns:
        list[list[str]]: 4x4 grid of Rasi names.

    """
    rasis = Rasis.to_list()

    return [
        [rasis[11], rasis[0], rasis[1], rasis[2]],
        [rasis[10], "", "", rasis[3]],
        [rasis[9], "", "", rasis[4]],
        [rasis[8], rasis[7], rasis[6], rasis[5]],
    ]
to_list() staticmethod

Get a list of all Rasi names.

Returns:

Type Description
list[str]

list[str]: List of all Rasi names.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@staticmethod
def to_list() -> list[str]:
    """Get a list of all Rasi names.

    Returns:
        list[str]: List of all Rasi names.

    """
    return [el.name for el in Rasis]
to_string() classmethod

Convert a Rasi enum member to its localized display name.

Returns:

Name Type Description
str str

Localized name of the Rasi.

Source code in .venv/lib/python3.11/site-packages/ndastro_engine/rasi_enum.py
@classmethod
def to_string(cls) -> str:
    """Convert a Rasi enum member to its localized display name.

    Returns:
        str: Localized name of the Rasi.

    """
    return cls.name.name