The module, hetlib, defines useful functions and the basic configuration information. The hetlib package imports the low level packages tcssubsystem.py and provides wrappers for functionality so it is not necceasary to explicitly import the th low level package. You only need to have the line
import hetlib
in your file to get the full functionality of these packages.
Contants defined in hetlib:
The default URL for the Control System tcsnamed, defined as ‘tcp://192.168.66.99:30000‘
A number of site specific constants are defined:
The latitude of the Het is 30.681436 degrees
Defined as radians(Latitude_deg)
The longitude of the het is 104.014742 degrees west
Defined as radians(LongitudeWest_deg)
Defined as 360.0 - LongitudeWest_deg
Defined as radians(LongitudeEast_deg)
The elevation alitude of the Het primary mirror is 55.055223 degrees
Defined as radians(Altitude_deg)
The height of the Het telescope center of the primary is 2003.0 meters
The Focal length of the Het primary mirror is 13.37884180 meters
Defined as Fs_meters * 1000.0
Defined as cos(Altitude_rad) * cos(Latitude_rad) radians
Defined as sin(Altitude_rad) * sin(Latitude_rad) radians
The angular limit for trajectories is 8.5 degrees
Defined as radians(BetaLimit_deg)
tcsutils contains the workhorse functions for your python scripts. The principal one for client programs is start_clients().
The tcsutils module provides the following constant.
The default URI for the tcs_named-label, defined as ‘tcp://192.168.66.99:30000‘
The following functions are defined:
Start one or a number of clients links. The default values for the system names in ``start_client()` are False. Set them to be true to create a handle (as described in tcssubsystem.py. The function returns a dictionary of handles to Control Systems.
client_dict = start_clients(tcs=True, virus=True)
tcsClient = client_dict['tcs']
virusClient = client_dict['virus']
The hetutils.py package provides functions to do calculations specific to the Hobby Eberly Telescope at McDonald Observatory. These functions provide information about telescope pointing as well as tracker information.
Calculate the total possible track time for a give azimuth and declination. Input arguments are in degrees. The function returns the track time in minutes or 0 if no trajectory is available.
This function calculates the best azimuth for a given declination. The function returns an azimuth only on the east side. If you want the west azimuth, simply add 180 degrees to the return value. The input declination is in degrees, The return value is the azimuth in degrees or None is the declinination is not visible at HET.
Calculate the telecentric hour angle for a given azimuth. Negative values are east hour angles. The input azimuth is in degrees. Returns the hour angle in degrees.
Calculate the zero-crossing paralactic angle as a function of azimuth. The input azimuth is in degrees. Returns the paralactic angle in degrees.
Calculate the telecentric declination as a function of azimuth. The input azimuth is in degrees. Returns the declination in degrees or None if the input is not between 0 <= az < 360.0
Return the value (dX mod 360). This has the result of clipping the value between 0 <= dR < 360.0.
Inputs dX - the value you want clipped
Outputs none
Return (dX mod 360)
Return the value (dX mod 2PI). This has the result of clipping the value between 0 <= dR < 2PI.
Inputs dX - the value you want clipped
Outputs none
Return (dX mod 2PI)
A general purpose modulo (x mod y) function.
Definition of ‘mod’ x mod y = x - y * floor( x/y) for y != 0 x mod 0 = x
if 0 < y then 0 <= (x mod y) < y if 0 > y then 0 >= (x mod y) > y
A number of constants are defined in hetutils and are duplicated in hetlib. Their use from hetutils is deprecated and they will be removed from hetutils at a future date.
Latitude_deg = 30.681436
Latitude_rad = radians(Latitude_deg)
LongitudeWest_deg = 104.014742
LongitudeWest_rad = radians(LongitudeWest_deg)
LongitudeEast_deg = 360.0 - LongitudeWest_deg
LongitudeEast_rad = radians(LongitudeEast_deg)
Altitude_deg = 55.055223
Altitude_rad = radians(Altitude_deg)
Height_meters = 2003.0
Fs_meters = 13.37884180
Fs_millimeters = Fs_meters * 1000.0
het_P = cos(Altitude_rad) * cos(Latitude_rad) # radians
het_Q = sin(Altitude_rad) * sin(Latitude_rad) # radians
# limit on the total angular travel of the tracker
BetaLimit_deg = 8.5
BetaLimit_rad = radians(BetaLimit_deg)
Useful (or not) tools for dealing with Het time in its different formations.
Some definitions:
is reset to 0.0 at 1800 UT hours or 12 noon CST (1300 CDT). There is no information contained here that might indicate which day this index time occurred on. This number may be a floating point value.
0000 hours UT == 00000 secs UT == 0600 hours index == 21600 seconds index
0600 hours UT == 21600 secs UT == 1200 hours index == 43200 seconds index
1200 hours UT == 43200 secs UT == 1800 hours index == 64800 seconds index
1800 hours UT == 64800 secs UT == 2400 hours index == 86400 seconds index (0000)
Note that the timezone information in the datetime.datetime() object is explicitly set to None and the assumption is that all times are UT. This may change in the future if we need to compare local time with HET times. In this case the timezone will be explicitly set to UTC.
Future Plans.
Convert to object hetTime(), subclass of datetime, which takes an index time, unix time, datetime object or ISO string at instantion. added functions hetTime.indexTime(), hetTime.unixTime(), hetTime.ISOtime() to return time in different format. ISOtime and unixTime contain year/mon/day information but index time does not. Use the current year/mon/day unless there is a specified year/mon/day at instantation.
e.g. hetTime(index|unix|iso, year=now.year, mon=year.mon, day=now.day)
The following functions are defined:
Convert a datatime.datetime() object to a ISO time string.
input: datetime object
output: ISO-8601 format string
Convert datetime.datetime() to an index time.
input: datetime.datetime()
output: float
Note that we lose the date information from the datetime() object.
Convert a datetime.datetime() object to a Unix time value.
input: datetime.datetime()
output: Unix time value
Convert an ISO-8601 time string to a datetime.datetime() object.
input: ISO-8601 time string
output: datetime object
Convert a ISO string to an Index time.
input: ISO-8601 format string
output: Index time
Note that we lose the date information from the ISO string.
Convert an ISO time string to a Unix time value.
input: ISO-8601 format string
output: Unix time value
Convert an Index time into a datetime.datetime() object.
input: Index time
output: datetime.datetime()
Note that Index time has no date information
Convert an Index time to a ISO time string.
input: Index time
output: ISO-8601 format string
Note that Index time has no date information
Convert an Index time to a Unix time value
input: Index time
output: Unix time value
Note that Index time has no date information
Convert a Unix time value to a datatime.datetime) object. This function duplicates datetime.fromtimestamp() and is included only for consistence with the other time functions.
input: Unix time value
output: datetime.datetime()
Convert a Unix time value to an ISO time string.
input: Unix time value
output: ISO-8601 format string
Convert a Unix time value to an Index time.
input: datetime object
output: ISO-8601 format string
Note that we lose the date information from the Unix time value.
The commands available are shown in the following matrix
From/To | DT | ISO | Index | Unix |
---|---|---|---|---|
DT | DT_To_ISO() | DT_To_Index() | DT_To_Unix() | |
ISO | ISO_To_DT() | ISO_To_Index() | ISO_To_Unix() | |
Index | Index_To_DT() | Index_To_ISO() | Index_To_Unix() | |
Unix | Unix_To_DT() | Unix_To_ISO() | Unix_To_Index() |
This file contains the list Points which consists of of 97 dictionary defining points in ITF coordinates that lie on the focal sphere. The dictionarys are defined as
Points = [
{'Index': 1,
'X': 790.877147,
'Y': 1812.127196,
'Z': 146.930811,
'Theta': 7.799501970,
'Phi': 3.421093209,
'Rho': 0.000000000,
'Beta': 8.500000000},
...
...
...
{'Index': 97,
'X': -790.877147,
'Y':-1812.127196,
'Z': 146.930811,
'Theta': -7.799501970,
'Phi': -3.421093209,
'Rho': 0.000000000, '
'Beta': 8.500000000},
]
The parameters X, Y, and Z are given in millimeter while Theta, Phi, Rho, and Beta are given in units of degrees
These points are primarily used in the program mountTest (DEFINE LINK HERE) but can be used anywhere. The points were calculated using a tracker sphere of ????? mm.
There are a number of pre-defined lists of points given in the dictionary knownLists. The dictionary contains keys of the form 'List_97' and the value of such a key is a list of the form [1,2,3,4,5,..95,96,97]. Note that the number given in the list is one more than the entry value in Points.
‘List_97’ is the array of all points,
‘List_21’ is the sparse 21 point array,
‘List_Q1’ is the array of all points in the upper right quadrant,
‘List_Q2’ is the array of all points in the lower right quadrant,
‘List_Q3’ is the array of all points in the lower left quadrant,
‘List_Q4’ is the array of all points in the upper left quadrant,