Coverage for python/lsst/sims/utils/ModifiedJulianDate.py : 82%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# Filter out ERFA's complaints that we are simulating dates which # are in the future message='.*taiutc.*dubious.year.*')
""" A sub-class of Warning. All of the warnings raised by ModifiedJulianDate will be of this class (or its sub-classes), so that users can filter them out by creating a simple filter targeted at category=MJDWarning. """
""" A sub-class of MJDWarning meant for use when astropy.Time cannot interpolate UT1-UTC as a function of UTC because UTC is out of bounds of the data. This class exists so that users can filter these warnings out by creating a simple filter targeted at category=UTCtoUT1Warning. """
def _get_ut1_from_utc(cls, UTC): """ Take a numpy array of UTC values and return a numpy array of UT1 and dut1 values """
except IERSRangeError: ut1_out = np.copy(UTC) dut1_out = np.zeros(len(UTC)) warnings.warn("ModifiedJulianData.get_list() was given date values that are outside " "astropy's range of interpolation for converting from UTC to UT1. " "We will treat UT1=UTC for those dates, lacking a better alternative.", category=UTCtoUT1Warning) from astropy.utils.iers import TIME_BEFORE_IERS_RANGE, TIME_BEYOND_IERS_RANGE dut1_test, status = time_list.get_delta_ut1_utc(return_status=True) good_dexes = np.where(np.logical_and(status != TIME_BEFORE_IERS_RANGE, status != TIME_BEYOND_IERS_RANGE))
if len(good_dexes[0]) > 0: time_good = Time(UTC[good_dexes], scale='utc', format='mjd') dut1_good = time_good.delta_ut1_utc ut1_good = time_good.ut1.mjd
ut1_out[good_dexes] = ut1_good dut1_out[good_dexes] = dut1_good
""" Instantiate a list of ModifiedJulianDates from a numpy array of either TAI or UTC values.
@param[in] TAI (optional) a numpy array of MJD' in TAI
@param[in] UTC (optional) a numpy array of MJDs in UTC
@param[out] a list of ModifiedJulianDate instantiations with all of their properties already set (so the code does not waste time converting from TAI to TT, TDB, etc. when those time scales are called for). """
return None
raise RuntimeError("You should not specify both TAI and UTC in ModifiedJulianDate.get_list()")
ut1_list, dut1_list]).transpose()
""" Must specify either:
@param [in] TAI = the International Atomic Time as an MJD
or
@param [in] UTC = Universal Coordinate Time as an MJD """
raise RuntimeError("You must specify either TAI or UTC to " "instantiate ModifiedJulianDate")
else:
""" Force the properties of this ModifiedJulianDate to have specific values.
values is a list of [TAI, UTC, TT, TDB, UT1, UT1-UTC] values.
This method exists so that, when instantiating lists of ModifiedJulianDates, we can use astropy.time.Time's vectorized methods to quickly perform many conversions at once. Users should not try to use this method by hand. """
else:
""" Raise a standard warning if UTC is outside of the range that can be interpolated on the IERS tables.
method_name is the name of the method that caused this warning. """ warnings.warn("UTC is outside of IERS table for UT1-UTC.\n" "Returning UT1 = UTC for lack of a better idea\n" "This warning was caused by calling ModifiedJulianDate.%s\n" % method_name, category=UTCtoUT1Warning)
def TAI(self): """ International Atomic Time as an MJD """
def UTC(self): """ Universal Coordinate Time as an MJD """
def UT1(self): """ Universal Time as an MJD """ except IERSRangeError: self._warn_utc_out_of_bounds('UT1') self._ut1 = self.UTC
def dut1(self): """ UT1-UTC in seconds """
except IERSRangeError: self._warn_utc_out_of_bounds('dut1') self._dut1 = 0.0
def TT(self): """ Terrestrial Time (aka Terrestrial Dynamical Time) as an MJD """
def TDB(self): """ Barycentric Dynamical Time as an MJD """
|