Hide keyboard shortcuts

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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

import math 

 

__all__ = ["ObservatoryModelParameters"] 

 

class ObservatoryModelParameters(object): 

"""Class that collects all of the configuration parameters for the 

observatory. 

 

All angle parameters are stored as radians. Speeds are radians/sec 

and accelerations are radians/sec^2 

""" 

 

def __init__(self): 

"""Initialize the class. 

""" 

self.telalt_minpos_rad = 0.0 

self.telalt_maxpos_rad = 0.0 

self.telaz_minpos_rad = 0.0 

self.telaz_maxpos_rad = 0.0 

self.telalt_maxspeed_rad = 0.0 

self.telalt_accel_rad = 0.0 

self.telalt_decel_rad = 0.0 

self.telaz_maxspeed_rad = 0.0 

self.telaz_accel_rad = 0.0 

self.telaz_decel_rad = 0.0 

self.mount_settletime = 0.0 

 

self.telrot_minpos_rad = 0.0 

self.telrot_maxpos_rad = 0.0 

self.telrot_maxspeed_rad = 0.0 

self.telrot_accel_rad = 0.0 

self.telrot_decel_rad = 0.0 

self.telrot_filterchangepos_rad = 0.0 

self.rotator_followsky = False 

self.rotator_resumeangle = False 

 

self.domalt_maxspeed_rad = 0.0 

self.domalt_accel_rad = 0.0 

self.domalt_decel_rad = 0.0 

self.domalt_free_range = 0.0 

self.domaz_maxspeed_rad = 0.0 

self.domaz_accel_rad = 0.0 

self.domaz_decel_rad = 0.0 

self.domaz_settletime = 0.0 

self.domaz_free_range = 0.0 

 

self.optics_ol_slope = 0.0 

self.optics_cl_delay = [] 

self.optics_cl_altlimit = [] 

 

self.readouttime = 0.0 

self.shuttertime = 0.0 

self.filter_changetime = 0.0 

self.filter_darktime = "u" 

self.filter_removable_list = [] 

self.filter_max_changes_burst_num = 0 

self.filter_max_changes_burst_time = 0.0 

self.filter_max_changes_avg_num = 0 

self.filter_max_changes_avg_time = 0.0 

self.filter_max_changes_avg_interval = 0.0 

self.filter_init_mounted_list = [] 

self.filter_init_unmounted_list = [] 

 

self.prerequisites = {} 

 

def configure_camera(self, confdict): 

"""Configure the camera related parameters. 

 

Parameters 

---------- 

confdict : dict 

The set of camera configuration parameters. 

""" 

self.readouttime = confdict["camera"]["readout_time"] 

self.shuttertime = confdict["camera"]["shutter_time"] 

self.filter_changetime = confdict["camera"]["filter_change_time"] 

self.filter_removable_list = confdict["camera"]["filter_removable"] 

self.filter_max_changes_burst_num = confdict["camera"]["filter_max_changes_burst_num"] 

self.filter_max_changes_burst_time = confdict["camera"]["filter_max_changes_burst_time"] 

self.filter_max_changes_avg_num = confdict["camera"]["filter_max_changes_avg_num"] 

self.filter_max_changes_avg_time = confdict["camera"]["filter_max_changes_avg_time"] 

if self.filter_max_changes_avg_num > 0: 

self.filter_max_changes_avg_interval =\ 

self.filter_max_changes_avg_time / self.filter_max_changes_avg_num 

else: 

self.filter_max_changes_avg_interval = 0.0 

try: 

# This is probably not available in most config dicts currently. 

self.camera_fov = confdict["camera"]["field_of_view"] 

except KeyError: 

self.camera_fov = math.radians(3.5) 

 

self.filter_init_mounted_list = list(confdict["camera"]["filter_mounted"]) 

self.filter_init_unmounted_list = list(confdict["camera"]["filter_unmounted"]) 

 

def configure_dome(self, confdict): 

"""Configure the dome related parameters. 

 

Angles must be in degrees, speeds in degrees/sec and accelerations in 

degrees/sec^2. 

 

Parameters 

---------- 

confdict : dict 

The set of dome configuration parameters. 

""" 

self.domalt_maxspeed_rad = math.radians(confdict["dome"]["altitude_maxspeed"]) 

