Astronomical Utilities

New in version 0.2.

Astronomical utility functions and classes based on libnova library.

lsl.astro.B1950_UTC_JD
UTC Julian day of J2000.0 coordinate epoch.
lsl.astro.B1950_to_J2000(pos)

Convert B1950 epoch to J2000 epoch for equatorial coordinates.

Param: pos - object of type equ_posn giving B1950 coordinates

Returns: object of type equ_posn giving J2000 coordinates.

lsl.astro.DJD_OFFSET
Offset in days between UNIX time (epoch 1970/01/01) and standard Julian day.
lsl.astro.J2000_UTC_JD
Difference in seconds between TT and TAI times.
lsl.astro.J2000_to_B1950(pos)

Convert J2000 epoch to B1950 epoch for equatorial coordinates.

Param: pos - object of type equ_posn giving J2000 coordinates

Returns: object of type equ_posn giving B1950 coordinates.

lsl.astro.MJD_OFFSET
Offset in days between standard Julian day and Dublin Julian day.
lsl.astro.SECS_IN_DAY
UTC Julian day of B1950.0 coordinate epoch.
lsl.astro.TAI_TT_OFFSET
” Velocity of light in meters/second.
lsl.astro.UNIX_OFFSET
The number of seconds in one day
lsl.astro.add_hms(source, dest)

Wrapper for libnova ln_add_hms() function. Adds time/angle hours, minutes, seconds.

Param: source - Object of type hms represeting angle 1. Param: dest - Object of type hms represeting angle 2.

Returns object of type hms representing sum of angles.

lsl.astro.add_secs_hms(hms, seconds)

Wrapper for libnova ln_add_secs_hms() function. Add seconds to time/angle hours, minutes, seconds.

Param: hms - Object of type hms representing angle. Param: seconds - Seconds offset (float) to add to angle.

Returns object of type hms representing angle + offset.

class lsl.astro.date(years=None, months=None, days=None, hours=None, minutes=None, seconds=None)

Wrapper for libnova ln_date structure. Represents UT time in calendar units.

Public members:
years - Date years (integer). months - Date months (integer). days - Date days (integer). hours - Date hours (integer). minutes - Date minutes (integer). seconds - Date seconds (float).
load(dateStr, timeStr)

Load date object from formatted strings.

Param: dateStr - A string of format YYYY-MM-DD giving date. Param: timeStr - A string of format HH:MM:SS.S giving time.

to_jd()
Convert calendar time to Julian day. Returns UTC time in Julian days (float).
to_zone(gmtoff=None)

Convert UTC calendar time to local calendar time.

Param: gmtoff - local seconds offset from UTC (integer -43200 to 43200).
if set to None, the time module offset value is used for current location

Returns object of type zonedate representing local time.

lsl.astro.date_to_zonedate(date, gmtoff)

Wrapper for for libnova ln_date_to_zonedate() function. Convert UTC calendar time to local calendar time.

Param: date - A date object representing UTC time. Param: gmtoff - Seconds offset from UTC (integer -43200 to 43200).

Returns object of type zonedate representing local time.

lsl.astro.deg_to_dms(degrees)

Wrapper for libnova ln_deg_to_dms() function. Convert angles float degrees to degrees, minutes, seconds.

Param: degrees - Angle in degrees (float).

Returns object of type dms representing angle.

lsl.astro.deg_to_hms(degrees)

Wrapper for libnova ln_deg_to_hms() function. Convert angles float degrees to hours, minutes, seconds.

Param: degrees - Angle in degrees (float).

Returns object of type hms representing angle.

lsl.astro.deg_to_rad(degrees)

Wrapper for libnova ln_deg_to_rad() function. Convert degress to radians.

Param: degrees - Angle in degrees (float).

Returns angle in radians (float).

lsl.astro.deg_to_sec(degrees)

Convert longitude degrees into time seconds.

Param: degrees - longitude (float degrees)

Returns: Seconds (float) offset in time for longitude.

lsl.astro.dir_cos(posn)

Get direction cosines from azimuth and zenith angles. This function calculates the cosine values based on the LWA coordinate system:

l = unit vector in E direction (azimuth = 90) m = unit vector in N direction (azimuth = 0) n = unit vector in zenith direction (zenith = 0, altitude = 90)

