astro_toolbox package
This module init all the public classes.
- class astro_toolbox.AngleDMS(anglevalue: tuple | str)
Bases:
objectAngleDMS define a dms angle with its conversions.
Attributes
- anglevaluetuple
The angle values as floats in tuple.
- class astro_toolbox.AngleDeg(anglevalue: float)
Bases:
objectAngleDeg define degrees angle with its conversions.
Attributes
- anglevalue: float
The angle value in degrees.
- degtodms()
Degrees to DMS converting method. This method returns angle in DMS from angle in degrees.
Returns
- tuple
The angle values in DMS.
- class astro_toolbox.AngleHMS(anglevalue: tuple | str)
Bases:
objectAngleHMS define a HMS angle with its conversions.
Attributes
- anglevaluetuple
The angle value as floats in tuple.
- class astro_toolbox.AngleRad(anglevalue: float)
Bases:
objectAngleRad define radians angle with its conversions.
Attributes
- anglevaluefloat
The angle value in radians.
- radtodeg()
Radians to Degrees converting method. This method returns angle in radians from angle in degrees.
Returns
- float
The angle value in degrees.
- class astro_toolbox.AstroDateTime(ut_time: tuple | str = None)
Bases:
objectThis module contains AngleRad class
Attributes
- ut_timetuple | str
Date and time as tuple or string in format (2000/01/01/12:00:00)
- get_gmst()
Get Greenwich mean sidereal time with USNO formula.
\[gmst=mod(18.697375+24.065709824279(JD-2451545), 24)\]Returns
- tuple
Greenwich mean sidereal time.
- get_gregorian(delta: int = 0)
Get gregorian date with possibility of delta days from USNO formulas.
\[g_1 = julian_day + 68569\]\[g_2 = <\frac{4g_1}{146097}>\]\[g_1 = g_1 - <\frac{146087g_2 + 3}{4}>\]\[g_3 = <\frac{4000(g_1 + 1)}{1461001}>\]\[g_1 = g_1 - <\frac{1461g_3}{4}> + 31\]\[g_4 = <\frac{80g_3}{2447}>\]\[day = g_1 - <\frac{2447g_4}{80}>\]\[g_1 = <\frac{g_4}{11}\]\[month = g_4 + 2 - 12g_1\]\[year = 100(g_2 - 49) + g_3 + g_1\]Parameters
- deltaint, optional
Delta days, by default 0.
Returns
- tuple
Tuple of int containing year month and month day.
- get_jd(delta: int = 0)
Get julian day with possibility of delta days from USNO formula.
\[JD=367year-\frac{7(year+\frac{month+9}{12})}{4}>+\frac{275month}{9}+ day+1721013.5+\frac{UT}{24}-\]\[0.5sign(100year+month-190002.5)+0.5\]Parameters
- deltaint
Delta in days.
Returns
- float
Julian day.
- class astro_toolbox.Ephemeris(name: str, datetime: tuple | str)
Bases:
objectEphemeris 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.
- class astro_toolbox.Equatorial(alpha: tuple | str, delta: tuple | str, name: str = None, magnitude: float = None)
Bases:
objectThis 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-ddoryyyy: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-ddoryyyy: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).
- class astro_toolbox.Horizons(object_name: str | int, datetime: tuple | str, location: Location)
Bases:
objectJPL Horizons ephemeris request and parsing.
Attributes
- namestr | int
The object name or integer reference according to JPL Horizons.
- datetimeAstroDateTime
Date and time as AstroDateTime class.
- locationLocation
Observer location as Location class.
- object_datalist
List which contains results from Horizons.
- class astro_toolbox.Horizontal(azimuth: tuple | str, altitude: tuple | str, name: str = None, magnitude: float = None)
Bases:
objectThis 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.
- class astro_toolbox.Location(name: str = None, latitude: tuple | str = None, longitude: tuple | str = None, elevation: float = None)
Bases:
objectThis 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.
- class astro_toolbox.OpenMeteo(location: Location, model: str = 'best_match')
Bases:
objectOpenMeteo service request and parsing.
Attributes
- locationLocation
Observer location as Location class.
- modelstr, optional
Weather model (https://open-meteo.com/en/docs), by default ‘best_match’
- get_cloud_cover(datetime: str | tuple = None)
Get cloud coverage method.
Parameters
- datetimestr | tuple, optional
Date and Time as tuple (
YYYY,MM,DD,hh,mm,ssorYYYY-MM-DDThh:mm:ss), by default None.
Returns
- float
Cloud coverage
- get_dewpoint(datetime: str | tuple = None)
Get dewpoint method.
Parameters
- datetimestr | tuple, optional
Date and Time as tuple (
YYYY,MM,DD,hh,mm,ssorYYYY-MM-DDThh:mm:ss), by default None.
Returns
- float
Dewpoint
- get_humidity(datetime: str | tuple = None)
Get humidity method.
Parameters
- datetimestr | tuple, optional
Date and Time as tuple (
YYYY,MM,DD,hh,mm,ssorYYYY-MM-DDThh:mm:ss), by default None.
Returns
- float
Humidity
- get_msl_pressure(datetime: str | tuple = None)
Get sea level pressure method.
Parameters
- datetimestr | tuple, optional
Date and Time as tuple (
YYYY,MM,DD,hh,mm,ssorYYYY-MM-DDThh:mm:ss), by default None.
Returns
- float
Sea level pressure
- get_precipitation(datetime: str | tuple = None)
Get precipitation method.
Parameters
- datetimestr | tuple, optional
Date and Time as tuple (
YYYY,MM,DD,hh,mm,ssorYYYY-MM-DDThh:mm:ss), by default None.
Returns
- float
Precipitation
- get_precipitation_probability(datetime: str | tuple = None)
Get precipitation probability method.
Parameters
- datetimestr | tuple, optional
Date and Time as tuple (
YYYY,MM,DD,hh,mm,ssorYYYY-MM-DDThh:mm:ss), by default None.
Returns
- float
Precipitation probability
- get_temperature(datetime: str | tuple = None)
Get temperature method.
Parameters
- datetimestr | tuple, optional
Date and Time as tuple (
YYYY,MM,DD,hh,mm,ssorYYYY-MM-DDThh:mm:ss), by default None.
Returns
- float
Temperature
- get_wind_direction(datetime: str | tuple = None)
Get wind direction method.
Parameters
- datetimestr | tuple, optional
Date and Time as tuple (
YYYY,MM,DD,hh,mm,ssorYYYY-MM-DDThh:mm:ss), by default None.
Returns
- float
Wind direction
- class astro_toolbox.Simbad(object_name: str)
Bases:
objectThis class allows to read astronomical catalogs over internet.
Attributes
object_name : str
Subpackages
- astro_toolbox.angle package
- astro_toolbox.coordinates package
- astro_toolbox.query package
- astro_toolbox.scripts package
- astro_toolbox.time package
Submodules
astro_toolbox.command_line module
This module creates the console interface.