Single Dish Radio Astronomy Software Tools¶
For an overview of SDRAST and the current status please visit https://sdrast.github.io/.
DatesTimes Package¶
Supporting functions for Date and Time
Date and Time Formats¶
VSR filename time strings¶
Used in the output files, these are text strings of the form:
YYYY DDD ssssss
where the latter is seconds since midnight.
ISO timestamps¶
These are of the form:
YYYYMMDDTHHMMSS or
YYYY-MM-DDTHH:MM:SS.
We’ve extended this to include:
YYYY-DDDTHH:MM(:SS) and
YYYYDDDTHHMM.
Python times¶
take these forms:
datetime.datetime object
datetime.datetime(2015, 12, 19, 10, 29, 29, 198776)
time.time (float)
1450729528.987735
time.struct_time
time.struct_time(tm_year=2015, tm_mon=12, tm_mday=21,
tm_hour=20, m_min=23, tm_sec=18,
tm_wday=0, tm_yday=355, tm_isdst=0)
datetime ordinal (int)
735951
matplotlib datetime (float)
735953.5172106482
UNIX (System) Time¶
Number of seconds since 1970/01/01 00:00:00 UT. Example:
In [10]: time.gmtime(0)
Out[10]: time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1,
tm_hour=0, tm_min=0, tm_sec=0,
tm_wday=3, tm_yday=1, tm_isdst=0)
Julian Date and Modified Julian Date¶
Julian Date is number of days since -4713:11:24 12:00:00 UT Example:
In [11]: julian_date(-4713,328.5)
Out[11]: 0.0
In [12]: calendar_date(-4713,328)
Out[12]: (-4713, 11, 24)
- Modified Julian Date is::
Julian date - 2400000.5
number of days since 1858/11/17 00:00:00 UT.
40587 + unixtime/(24*60*60)
Example:
In [13]: julian_date(1858,day_of_year(1858,11,17))
Out[13]: 2400000.5
In [14]: MJD(1858,11,17)
Out[14]: 0
In [15]: MJD(1970,1,1)
Out[15]: 40587
Functions¶
ISO times¶
Methods to convert to and from ISO times:
format_ISO_time(year,doy,timestr)
ISOtime2datetime(ISOtime):
VSR Times¶
To and from various VSR time formats:
incr_VSR_timestamp(timestr) incr_VSR_timestring(timestr)
make_VSR_timestring()
VSR_to_datetime(VSR_time_tuple)
VSR_to_timetuple(VSR_tuple)
VSR_timestring_to_ISOtime(timestr)
VSR_script_time(doy,h,m,s)
VSR_script_time_to_timestamp(year,string)
VSR_tuple_to_MPL(year,doy,seconds)
VSR_tuple_to_datetime(year,doy,start_sec)
VSR_tuple_to_timestamp(year,doy,start_sec)
VSR_timestamp()
Time strings¶
Various functions to convert to and from time strings:
DDDMM_to_dec_deg(DDDMM)
HHMM_to_timetuple(time_string)
HHMM_to_dec_deg(HHMM)
HHMMSS_to_seconds(string)
make_date_string(date_tuple)
timetuple_to_HHMM(time)
YYYYDDD_datecode(year, midfix, doy)
Miscellaneous¶
Various useful functions:
datetime_to_UnixTime(t)
deg_to_IAU_str(position,format="h")
format_now()
get_current_week()
get_date()
logtime_to_timetuple(time_string)
macro_log_time_to_UnixTime(year,timestr)
mpldate2doy(mpldate)
MPLtime_to_UnixTime(MPLtime)
now_string()
parse_date(ses_date)
seconds(timedelta)
time_int_to_decimal(time)
timestamp_to_str_with_ms(TS)
timetuple_to_datetime(timetuple)
UnixTime_to_datetime(UnixTimeStamp)
UnixTime_to_MPL(UnixTimeStamp)
week_number(year,doy)
MJD_to_UnixTime(MJD)
Functions¶
|
Converts a strin DDDMM to decimal degrees. |
|
Converts a colon-separated time string (HH:MM:SS) to seconds since midnight |
|
Converts a string HHMM to decimal hours. |
|
This converts a time string of the form used in DSN schedules (HHMM) to a time tuple (h,m). |
|
Converts an ISO string to a datetime object |
|
Returns modified Julian date from UNIX time or (year,doy) or (year,month,day) |
|
Converts MJD time to UNIX time |
|
Converts an MPL time to a UNIX time stamp |
|
Convert UnixTime to fractional MJD |
|
Converts a UNIX time stamp (seconds since the epoch) to matplotlib date/time. |
|
Converts a UNIX time stamp to a Python datetime object |
|
This creates a timestamp such as VSR script files use. |
|
Converts a VSR time string like 123/12:34:45 to a UNIX time stamp. |
Alias for make_VSR_timestring, for backwards compatibility |
|
|
Formats a VSR time string as YYYYMMDDTHHMMSS. |
|
Converts a VSR time tuple to a datetime object. |
|
Converts a VSR time tuple to a Python time tuple. |
|
Converts a VSR time tuple to a matplotlib date/time float. |
|
Converts VSR time specification toa datetime object. |
|
Converts a VSR time specification to a UNIX time stamp. |
|
Converts a VSR time string like 16/237 08:45:01 to a UNIX time stamp. |
|
Format the datecode pattern used in many log files. |
|
Calendar date from day of year |
Converts a Python datetime object to a UNIX timestamp. |
|
|
Numeric value for the day of week |
|
Day of year |
|
The position is a longitude-like, latitude-like tuple. |
|
Format an ISO-like time string: YYYY-DDDTHH:MM |
Return the current time as a formatted string: |
|
|
This gets a date string of the form YYY-MM-DD from the command line or requests it from the user. |
|
Alias for inc_VSR_timestring for backwards compatibility |
|
Increments a VSR timestamp. |
|
Julian date |
|
Leap year |
|
This converts a time string of the form used in EAC and RAC logs (HH:MM:SS) to a time tuple (h,m,s). |
|
Given a time string DDD_HH:MM:SS it returns the UNIX timestamp |
Creates a time string for the current time in the format that the VSR uses: ‘YYYY DDD SSSSS’. |
|
|
Accepts a date tuple (year,month,day) and returns a formatted string of the form YYYY-MM-DD. |
|
get day of year from matplotlib date number |
Current minute formatted as YYYY/DDD-HHMM |
|
|
Replacement for matplotlib.dates function |
|
This parses a date string of the form YYYY-MM-DD and returns the string, year, month, day and day of year. |
|
Computes the length of a datetime interval to specified units |
|
Takes a number of the form HHMMSS or +/-DDMMSS and converts it to a decimal. |
Converts a UNIX time.time float to a date time string with milliseconds. |
|
|
Converts a time in time() format, seconds since the epoch, to an HHMM string. |
|
Converts a timetuple (y,mo,d,h,mi,s) to a datetime object. |
|
Computes the week number given the year and day of year. |
Classes¶
This subclass of tzinfo defines standard time in the current timezone |
|
This subclass of tzinfo defines UTC |