Param: posn - object of type hrz_posn giving local position

Returns a tuple (l,m,n) of float values for the direction cosines.

class lsl.astro.dms(neg=None, degrees=None, minutes=None, seconds=None)

Wrapper for libnova ln_dms structure. Represents angles in degrees, minutes, seconds.

Public members:
neg - True if measured west of GM, south of EQ
False if measured east of GM, north of EQ.

degrees - Angle degrees (integer). minutes - Angle minutes (integer). seconds - Angle seconds (float).

to_deg()
Convert angles degrees, minutes, seconds to float degrees. Returns angle in degrees (float).
to_hms()
Convert angles degrees, minutes seconds to hours, minutes, seconds. Returns: object of type hms representing angle.
lsl.astro.dms_to_deg(dms)

Wrapper for libnova ln_dms_to_deg() function. Convert angles degrees, minutes, seconds to float degrees.

Param: dms - Object of type dms representing angle.

Returns angle in degrees (float).

lsl.astro.dms_to_rad(dms)

Wrapper for libnova ln_dms_to_rad() function. Convert angles degrees, minutes, seconds to radians.

Param: dms - Object of type dms representing angle.

Returns angle in radians (float).

class lsl.astro.ecl_posn(lng=None, lat=None)

Represents position as ecliptic longitude and latitude.

Public members:
lng - Position longitude coordinate (float degrees). lat - Position latitude coordinate (float degrees).
Members may also be accessed by subscript:
ecl_posn[0] = lng ecl_posn[1] = lat
to_equ(jD)

Get equatorial coordinates from ecliptical coordinates for a given time.

Param: jD - UTC Julian day (float).

Returns object of type equ_posn representing equatorial position.

class lsl.astro.equ_posn(ra=None, dec=None)

Wrapper for libnova ln_equ_posn structure. Represents equatoral/celestial position coordinates.

Public members:
ra - Position right ascension angle (float degrees). dec - Position declination angle (float degrees).
Members may also be accessed by subscript:
equ_posn[0] = ra equ_posn[1] = dec
angular_separation(posn)

Get angular separation from equatorial position.

Param: posn - Object of type equ_posn representing body 2 position.

Returns angular separation in degrees (float).

format()
Return a tuple (ra, dec) where ra is an hms object and dec is a dms object representing ra and dec position coordinates.
precess(jD)

Get position of celestial object accounting for precession. The equatorial coordinates should be for the J2000 epoch.

Param: jD - UTC Julian day (float) to measure position.

Returns: Adjusted equatorial position of object as type equ_posn.

to_ecl(jD)

Get ecliptical coordinates from equatorial coordinates.

Param: jD - UTC Julian day (float).

Returns object of type lnlat_posn representing eclipitcal position.

to_gal(jD)

Get J2000 galactic coordinates from apparent equatorial coordinates.

Param: jD - UTC Julian day to get position.

Returns object of type gal_posn representing object’s galactic position.

to_hrz(observer, jD)

Get local horizontal coordinates from equatorial/celestial coordinates.

Param: observer - Object of type lnlat_posn representing observer position. Param: jD - UTC Julian day (float).

Returns object of type hrz_posn representing local position.

class lsl.astro.gal_posn(l=None, b=None)

Wrapper for libnova ln_gal_posn structure. Represents galactic position coordinates.

Public members:
l - Position longitude angle (float degrees). b - Position latitude angle (float degrees).
Members may also be accessed by subscript:
gal_posn[0] = l gal_posn[1] = b
format()
Return a tuple (lng, lat) where lng is an dms object and lat is a dms object representing galactic longitude and latitude position coordinates.
to_equ(jD)

Get apparent equatorial coordinates from J2000 galactic coordinates.

Param: jD - UTC Julian day to get position.

Returns object of type equ_posn representing object’s apparent equatorial position.

class lsl.astro.geo_posn(lng=None, lat=None, elv=0.0)

Class to represent geographical position in terms of longitude, lattitude, and elevation. This is a set of geodetic coordinates based on the WGS84 model.

