ArrayTime¶
-
class
ArrayTime(*args)[source]¶ Bases:
pyasdm.types.Interval.IntervalThe ArrayTime class implements the concept of a point in time, implemented as an Interval of time since 17 November 1858 00:00:00 UTC, the beginning of the modified Julian Day. <p> All dates are assumed to be in the Gregorian calendar, including those prior to October 15, 1582. So, if you are interested in very old dates, this isn’t the most convenient class to use. <p> Internally the time is kept in units of nanoseconds (10<sup>-9</sup> seconds). The base time is 17 November 1858 00:00:00 UTC, and the maximum time is to the year 2151 (2151-02-25T23:47:16.854775807). This differs from the OMG Time service The OMG time is in units of 100 nanoseconds using the beginning of the Gregorian calandar,15 October 1582 00:00:00 UTC, as the base time. The reason for this increased accuracy is that the Control system is capable of measuring time to an accuracy of 40 nanoseconds. Therefore, by adhering to the representation of time used in the OMG Time Serivce we would be losing precision. <p> The Time class is an extension of the Interval class, since all times are intervals since 17 November 1858 00:00:00 UTC. <p> All times in this class are assumed to be International Atomic Time (TAI). A specific TAI time differs from the corresponding UTC time by an offset that is an integral number of seconds. <p> In the methods that give various quantities associated with calendar times, this class does not apply any UTC corrections. Therefore, if you use these methods to produce calendar times, the results will differ from civil time by a few seconds. The classes UTCTime and LocalTime take the UTC and timezone corrections into account. <p> The main reference used in crafting these methods is Astronomical Algorithms by Jean Meeus, second edition, 2000, Willmann-Bell, Inc., ISBN 0-943396-61-1. See chapter 7, “Julian day”, and chapter 12, “Sidereal Time”. <p> This version adapted from the c++ and java implementations, originally authored by Allen Farris.
Methods Summary
FITSString(t)Return a unit of time, as a long, from a FITS-formatted string that specifies the time.
add(time, interval)Generate a new ArrayTime by adding an Interval to the specified ArrayTime.
from1Bin(eis)Read the binary representation of 1D list of ArrayTime from an EndianInput instance
from2Bin(eis)Read the binary representation of 2D list of ArrayTime from an EndianInput instance
from3Bin(eis)Read the binary representation of 3D list of ArrayTime from an EndianInput instance
fromBin(eis)Read the binary representation of an ArrayTime from an EndianInput instance and use the read value to set an ArrayTime in nanoseconds.
getDateTime()Return this time as a tuple of integers representing (in order): year, month (varies from 1 to 12), day (varies from 1 to 28, 29, 30, or 31), hour (varies from 0 to 23), minute (varies from 0 to 59), second (varies from 0 to 59), and the number of nanoseconds that remain in this fraction of a second.
getDayOfWeek()Return the day number of the week of this time.
getDayOfYear()Return the day number of year of this time.
getGreenwichMeanSiderealTime()Return the Greenwich mean sidereal time for this time in hours and fractions of an hour.
getInstance(stringList)Retrieve a value from a list of strings and convert that to an ArrayTime.
getJD([mjd])When no argument is used, return the value of this ArrayTime as a Julian day, otherwise convert the given Modified Julain day to the corresponding Julian day @param mjd The Julian day, otherwise use the value of this ArrayTime @returns The Modified Julain day
getLocalSiderealTime(longitudeInHours)Return the local sidereal time for this time in hours and fractions of an hour at the specified longitude
getMJD([jd])When no argument is used, return the value of this ArrayTime as a Modified Julian day, otherwise convert the given Julain day to the corresponding Modified Julian day @param mjd The Julian day, otherwise use the value of this ArrayTime @returns The Modified Julain day
getTimeOfDay()Return the time of day in hours and fractions thereof.
init(year, month, day, hour, minute, second)initFloatDay(year, month, day)Initialize this time as appropriate for year, month, and day
isLeapYear(year)Return true if the specified year is a leap year.
jdToUnit(jd)Convert a Julian day to a unit of time in tens of nanoseconds since 15 October 1582 00:00:00 UTC.
listTo1DBin(atList, eos)Write a 1D list of ArrayTime to the EndianOutput instance.
listTo2DBin(atList, eos)Write a 2D list of ArrayTime to the EndianOutput instance.
listTo3DBin(atList, eos)Write a 3D list of ArrayTime to the EndianOutput instance.
listToBin(arrayTimeList, eos)Write a list of ArrayTime to the EndianOutput.
mjdToUnit(mjd)Convert a Modified Julian day to units since the base time.
sub(time, interval)Generate a new ArrayTime by subtracting an Interval from the specified ArrayTime.
timeOfDayToString()Return the time of day as a string in the form “hh:mm:ss
toBin(eos)Write this ArrayTime as a long in nanoseconds to an EndianOutput instance.
toFITS()Return this Time as a FITS formatted string, which is of the form ‘YYYY-MM-DDThh:mm:ss.ssss’
unitToJD(unit)Convert a unit of time in units since the base time to a Julian day.
unitToMJD(unit)Convert a unit of time in units since the base time to a Modified Julian day.
Methods Documentation
-
FITSString(t)[source]¶ Return a unit of time, as a long, from a FITS-formatted string that specifies the time. The format must be of the form:
YYYY-MM-DDThh:mm:ss.ssss
Leading zeros are required if months, days, hours, minutes, or seconds are single digits. The value for months ranges from “01” to “12”. The “T” separting the data and time values is optional. If the “T” is not present, then a space MUST be present.
A ValueError is raised if the string is not a valid time.
-
static
add(time, interval)[source]¶ Generate a new ArrayTime by adding an Interval to the specified ArrayTime. @param time an ArrayTime @param interval The interval to be added to the time. @return A new ArrayTime formed by adding an Interval to the specified ArrayTime.
-
static
from1Bin(eis)[source]¶ Read the binary representation of 1D list of ArrayTime from an EndianInput instance
return a 1D list of ArrayTime
-
static
from2Bin(eis)[source]¶ Read the binary representation of 2D list of ArrayTime from an EndianInput instance
return a 2D list of ArrayTime
-
static
from3Bin(eis)[source]¶ Read the binary representation of 3D list of ArrayTime from an EndianInput instance
return a 3D list of ArrayTime
-
static
fromBin(eis)[source]¶ Read the binary representation of an ArrayTime from an EndianInput instance and use the read value to set an ArrayTime in nanoseconds.
return an ArrayTime
-
getDateTime()[source]¶ Return this time as a tuple of integers representing (in order): year, month (varies from 1 to 12), day (varies from 1 to 28, 29, 30, or 31), hour (varies from 0 to 23), minute (varies from 0 to 59), second (varies from 0 to 59), and the number of nanoseconds that remain in this fraction of a second.
-
getDayOfWeek()[source]¶ Return the day number of the week of this time. Day numbers start from 0-Sunday
-
getGreenwichMeanSiderealTime()[source]¶ Return the Greenwich mean sidereal time for this time in hours and fractions of an hour.
-
static
getInstance(stringList)[source]¶ Retrieve a value from a list of strings and convert that to an ArrayTime.
This is used when parsing ArrayTime lists from an XML representation to eventually construct a list of ArrayTime instances. The values are expected to be integers representing nanoseconds.
Returns a tuple of (ArrayTime, stringList) where ArrayTime is the new ArrayTime created by this call and stringList is the remaining, unused, part of stringList after removing the first element.
-
getJD(mjd=None)[source]¶ When no argument is used, return the value of this ArrayTime as a Julian day, otherwise convert the given Modified Julain day to the corresponding Julian day @param mjd The Julian day, otherwise use the value of this ArrayTime @returns The Modified Julain day
-
getLocalSiderealTime(longitudeInHours)[source]¶ Return the local sidereal time for this time in hours and fractions of an hour at the specified longitude
-
getMJD(jd=None)[source]¶ When no argument is used, return the value of this ArrayTime as a Modified Julian day, otherwise convert the given Julain day to the corresponding Modified Julian day @param mjd The Julian day, otherwise use the value of this ArrayTime @returns The Modified Julain day
-
initFloatDay(year, month, day)[source]¶ Initialize this time as appropriate for year, month, and day
-
static
isLeapYear(year)[source]¶ Return true if the specified year is a leap year. @param year the year in the Gregorian calendar. @return true if the specified year is a leap year.
-
jdToUnit(jd)[source]¶ Convert a Julian day to a unit of time in tens of nanoseconds since 15 October 1582 00:00:00 UTC. @param jd The Julian day to be converted. @return The unit corresponding to the specified Julian day.
-
static
listToBin(arrayTimeList, eos)[source]¶ Write a list of ArrayTime to the EndianOutput. The list may have 1, 2 or 3 dimensions.
-
mjdToUnit(mjd)[source]¶ Convert a Modified Julian day to units since the base time. @param mjd The Modified Julian day to be converted. @return The unit corresponding to the specified Modified Julian day.
-
static
sub(time, interval)[source]¶ Generate a new ArrayTime by subtracting an Interval from the specified ArrayTime. @param time an ArrayTime @param interval The interval to be subtracted from the time. @return A new ArrayTime formed by subtracting an Interval from the specified ArrayTime.
-
toFITS()[source]¶ Return this Time as a FITS formatted string, which is of the form ‘YYYY-MM-DDThh:mm:ss.ssss’
-