astro_toolbox.coordinates package

Submodules

astro_toolbox.coordinates.equatorial module

This module contains Equatorial class.

class astro_toolbox.coordinates.equatorial.Equatorial(alpha: tuple | str, delta: tuple | str, name: str = None, magnitude: float = None)

Bases: object

This class represents astronomical equatorial coordinate system.

Attributes

alphatuple

Object right-ascension.

deltatuple

Object declination.

namestr

Object name.

magnitudefloat

Object magnitude.

calculate_airmass(gamma: tuple | str, location: Location)

Airmass calculation method. The airmass is calculate with the Pickering (2002) formula from DIO, The International Journal of Scientific History vol. 12.

\[X = \frac{1}{sin(h+\frac{244}{165+47h^{1.1}})}\]

For altitude angle calculation c.f. to_horizontal method.

Parameters

gammatuple | str

Sidereal Time angle in hms.

locationLocation

observer location.

Returns

float

Airmass value of the object.

calculate_rise_time(location: Location, date: tuple | str, altitude_0: float = 0.0)

Rise time calculation method.

Parameters

locationLocation

Observer location as Location class.

datetuple | str

Date as tuple or str (yyyy-mm-dd or yyyy:mm:dd).

Returns

tuple

Tuple containing the rising time in HMS.

calculate_set_time(location: Location, date: tuple | str, altitude_0: float = 0.0)

Set time calculation method.

Parameters

locationLocation

Observer location as Location class.

datetuple | str

Date as tuple or str (yyyy-mm-dd or yyyy:mm:dd).

Returns

tuple

Tuple containing the setting time in HMS.

compute_on_date_coord(year: float)

On date Equatorial coordinates calculation method from J2000 Equatorial coordinate.

\[\Delta year = \frac{(year-2000)}{100}\]
\[M=1.2812323\Delta year+0.0003879\Delta year^2+0.0000101\Delta year^3\]
\[N=0.5567530\Delta year-0.0001185\Delta year^2+0.0000116\Delta year^3\]
\[\Delta \alpha=M+Nsin\alpha tan\delta\]
\[\Delta \delta=Ncos\alpha\]
\[\alpha=\alpha_{J2000}+\Delta \alpha\]
\[\delta=\delta_{J2000}+\Delta \delta\]

Parameters

yearfloat

Current year (months and days can be counted as year fraction).

get_hourangle(gamma: tuple | str)

Right-Ascension to Hour-Angle converting method.

\[HA = RA - \gamma\]

Parameters

gammatuple | str

Sidereal Time angle as tuple or string.

Returns

tuple

Hour-Angle tuple as tuple.

to_horizontal(gamma: tuple | str, location: Location)

Equatorial to Horizontal converting method.

\[h=sin^{-1}(cos\Phi cos H cos\delta+sin\Phi sin\delta)\]
\[A=sin^{-1}(\frac{-sin H cos \delta}{cosh})\]

Parameters

gammatuple | str

Sidereal Time angle as tuple or string.

locationLocation

observer location.

Returns

tuple

Tuple containing two tuple in DMS with (azimuth, altitude).

astro_toolbox.coordinates.horizontal module

This module contains Horizontal class.

class astro_toolbox.coordinates.horizontal.Horizontal(azimuth: tuple | str, altitude: tuple | str, name: str = None, magnitude: float = None)

Bases: object

This class represent horizontal coordinate system.

Attributes

azimuthAngleDMS

Object azimuth.

altitudeAngleDMS

Object altitude.

namestr

Object name.

magnitudefloat

Object magnitude.

calculate_airmass()

Airmass calculation method The airmass is calculate with the Pickering (2002) formula from DIO, The International Journal of Scientific History vol. 12.

\[X = \frac{1}{sin(h+\frac{244}{165+47h^{1.1}})}\]

Returns

float

Object airmass.

to_equatorial(gamma: tuple | str, location: Location)

Horizontal to equatorial converting method.

\[\delta=sin^{-1}(sin \Phi sin h-cos \Phi cos h cos A)\]
\[\alpha=sin^{-1}(\frac{-cosh cosA}{cos\delta})-\gamma\]

Parameters

gammaAngleHMS

Sidereal Time angle as tuple or string.