Public members:
lng - longitude (float) lat - latitude (float) elv - elevation (float)
Members may also be accessed by subscript:
geo_posn[0] = lng geo_posn[1] = lat geo_posn[2] = elv
lsl.astro.get_angular_separation(posn1, posn2)

Wrapper for libnova ln_get_angular_separation() function. Get angular separation from equatorial positions.

Param: posn1 - Object of type equ_posn representing body 1 position. Param: posn2 - Object of type equ_posn representing body 2 position.

Returns angular separation in degrees (float).

lsl.astro.get_apparent_posn(mean_position, jD, proper_motion=None)

Wrapper for libnova ln_get_apparent_posn() function. Get apparent position of celestial object accounting for precession, nutation, aberration, and optionally proper motion.

Param: mean_position - J2000 equatorial mean position of object as type
equ_posn.

Param: jD - UTC Julian day (float) to measure position. Param: proper_motion - object of type equ_posn giving object’s proper motion

(optional).

Returns: Apparent equatorial position of object as type equ_posn.

lsl.astro.get_apparent_sidereal_time(jD)

Wrapper for libnova ln_get_apparent_sidereal_time() function. Get apparent sidereal time from Julian day.

Param: jD - UTC Julian day (float).

Returns GM apparent sidereal time (float hours).

lsl.astro.get_date(jD)

Wrapper for libnova ln_get_date() function. Convert Julian day to calendar time.

Param: jD - UTC time in Julian days (float).

Returns object of type date representing UTC time.

lsl.astro.get_date_from_sys()

Wrapper for libnova ln_get_date_from_sys() function. Gets calendar time from system clock.

Returns object of type date representing UTC time.

lsl.astro.get_day_of_week(date)

Wrapper for libnova ln_get_day_of_week() function. Gets day of week from calendar time.

Param: date - Object of type date representing UTC time.

Returns day of week (0 = Sunday, 6 = Saturday).

lsl.astro.get_ecl_from_equ(object_, jD)

Wrapper for libnova ln_ecl_from_equ() function. Get ecliptical coordinates from equatorial coordinates for a given time.

Param: object_ - Object of type equ_posn representing equatorial position. Param: jD - UTC Julian day (float).

Returns object of type ecl_posn representing ecliptic position.

lsl.astro.get_ecl_from_rect(rect)

Wrapper for libnova ln_get_ecl_from_rect() function. Get ecliptical coordinates from rectangular coordinates.

Param: rect - Object of type rect_posn representing position.

Returns object of type lnlat_posn representing ecliptical position.

lsl.astro.get_equ2000_from_gal(object_)

Wrapper for libnova ln_get_equ2000_from_gal() function. Get J2000 equatorial coordinates from galactic coordinates.

Param: object_ - Object of type gal_posn representing galactic position.

Returns object of type equ_posn representing J2000 equatorial position.

lsl.astro.get_equ_aber(mean_position, jD)

Wrapper for libnova ln_get_equ_aber() function. Get position of celestial object accounting for aberration.

Param: mean_position - J2000 equatorial mean position of object as type
equ_posn.

Param: jD - UTC Julian day (float) to measure aberration.

Returns: Adjusted equatorial position of object as type equ_posn.

lsl.astro.get_equ_from_ecl(object_, jD)

Wrapper for libnova ln_get_equ_from_ecl() function. Get equatorial coordinates from ecliptical coordinates for a given time.

Param: object_ - Object of type lnlat_posn representing ecliptic position. Param: jD - UTC Julian day (float).

Returns object of type equ_posn representing equatorial position.

lsl.astro.get_equ_from_gal(object_)

Wrapper for libnova ln_get_equ_from_gal() function. Get B1950 equatorial coordinates from galactic coordinates.

Param: object_ - Object of type gal_posn representing galactic position.

Returns object of type equ_posn representing B1950 equatorial position.

lsl.astro.get_equ_from_hrz(object_, observer, jD)

Wrapper for libnova ln_get_equ_from_hrz() function. Get equatorial/celestial coordinates from local horizontal coordinates.

Param: object_ - Object of type hrz_posn representing horizontal position. Param: observer - Object of type lnlat_posn representing observer position. Param: jD - UTC Julian day (float).

Returns object of type equ_posn representing equatorial position.

lsl.astro.get_equ_from_rect(posn)