self.domalt_accel_rad = math.radians(confdict["dome"]["altitude_accel"]) 

self.domalt_decel_rad = math.radians(confdict["dome"]["altitude_decel"]) 

self.domalt_free_range = math.radians(confdict["dome"]["altitude_freerange"]) 

self.domaz_maxspeed_rad = math.radians(confdict["dome"]["azimuth_maxspeed"]) 

self.domaz_accel_rad = math.radians(confdict["dome"]["azimuth_accel"]) 

self.domaz_decel_rad = math.radians(confdict["dome"]["azimuth_decel"]) 

self.domaz_free_range = math.radians(confdict["dome"]["azimuth_freerange"]) 

self.domaz_settletime = confdict["dome"]["settle_time"] 

 

def configure_optics(self, confdict): 

"""Configure the optics related parameters. 

 

Slope must be in inverse degrees and altitude limits in degrees. 

 

Parameters 

---------- 

confdict : dict 

The set of optics configuration parameters. 

""" 

self.optics_ol_slope = confdict["optics_loop_corr"]["tel_optics_ol_slope"] / math.radians(1) 

self.optics_cl_delay = list(confdict["optics_loop_corr"]["tel_optics_cl_delay"]) 

self.optics_cl_altlimit = list(confdict["optics_loop_corr"]["tel_optics_cl_alt_limit"]) 

for index, alt in enumerate(self.optics_cl_altlimit): 

self.optics_cl_altlimit[index] = math.radians(self.optics_cl_altlimit[index]) 

 

def configure_rotator(self, confdict): 

"""Configure the telescope rotator related parameters. 

 

Angles must be in degrees, speeds in degrees/sec and accelerations in 

degrees/sec^2. 

 

Parameters 

---------- 

confdict : dict 

The set of telescope rotator configuration parameters. 

""" 

self.telrot_minpos_rad = math.radians(confdict["rotator"]["minpos"]) 

self.telrot_maxpos_rad = math.radians(confdict["rotator"]["maxpos"]) 

self.telrot_maxspeed_rad = math.radians(confdict["rotator"]["maxspeed"]) 

self.telrot_accel_rad = math.radians(confdict["rotator"]["accel"]) 

self.telrot_decel_rad = math.radians(confdict["rotator"]["decel"]) 

self.telrot_filterchangepos_rad = \ 

math.radians(confdict["rotator"]["filter_change_pos"]) 

self.rotator_followsky = confdict["rotator"]["follow_sky"] 

self.rotator_resumeangle = confdict["rotator"]["resume_angle"] 

 

def configure_slew(self, confdict, activities): 

"""Configure the slew related parameters. 

 

Parameters 

---------- 

confdict : dict 

The set of slew configuration parameters. 

activities : list[str] 

The set of slew activities 

""" 

for activity in activities: 

key = "prereq_" + activity 

self.prerequisites[activity] = list(confdict["slew"][key]) 

 

def configure_telescope(self, confdict): 

"""Configure the telescope related parameters. 

 

Angles must be in degrees, speeds in degrees/sec and accelerations in 

degrees/sec^2. 

 

Parameters 

---------- 

confdict : dict 

The set of telescope configuration parameters. 

""" 

self.telalt_minpos_rad = math.radians(confdict["telescope"]["altitude_minpos"]) 

self.telalt_maxpos_rad = math.radians(confdict["telescope"]["altitude_maxpos"]) 

self.telaz_minpos_rad = math.radians(confdict["telescope"]["azimuth_minpos"]) 

self.telaz_maxpos_rad = math.radians(confdict["telescope"]["azimuth_maxpos"]) 

self.telalt_maxspeed_rad = math.radians(confdict["telescope"]["altitude_maxspeed"]) 

self.telalt_accel_rad = math.radians(confdict["telescope"]["altitude_accel"]) 

self.telalt_decel_rad = math.radians(confdict["telescope"]["altitude_decel"]) 

self.telaz_maxspeed_rad = math.radians(confdict["telescope"]["azimuth_maxspeed"]) 

self.telaz_accel_rad = math.radians(confdict["telescope"]["azimuth_accel"]) 

self.telaz_decel_rad = math.radians(confdict["telescope"]["azimuth_decel"]) 

self.mount_settletime = confdict["telescope"]["settle_time"]