locationLocation

observer location.

Returns

Equatorial

Object equatorial coordinates.

astro_toolbox.coordinates.location module

This module contains Location class.

class astro_toolbox.coordinates.location.Location(name: str = None, latitude: tuple | str = None, longitude: tuple | str = None, elevation: float = None)

Bases: object

This class represents the observer location.

Attributes

namestr

Location name.

latitudetuple | str

Location latitude.

longitudetuple | str

Location longitude.

elevationfloat

Location elevation.

compute_pressure_level()

Pressure level computing method.

\[P = 1013.25(1 - \frac{h}{44307.694})^{5.25530}\]

Returns

float

Pressure level in hPa.

delete_site()

Method to delete current site from saved sites file.

Raises

KeyError

The first level key doesn’t exist.

save_site()

Method to save current site in sites file.

Raises

KeyError

The first level key already exist.

update_site()

Method to update current site in saved sites file.

Raises

KeyError

The first level key doesn’t exist.

astro_toolbox.coordinates.solar_system module

This module contains Ephemeris class.

class astro_toolbox.coordinates.solar_system.Ephemeris(name: str, datetime: tuple | str)

Bases: object

Ephemeris class computing solar system objects positions in different referential. Orbital elements calculated by JPL.

Attributes

namestr

Planet name.

n_centuriesfloat

Number of centuries from J2000.

orbital_elementsdict

Dictionary which contains object orbital elements for current date.

calculate_ecliptic_obliquity()

Calculate on date ecliptic obliquity.

Returns

float

Ecliptic obliquity in degrees.

compute_earth_position()

Sun position from earth. Distance and true anomaly are computed by _compute_true_anomaly_distance method.

lonearth = v + w

\[xs = r * cos(lonsun)\]
\[ys = r * sin(lonsun)\]

Returns

tuple

Tuple containing sun position from earth

compute_ecliptic_position(**orbital_elements)

Compute the heliocentric ecliptic object position.

\[xh = r*(cos(\Omega)*cos(v+\omega)-sin(\Omega)*sin(v+\omega)*cos(I))\]
\[yh = r*(sin(\Omega)*cos(v+\omega)+cos(\Omega)*sin(v+\omega)*cos(I))\]
\[zh = r*(sin(v+\omega)*sin(I))\]

Returns

tuple

Tuple which contains object position around the sun.

compute_equatorial_position(**orbital_elements)

Compute equatorial object position.

For the sun:

\[xe = xs\]
\[ye = ys * cos(ecl)\]
\[ze = ys * sin(ecl)\]

For the moon:

\[xe = r*(cos(\Omega)*cos(v+\omega)-sin(\Omega)*sin(v+\omega)*cos(I))\]
\[ye = r*(sin(\Omega)*cos(v+\omega)+cos(\Omega)*sin(v+\omega)*cos(I))\]
\[ze = r*(sin(v+\omega)*sin(I))\]

For the planets:

\[xe = xg\]
\[ye = yg * cos(ecl) - zg * sin(ecl)\]
\[ze = yg * sin(ecl) + zg * cos(ecl)\]

Returns

tuple

Tuple which contains the geocentric position.

compute_geocentric_position(**orbital_elements)

Compute geocentric object position.

\[xg = xh + xs\]
\[yg = yh + ys\]
\[zg = zh\]

Where, xs and ys are the geocentric earth coordinates.

Returns

tuple

Tuple which contains the geocentric position.

compute_true_anomaly_distance(**orbital_elements)

Compute object distance and true anomaly.

\[xv = a(cos(E) - e)\]
\[yv = a\sqrt{1 - e^2} * sin(E)\]
\[v = atan2(yv, xv)\]
\[r = \sqrt{xv^2 + yv^2}\]

Returns

tuple

Tuple which contains true anomaly and distance.

get_equatorial_coord()

Calculate equatorial coordinates.

\[RA = atan2(ye, xe)\]
\[DEC = atan2(ze, \sqrt{xe^2 + ye^2})\]

Returns

tuple

Tuple which contains right-ascension as HMS tuple and declination as DMS tuple.

get_magnitude()

Get solar system objects magnitude.

Returns

float

Solar system object magnitude.