Transform rectangular coordinates to equatorial coordinates.

Param: posn - Object of type rect_posn giving position.

Returns: Object of type equ_posn giving equatorial coordinates.

lsl.astro.get_equ_pm(mean_position, proper_motion, jD)

Wrapper for libnova ln_get_equ_pm() function. Adjusts equatorial position of a stellar object accouting for proper motion.

Param: mean_position - J2000 equatorial mean position of object as type equ_posn. Param: proper_motion - Object of type equ_posn giving object’s proper motion

(units are deg/year).

Param: jD - UTC Julian day (float) to measure position.

Returns: Adjusted equatorial position of object as type equ_posn.

lsl.astro.get_equ_prec(mean_position, jD)

Wrapper for libnova ln_get_equ_prec() function. Get position of celestial object accounting for precession. Only works for converting to and from J2000 epoch.

Param: mean_position - J2000 equatorial mean position of object as type equ_posn. Param: jD - UTC Julian day (float) to measure position.

Returns: Adjusted equatorial position of object as type equ_posn.

lsl.astro.get_equ_prec2(mean_position, fromJD, toJD)

Wrapper for libnova ln_get_equ_prec2() function. Get position of celestial object accounting for precession. If libnova has a version lower than 0.12.0, the ln_get_equ_prec_2() function is not available and the NOVAS C library adoptation of precession() is called instead.

Param: mean_position - equatorial first position of object as type equ_posn. Param: fromJD - UTC Julian day (float) of first time. Param: toJD - UTC Julian day (float) of second time.

Returns: Equatorial position of object as type equ_posn converted from
time 1 to time 2.
lsl.astro.get_gal_from_equ(object_)

Wrapper for libnova ln_gal_from_equ() function. Get galactic coordinates from B1950 equatorial coordinates.

Param: object_ - Object of type equ_posn representing B1950 equatorial
position.

Returns object of type gal_posn representing galactic position.

lsl.astro.get_gal_from_equ2000(object_)

Wrapper for libnova ln_gal_from_equ2000() function. Get galactic coordinates from J2000 equatorial coordinates.

Param: object_ - Object of type equ_posn representing J2000 equatorial
position.

Returns object of type gal_posn representing galactic position.

lsl.astro.get_geo_from_rect(posn)

Transform ECEF rectangular coordinates to geographical coordinates. Adapoted from “Satellite Orbits”, Montenbruck and Gill 2005, 5.85 - 5.88. Also see gpstk ECEF::asGeodetic() method.

Param: posn - object of type rect_posn giving position.

Returns: object of type geo_posn giving geographical coordinates.

lsl.astro.get_gmtoff()
Get local UTC offset based on Python time module and system info.
lsl.astro.get_hrz_from_equ(object_, observer, jD)

Wrapper for libnova ln_get_hrz_from_equ() function. Get local horizontal coordinates from equatorial/celestial coordinates.

Param: object_ - Object of type equ_posn representing celestial position. Param: observer - Object of type lnlat_posn representing observer position. Param: jD - UTC Julian day (float).

Returns object of type hrz_posn representing local position.

lsl.astro.get_julian_day(date)

Wrapper for libnova ln_get_julian_day() function. Convert calendar time to Julian day.

Param: date - Object of type date representing UTC time.

Returns UTC time in Julian days (float).

lsl.astro.get_julian_from_sys()

Wrapper for libnova ln_get_julian_from_sys() function.

Returns UTC Julian day (float) from system clock.

lsl.astro.get_julian_from_timet(time_)

Wrapper for libnova ln_get_julian_from_timet() function. Gets Julian day from Unix time.

Param: time_ - Unix timet in seconds (integer)

Returns UTC Julian day (float).

lsl.astro.get_julian_local_date(zonedate)

Wrapper for libnova ln_get_julian_local_date() function. Convert local calendar time to Julian day.

Param: zonedate - Object of type zonedate representing local time.

Returns UTC time in Julian days (float).

lsl.astro.get_jupiter_equ_coords(jD)

Wrapper for libnova ln_get_jupiter_equ_coords() function. Get Jupiter’s apparent equatorial coordinates from Julian day. Accounts for aberration and precession, but not nutation.

Param: jD - UTC Julian day (float).

