Astronomical Utilities¶
New in version 0.2.
Astronomical utility functions and classes based on libnova library.
-
class
lsl.astro.
dms
(neg=False, degrees=0, minutes=0, seconds=0.0)¶ 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.
-
class
lsl.astro.
hms
(hours=0, minutes=0, seconds=0.0)¶ 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.
-
class
lsl.astro.
date
(years=2000, months=1, days=1, hours=0, minutes=0, seconds=0.0)¶ 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.
-
class
lsl.astro.
zonedate
(years=2000, months=1, days=1, hours=0, minutes=0, seconds=0.0, gmtoff=0)¶ 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).
-
class
lsl.astro.
rst_time
(rise=None, set=None, transit=None)¶ 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.
-
class
lsl.astro.
hrz_posn
(az=0.0, alt=0.0)¶ Represents horizontal local position coordinates. 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.
-
class
lsl.astro.
equ_posn
(ra=0.0, dec=0.0)¶ 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=0.0, b=0.0)¶ 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.
rect_posn
(X=0.0, Y=0.0, Z=0.0)¶ 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.
lnlat_posn
(lng=0.0, lat=0.0)¶ 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.
-
class
lsl.astro.
ecl_posn
(lng=0.0, lat=0.0)¶ 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
-
format
()¶ Return a tuple (lng, lat) where lng is an dms object and lat is a dms object representing longitude and latitude position coordinates.
-
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.
nutation
(longitude=0.0, obliquity=0.0, ecliptic=0.0)¶ 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.
get_gmtoff
()¶ Get local UTC offset based on Python time module and system info.
-
lsl.astro.
date_to_zonedate
(date, gmtoff)¶ 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.
zonedate_to_date
(zonedate)¶ 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.
-
lsl.astro.
rad_to_deg
(radians)¶ Convert radians to degrees.
Param: radians - Angle in radians (float).
Returns angle in degrees (float).
-
lsl.astro.
deg_to_rad
(degrees)¶ Convert degres to radians.
Param: degrees - Angle in degrees (float).
Returns angle in radians (float).
-
lsl.astro.
dms_to_rad
(dms)¶ Convert angles degrees, minutes, seconds to radians.
Param: dms - Object of type dms representing angle.
Returns angle in radians (float).
-
lsl.astro.
dms_to_deg
(dms)¶ Convert angles degrees, minutes, seconds to float degrees.
Param: dms - Object of type dms representing angle.
Returns angle in degrees (float).
-
lsl.astro.
deg_to_dms
(degrees)¶ Convert angles float degrees to degrees, minutes, seconds.
Param: degrees - Angle in degrees (float).
Returns object of type dms representing angle.
-
lsl.astro.
rad_to_dms
(radians)¶ Convert angles float radians to degrees, minutes, seconds.
Param: radians - Angle in radians (float).
Returns object of type dms representing angle.
-
lsl.astro.
hms_to_deg
(hms)¶ 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)¶ Convert angles hours, minutes, seconds to float radians.
Param: hms - Object of type hms representing angle.
Returns angle in radians (float).
-
lsl.astro.
deg_to_hms
(degrees)¶ Convert angles float degrees to hours, minutes, seconds.
Param: degrees - Angle in degrees (float).
Returns object of type hms representing angle.
-
lsl.astro.
rad_to_hms
(radians)¶ Convert angles float radians to hours, minutes, seconds.
Param: radians - Angle in radians (float).
Returns object of type hms representing angle.
-
lsl.astro.
add_secs_hms
(hms, seconds)¶ 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.
-
lsl.astro.
add_hms
(source, dest)¶ 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.
hrz_to_nswe
(pos)¶ Get cardinal/ordinal azimuth direction.
Param: pos - Object of type hrz_posn giving local position.
Returns string giving direction.
-
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.
get_julian_day
(date)¶ 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_local_date
(zonedate)¶ 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_date
(jD)¶ 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_day_of_week
(date)¶ 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_julian_from_sys
()¶ Returns UTC Julian day (float) from system clock.
-
lsl.astro.
get_date_from_sys
()¶ Gets calendar time from system clock.
Returns object of type date representing UTC time.
-
lsl.astro.
get_julian_from_timet
(timet)¶ Gets Julian day from Unix time.
Param: timet - Unix timet in seconds (integer)
Returns UTC Julian day (float).
-
lsl.astro.
get_timet_from_julian
(jD)¶ Gets Unix time from Julian day.
Param: jD - UTC Julian day (float).
Returns Unix timet in seconds (integer).
-
lsl.astro.
get_hrz_from_equ
(target, observer, jD)¶ Get local horizontal coordinates from equatorial/celestial coordinates.
Param: target - 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_equ_from_hrz
(target, observer, jD)¶ Get equatorial/celestial coordinates from local horizontal coordinates.
Param: target - 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_ecl_from_rect
(rect)¶ 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_equ_from_ecl
(target, jD)¶ Get equatorial coordinates from ecliptical coordinates for a given time.
Param: target - 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_ecl_from_equ
(target, jD)¶ Get ecliptical coordinates from equatorial coordinates for a given time.
Param: target - 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_equ_from_gal
(target)¶ Get B1950 equatorial coordinates from galactic coordinates.
Param: target - Object of type gal_posn representing galactic position.
Returns object of type equ_posn representing B1950 equatorial position.
-
lsl.astro.
get_gal_from_equ
(target)¶ Get galactic coordinates from B1950 equatorial coordinates.
- Param: target - Object of type equ_posn representing B1950 equatorial
position.
Returns object of type gal_posn representing galactic position.
-
lsl.astro.
get_equ2000_from_gal
(target)¶ Get J2000 equatorial coordinates from galactic coordinates.
Param: target - Object of type gal_posn representing galactic position.
Returns object of type equ_posn representing J2000 equatorial position.
-
lsl.astro.
get_gal_from_equ2000
(target)¶ Get galactic coordinates from J2000 equatorial coordinates.
- Param: target - Object of type equ_posn representing J2000 equatorial
position.
Returns object of type gal_posn representing galactic position.
-
lsl.astro.
get_apparent_sidereal_time
(jD)¶ Get apparent sidereal time from Julian day.
Param: jD - UTC Julian day (float).
Returns GM apparent sidereal time (float hours).
-
lsl.astro.
get_mean_sidereal_time
(jD)¶ Get mean sidereal time from Julian day.
Param: jD - UTC Julian day (float).
Returns GM mean sidereal time (float hours).
-
lsl.astro.
get_angular_separation
(posn1, posn2)¶ 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_rel_posn_angle
(posn1, posn2)¶ 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).
Based on dpav.f from SLALIB.
-
lsl.astro.
get_apparent_posn
(mean_position, jD, proper_motion=None)¶ 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_equ_prec
(mean_position, jD)¶ 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)¶ Get position of celestial object accounting for precession.
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_nutation
(jD)¶ Get nutation corrections for a given time.
Param: jD - UTC Julian day (float) to measure nutation.
Returns: Nutation corrections as object of type nutation.
Based on the nutate.pro and co_nutate.pro from the AstroIDL library.
-
lsl.astro.
get_equ_nut
(position, jD)¶ Get the position of a celesital object accounting for nutation.
- Param: mean_position - Equatorial position of object as type
equ_posn.
Param: jD - UTC Julian day (float) to measure nutation.
Returns: Adjusted equatorial position of object as type equ_posn.
Based on the AstroIDL co_nutate.pro procedure
-
lsl.astro.
get_equ_aber
(mean_position, jD)¶ 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.
Based on the libnova ln_get_equ_aber() function.
-
lsl.astro.
get_equ_pm
(mean_position, proper_motion, jD)¶ 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.
Based on pm.f, dcs2c.f, and dcc2s.f from SLALIB.
-
lsl.astro.
get_object_rst
(jD, observer, target)¶ 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: target - 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_solar_equ_coords
(jD)¶ 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)¶ 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_jupiter_equ_coords
(jD)¶ 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_saturn_equ_coords
(jD)¶ 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_lunar_equ_coords
(jD)¶ 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_venus_equ_coords
(jD)¶ 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.
-
lsl.astro.
get_mars_equ_coords
(jD)¶ 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.
sec_to_jd
(secs)¶ Convert seconds into julian days.
Param: secs - seconds (float)
Returns: Julian days as a float.
-
lsl.astro.
jd_to_sec
(jD)¶ Convert Julian days into seconds.
Param: jD - Julian days (float).
Returns: Seconds as a float.
-
lsl.astro.
range_hours
(hours)¶ Put an hour time value into the correct range [0.0, 24.0].
-
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.
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.
-
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.
-
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.
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_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.
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.
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.
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.
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
-
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.
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.
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.
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.
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.
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.
get_tai_from_sys
()¶ Return the current time taken from the system clock as a TAI MJD (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.
-
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.
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 mean sidereal time (float hours).
-
class
lsl.astro.
geo_posn
(lng=0.0, lat=0.0, 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.
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.
-
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_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_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_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_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.
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.
Note
The accuracy of this function is about 0.01 degrees.
-
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.
Note
The accuracy of this function is about 0.01 degrees.