57
57
"StatisticsContainer" ,
58
58
"IntensityStatisticsContainer" ,
59
59
"PeakTimeStatisticsContainer" ,
60
+ "SchedulingBlockContainer" ,
61
+ "ObservationBlockContainer" ,
62
+ "ObservingMode" ,
63
+ "ObservationBlockState" ,
60
64
]
61
65
62
66
63
67
# see https://github.com/astropy/astropy/issues/6509
64
68
NAN_TIME = Time (0 , format = "mjd" , scale = "tai" )
65
69
70
+ #: Used for unsigned integer obs_id or sb_id default values:
71
+ UNKNOWN_ID = np .uint64 (np .iinfo (np .uint64 ).max )
66
72
67
- class EventType (enum .Enum ):
68
- """Enum of EventTypes as defined in the CTA Data Model
69
73
70
- These numbers come from the document *CTA R1/Event Data Model Specification*
71
- version 1 revision C. They may be updated in future revisions
74
+ class SchedulingBlockType (enum .Enum ):
75
+ """
76
+ Types of Scheduling Block
77
+ """
78
+
79
+ UNKNOWN = - 1
80
+ OBSERVATION = 0
81
+ CALIBRATION = 1
82
+ ENGINEERING = 2
83
+
84
+
85
+ class ObservationBlockState (enum .Enum ):
86
+ """Observation Block States. Part of the Observation Configuration data
87
+ model.
88
+ """
89
+
90
+ UNKNOWN = - 1
91
+ FAILED = 0
92
+ COMPLETED_SUCCEDED = 1
93
+ COMPLETED_CANCELED = 2
94
+ COMPLETED_TRUNCATED = 3
95
+ ARCHIVED = 4
96
+
97
+
98
+ class ObservingMode (enum .Enum ):
99
+ """How a scheduling block is observed. Part of the Observation Configuration
100
+ data model.
101
+
102
+ """
103
+
104
+ UNKNOWN = - 1
105
+ WOBBLE = 0
106
+ ON_OFF = 1
107
+ GRID = 2
108
+ CUSTOM = 3
109
+
110
+
111
+ class PointingMode (enum .Enum ):
112
+ """Describes how the telescopes move. Part of the Observation Configuration
113
+ data model.
114
+
115
+ """
116
+
117
+ UNKNOWN = - 1
118
+ #: drives track a point that moves with the sky
119
+ TRACK = 0
120
+ #: drives stay fixed at an alt/az point while the sky drifts by
121
+ DRIFT = 1
122
+
123
+
124
+ class CoordinateFrameType (enum .Enum ):
125
+ """types of coordinate frames used in ObservationBlockContainers. Part of
126
+ the Observation Configuration data model.
127
+
72
128
"""
73
129
130
+ UNKNOWN = - 1
131
+ ALTAZ = 0
132
+ ICRS = 1
133
+ GALACTIC = 2
134
+
135
+
136
+ class EventType (enum .Enum ):
137
+ """Enum of EventTypes as defined in the CTA Data Model [cta_r1event]_"""
138
+
74
139
# calibrations are 0-15
75
140
FLATFIELD = 0
76
141
SINGLE_PE = 1
@@ -79,14 +144,14 @@ class EventType(enum.Enum):
79
144
ELECTRONIC_PEDESTAL = 4
80
145
OTHER_CALIBRATION = 15
81
146
82
- # For mono-telescope triggers (not used in MC)
147
+ #: For mono-telescope triggers (not used in MC)
83
148
MUON = 16
84
149
HARDWARE_STEREO = 17
85
150
86
- # ACADA (DAQ) software trigger
151
+ #: ACADA (DAQ) software trigger
87
152
DAQ = 24
88
153
89
- # Standard Physics stereo trigger
154
+ #: Standard Physics stereo trigger
90
155
SUBARRAY = 32
91
156
92
157
UNKNOWN = 255
@@ -1143,3 +1208,78 @@ class ArrayEventContainer(Container):
1143
1208
default_factory = MonitoringContainer ,
1144
1209
description = "container for event-wise monitoring data (MON)" ,
1145
1210
)
1211
+
1212
+
1213
+ class SchedulingBlockContainer (Container ):
1214
+ """Stores information about the scheduling block. This is a simplified
1215
+ version of the SB model, only storing what is necessary for analysis. From
1216
+ [cta_sb_ob]_
1217
+
1218
+ """
1219
+
1220
+ default_prefix = ""
1221
+ sb_id = Field (UNKNOWN_ID , "Scheduling block ID" , type = np .uint64 )
1222
+ sb_type = Field (
1223
+ SchedulingBlockType .UNKNOWN ,
1224
+ description = "Type of scheduling block" ,
1225
+ type = SchedulingBlockType ,
1226
+ )
1227
+ producer_id = Field (
1228
+ "unknown" ,
1229
+ "Origin of the sb_id, i.e. name of the telescope site or 'simulation'" ,
1230
+ type = str ,
1231
+ )
1232
+ observing_mode = Field (
1233
+ ObservingMode .UNKNOWN ,
1234
+ "Defines how observations within the Scheduling Block are distributed in space" ,
1235
+ type = ObservingMode ,
1236
+ )
1237
+ pointing_mode = Field (
1238
+ PointingMode .UNKNOWN , "Defines how the telescope drives move" , type = PointingMode
1239
+ )
1240
+
1241
+
1242
+ class ObservationBlockContainer (Container ):
1243
+ """Stores information about the observation"""
1244
+
1245
+ default_prefix = ""
1246
+ obs_id = Field (UNKNOWN_ID , "Observation Block ID" , type = np .uint64 )
1247
+ sb_id = Field (UNKNOWN_ID , "ID of the parent SchedulingBlock" , type = np .uint64 )
1248
+ producer_id = Field (
1249
+ "unknown" ,
1250
+ "Origin of the obs_id, i.e. name of the telescope site or 'simulation'" ,
1251
+ type = str ,
1252
+ )
1253
+
1254
+ state = Field (
1255
+ ObservationBlockState .UNKNOWN , "State of this OB" , type = ObservationBlockState
1256
+ )
1257
+
1258
+ subarray_pointing_lat = Field (
1259
+ nan * u .deg ,
1260
+ "latitude of the nominal center coordinate of this observation" ,
1261
+ unit = u .deg ,
1262
+ )
1263
+
1264
+ subarray_pointing_lon = Field (
1265
+ nan * u .deg ,
1266
+ "longitude of the nominal center coordinate of this observation" ,
1267
+ unit = u .deg ,
1268
+ )
1269
+
1270
+ subarray_pointing_frame = Field (
1271
+ CoordinateFrameType .UNKNOWN ,
1272
+ (
1273
+ "Frame in which the subarray_target is non-moving. If the frame is ALTAZ, "
1274
+ "the meaning of (lon,lat) is (azimuth, altitude) while for ICRS it is "
1275
+ "(right-ascension, declination)"
1276
+ ),
1277
+ type = CoordinateFrameType ,
1278
+ )
1279
+
1280
+ scheduled_duration = Field (
1281
+ nan * u .min , "expected duration from scheduler" , unit = u .min
1282
+ )
1283
+ scheduled_start_time = Field (NAN_TIME , "expected start time from scheduler" )
1284
+ actual_start_time = Field (NAN_TIME , "true start time" )
1285
+ actual_duration = Field (nan * u .min , "true duration" , unit = u .min )
0 commit comments