Returns object of type equ_posn representing equatorial position.

lsl.astro.get_jupiter_rst(jD, observer)

Get Jupiter’s rise, transit, set times from Julian day.

Param: jD - UTC Julian day (float). Param: observer - Object of type lnlat_posn representing observer position.

Returns Object of type rst_time represeting UTC ephemeris times,
or None if the object is circumpolar.
lsl.astro.get_libnova_version()

Get version of libnova C library in use.

Returns: A tuple of version numbers for libnova C library.

lsl.astro.get_local_sidereal_time(lng, jD)

Get apparent local sidereal time from Julian day.

Param: lng - longitude degrees (float), E = positive, W = negative Param: jD - UTC Julian day (float).

Returns: Local apparent sidereal time (float hours).

lsl.astro.get_lunar_equ_coords(jD)

Wrapper for libnova ln_get_lunar_equ_coords() function. Get the Moon’s apparent equatorial coordinates from Julian day. Accounts for aberration and precession, but not nutation.

Param: jD - UTC Julian day (float).

Returns object of type equ_posn representing equatorial position.

lsl.astro.get_lunar_rst(jD, observer)

Get the Moon’s rise, transit, set times from Julian day.

Param: jD - UTC Julian day (float). Param: observer - Object of type lnlat_posn representing observer position.

Returns Object of type rst_time represeting UTC ephemeris times,
or None if the object is circumpolar.
lsl.astro.get_mars_equ_coords(jD)

Wrapper for libnova ln_get_mars_equ_coords() function. Get Mars’ apparent equatorial coordinates from Julian day. Accounts for aberration and precession, but not nutation.

Param: jD - UTC Julian day (float).

Returns object of type equ_posn representing equatorial position.

lsl.astro.get_mars_rst(jD, observer)

Get Mars’ rise, transit, set times from Julian day.

Param: jD - UTC Julian day (float). Param: observer - Object of type lnlat_posn representing observer position.

Returns Object of type rst_time represeting UTC ephemeris times,
or None if the object is circumpolar.
lsl.astro.get_mean_sidereal_time(jD)

Wrapper for libnova ln_get_mean_sidereal_time() function. Get mean sidereal time from Julian day.

Param: jD - UTC Julian day (float).

Returns GM mean sidereal time (float hours).

lsl.astro.get_nutation(jD)

Wrapper for libnova ln_get_nutation() function. Get nutation corrections for a given time.

Param: jD - UTC Julian day (float) to measure nutation.

Returns: Nutation corrections as object of type nutation.

lsl.astro.get_object_rst(jD, observer, object_)

Wrapper for libnova ln_get_object_rst() function. Get rise, set, and transit times of a celstial object.

Param: jD - UTC Julian day (float) target time. Param: observer - object of type lnlat_posn giving observer position Param: object_ - object of type equ_posn giving target equatorial position

Returns: Object of type rst_time giving object’s ephemeris UTC times,
or None if the object is circumpolar.
lsl.astro.get_precession(jD1, pos, jD2)

Caculate precession of equatorial coordinates from one epoch to another.

Param: jD1 - UTC Julian day of epoch 1. Param: pos - object of type equ_posn giving epoch 1 position Param: jD2 - UTC Julian day of epoch 2.

Returns: object of type equ_posn giving epoch 2 position.

lsl.astro.get_rect_from_equ(posn)

Transform equatorial coordinates to rectangular coordinates.

Param: posn - Object of type equ_posn giving position.

Returns: Object of type rect_posn giving rectangular coordinates (normallized to 1).

lsl.astro.get_rect_from_geo(posn)

Transform geographical coordinates to ECEF rectangular coordinates. Adopted from “Satellite Orbits”, Montenbruck and Gill 2005, 5.83 - 5.84. Also see gpstk Geodetic::asECEF() method.

Param: posn - object of type geo_posn giving geographical coordinates.

Returns: object of type rect_posn giving ECEF position.

lsl.astro.get_rel_posn_angle(posn1, posn2)

Wrapper for libnova ln_get_rel_posn_angle() function. Get relative position angle from equatorial positions.

Param: posn1 - Object of type equ_posn representing body 1 position. Param: posn2 - Object of type equ_posn representing body 2 position.

Returns position angle in degrees (float).

lsl.astro.get_saturn_equ_coords(jD)

Wrapper for libnova ln_get_saturn_equ_coords() function. Get Saturn’s apparent equatorial coordinates from Julian day. Accounts for aberration and precession, but not nutation.

Param: jD - UTC Julian day (float).

Returns object of type equ_posn representing equatorial position.

lsl.astro.get_saturn_rst(jD, observer)

Get Saturn’s rise, transit, set times from Julian day.

Param: jD - UTC Julian day (float). Param: observer - Object of type lnlat_posn representing observer position.

Returns Object of type rst_time represeting UTC ephemeris times,
or None if the object is circumpolar.
lsl.astro.get_solar_equ_coords(jD)

Wrapper for libnova ln_get_solar_equ_coords() function. Get Sun’s apparent equatorial coordinates from Julian day. Accounts for aberration and precession, and nutation.

Param: jD - UTC Julian day (float).

Returns object of type equ_posn representing equatorial position.

lsl.astro.get_solar_rst(jD, observer)

Wrapper for libnova ln_get_solar_rst() function. Get Sun’s rise, transit, set times from Julian day.

Param: jD - UTC Julian day (float). Param: observer - Object of type lnlat_posn representing observer position.

Returns Object of type rst_time represeting UTC ephemeris times,
or None if the object is circumpolar..
lsl.astro.get_tai_from_sys()
Return the current time taken from the system clock as a TAI MJD (float).
lsl.astro.get_timet_from_julian(jD)

Wrapper for libnova ln_get_timet_from_julian() function. Gets Unix time from Julian day.

Param: jD - UTC Julian day (float).

Returns Unix timet in seconds (integer).

lsl.astro.get_venus_equ_coords(jD)

Wrapper for libnova ln_get_venus_equ_coords() function. Get Venus’ apparent equatorial coordinates from Julian day. Accounts for aberration and precession, but not nutation.

Param: jD - UTC Julian day (float).

Returns object of type equ_posn representing equatorial position.

lsl.astro.get_venus_rst(jD, observer)

Get Venus’ rise, transit, set times from Julian day.

Param: jD - UTC Julian day (float). Param: observer - Object of type lnlat_posn representing observer position.

Returns Object of type rst_time represeting UTC ephemeris times,
or None if the object is circumpolar.
class lsl.astro.hms(hours=None, minutes=None, seconds=None)

Wrapper for libnova ln_hms structure. Represents times/angles in hours, minutes, seconds.

Public members:
hours - Angle/time hours (integer). minutes - Angle/time minutes (integer). seconds - Angle/time seconds (float).
to_deg()
Convert angles hours, minutes, seconds to float degrees. Returns angle in degrees (float).
to_dms()
Convert angle hours, minutes, seconds to degrees, minutes, seconds. Returns: object of type dms representing angle.
to_sec()
Convert angle hours, minutes, seconds to seconds. Returns: time/angle as seconds.
lsl.astro.hms_to_deg(hms)

Wrapper for libnova ln_hms_to_deg() function. Convert angles hours, minutes, seconds to float degrees.

Param: hms - Object of type hms representing angle.

Returns angle in degrees (float).

lsl.astro.hms_to_rad(hms)

Wrapper for libnova ln_hms_to_rad() function. Convert angles hours, minutes, seconds to float radians.

Param: hms - Object of type hms representing angle.

Returns angle in radians (float).

lsl.astro.hms_to_sec(hms)

Convert hours, minutes, seconds to seconds.

Param: hms - object of type hms representing time/angle.

Returns: Seconds (float) offset of time/angle.

class lsl.astro.hrz_posn(az=None, alt=None)

Wrapper for libnova ln_hrz_posn structure. Represents horizontal local position coordinates. The original libnova convention has been modified for the LWA wrapper. libnova measures azimuth angle clockwise from south to west, with due south equal to 0 degrees. LWA measures azimuth angle clockwise from north to east, with due north equal to 0 degrees. Also, method for using zenith angle instead of altitude angle have been added.

Public members:
az - Position azimuth angle (float degrees). alt - Position altitude angle (float degrees)
Members may also be accessed by subscript:
hrz_posn[0] = az hrz_posn[1] = alt
dir_cos()

Get direction cosines from horizontal coordinates.

Returns: A tuple (l,m,n) of float values for the direction cosines.
l = unit vector in E direction (azimuth = 90) m = unit vector in N direction (azimuth = 0) n = unit vector in zenith direction (zenith = 0, altitude = 90)
to_equ(observer, jD)

Get equatorial/celestial coordinates from local horizontal coordinates.

Param: observer - Object of type lnlat_posn representing observer position. Param: jD - UTC Julian day (float).

Returns object of type equ_posn representing equatorial position.

zen(value=None)
If value is None, returns position zenith angle (float degrees [0, 180]) Otherwise, sets the altitude according to the zenith angle value.
lsl.astro.hrz_to_nswe(pos)

Wrapper for libnova ln_hrz_to_nswe() function. Get cardinal/ordinal azimuth direction.

Param: pos - Object of type hrz_posn giving local position.

Returns string giving direction.

lsl.astro.jd_to_mjd(jd)

Get modified julian day value from julian day value.

Param: jd - julian day (should be >= 2400000.5)

Returns: Modified julian day.

lsl.astro.jd_to_sec(jD)

Convert Julian days into seconds.

Param: jD - Julian days (float).

Returns: Seconds as a float.

lsl.astro.leap_secs(utcJD)

Get the number of leap seconds for given UTC time value.

Param: utcJD - The UTC JD time.
This should be greater than 2441317.5 (1972 JAN 1).

Returns: The number of leap seconds (float) for the UTC time.

class lsl.astro.lnlat_posn(lng=None, lat=None)

Wrapper for libnova ln_lnlat_posn structure. Represents position coordinates in latitude and longitude. When representing a geographical location, the longitude is negative when measured west of GM and positive is measured east of GM.

Public members:
lng - Position longitude coordinate (float degrees). lat - Position latitude coordinate (float degrees).
Members may also be accessed by subscript:
lnlat_posn[0] = lng lnlat_posn[1] = lat
format()
Return a tuple (lng, lat) where lng is an dms object and lat is a dms object representing longitude and latitude position coordinates.
lsl.astro.mjd_to_jd(mjd)

Get julian day value from modified julian day value.

Param: mjd - modified julian day (should be >= 0.0)

Returns: Julian day.

class lsl.astro.nutation(longitude=None, obliquity=None, ecliptic=None)

Wrapper for libnova ln_nutation structure. Provides nutation information in longitude and obliquity.

Public members:
longitude - Nutation in longitude (float degrees). obliquity - Nutation in ecliptic obliquity (float degrees). ecliptic - Obliquity of the ecliptic (float degrees).
format()
Return a tuple (lng, obl, ecl) where lng is an dms object, obl is a dms object, and ecl is a dms object representing nutation in longitude and obliquity, and obliquity of the ecliptic.
lsl.astro.rad_to_deg(radians)

Wrapper for libnova ln_rad_to_deg() function. Convert radians to degress.

Param: radians - Angle in radians (float).

Returns angle in degress (float).

lsl.astro.rad_to_dms(radians)

Wrapper for libnova ln_rad_to_dms() function. Convert angles float radians to degrees, minutes, seconds.

Param: radians - Angle in radians (float).

Returns object of type dms representing angle.

lsl.astro.rad_to_hms(radians)

Wrapper for libnova ln_rad_to_hms() function. Convert angles float radians to hours, minutes, seconds.

Param: radians - Angle in radians (float).

Returns object of type hms representing angle.

lsl.astro.range_degrees(degrees)

Put angle into range [0, 360].

Param: degrees - large angle (float degrees)

Returns: angle in range (float degrees)

lsl.astro.range_hours(hours)
Put an hour time value into the correct range [0.0, 24.0].
class lsl.astro.rect_posn(X=None, Y=None, Z=None)

Wrapper for libnova ln_rect_posn structure. Represents rectangular/Cartesian position coordinates.

Public members:
X - Position X coordinate (float). Y - Position Y coordinate (float). Z - Position Z coordinate (float).
Members may also be accessed by subscript:
rect_posn[0] = X rect_posn[1] = Y rect_posn[2] = Z
class lsl.astro.rst_time(rise=None, set=None, transit=None)

Wrapper for libnova ln_rst_time structure. Represents ephemeris rist, set, and transit times.

Public members:
rise - Rise time in UTC Julian days (float). set - Set time in UTC Julian days (float). transit - Transit time in UTC Julian days (float).
format()
Return a tuple (rise, set, transit) where all three are date objects representing the ephemeris times.
lsl.astro.sec_to_jd(secs)

Convert seconds into julian days.

Param: secs - seconds (float)

Returns: Julian days as a float.

lsl.astro.tai_to_tt(taiJD)

Get the TT JD time value for a given TAI JD time value.

Param: taiJD - The TAI JD time (float).

Returns: The TT JD value (float).

lsl.astro.tai_to_utc(taiJD)

Get the UTC JD time value for a given TAI JD time value.

Param: taiJD - The TAI JD time (float).
This should be greater than 2441317.5 (1972 JAN 1).

Returns: The UTC JD value (float).

lsl.astro.taimjd_to_unix(taiMJD)

Get UNIX time value for a given TAI MJDvalue.

Param: taiMJD - The TAI MJD time (float).

Returns: The UNIX time

lsl.astro.taimjd_to_utcjd(taiMJD)

Get the UTC JD time value for a given TAI MJD value.

Param: mjdTAI - The TAI MJD time (float).

Returns: The UTC JD value (float).

lsl.astro.tt_to_tai(ttJD)

Get the TAI JD time value for a given TT JD time value.

Param: ttJD - The TT JD time (float).

Returns: The TAI JD value (float).

lsl.astro.tt_to_tdb(ttJD)

Get the TDB JD time value for a given TT JD time value. Adopted from “Astronomical Almanac Supplement”, Seidelmann 1992, 2.222-1.

Param: ttJD - The TT JD time (float).

Returns: The TDB JD value (float).

lsl.astro.tt_to_utc(ttJD)

Get the UTC JD time value for a given TT JD time value.

Param: ttJD - The TT JD time (float).

Returns: The UTC JD value (float).

lsl.astro.unix_to_taimjd(unixTime)

Get the TAI MJD time value for a given UNIX time value.

Param: unixTime - the UNIX time (int/float)

Returns: The TAI MJD value.

lsl.astro.unix_to_utcjd(unixTime)

Get the UTC JD time value for a given UNIX time value.

Param: unixTime - the UNIX time (int/float)

Returns: The UTC JD value.

lsl.astro.utc_to_tai(utcJD)

Get the TAI JD time value for a given UTC JD time value.

Param: utcJD - The UTC JD time (float).
This should be greater than 2441317.5 (1972 JAN 1).

Returns: The TAI JD value (float).

lsl.astro.utc_to_tt(utcJD)

Get the TT JD time value for a given UTC JD time value.

Param: utcJD - The UTC JD time (float).

Returns: The TT JD value (float).

lsl.astro.utcjd_to_taimjd(utcJD)

Get the TAI MJD time value for a given UTC JD value.

Param: utcJD - The UTC JD time (float).

Returns: The TAI MJD value.

lsl.astro.utcjd_to_unix(utcJD)

Get UNIX time value for a given UTC JD value.

Param: utcJD - The UTC JD time (float).

Returns: The UNIX time

class lsl.astro.zonedate(years=None, months=None, days=None, hours=None, minutes=None, seconds=None, gmtoff=None)

Wrapper for libnova ln_zonedate structure. Represents local time in calendar units.

Public members:
years - Date years (integer). months - Date months (integer). days - Date days (integer). hours - Date hours (integer). minutes - Date minutes (integer). seconds - Date seconds (float). gmtoff - Seconds offset from GM (integer).
to_date()
Convert local calendar time to UTC calendar time. Returns object of type date representing UTC time.
to_jd()
Convert calendar time to Julian day. Returns UTC time in Julian days (float).
lsl.astro.zonedate_to_date(zonedate)

Wrapper for for libnova ln_zonedate_to_date() function. Convert local calendar time to UTC calendar time.

Param: zonedate - Object of type zonedate representing local time.

Returns object of type date representing UTC time.

Previous topic

Physical Constants

Next topic

Catalogs and Sky Map

This Page