-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathogip_dictionary_timing.py
232 lines (216 loc) · 7.47 KB
/
ogip_dictionary_timing.py
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
def ogip_dictionary_timing():
"""
for a given OGIP file type (timing, etc),
returns a dictionary giving the extnames, the keywords and columns for that extension, and whether the
entry is required (1) or recommended (0), and the specific values for the entry, if any
An asterisk (*) as the final character of a keyword indicates that the keyword root can have multiple values,
for example: MJDREF (MJDREFI + MJDREFF), E_MIN1...E_MINn, etc
Other Special Characters:
a "+" is used if values are tied - if one appears the others need to appear ("MJDREFI + MJDREFF")
a "|" separates names which can be used as alternates ("MJDREF | MJDREFI + MJDREFF")
Square brackets "[ ]" mark required keyword values "HDUCLASS[OGIP]"
Allowed OGIP types:
type = TIMING
@param extname:
@return:
"""
"""
this function returns the required and optional keywords and columns
as defined by OGIP 93-003 for a given extension
"""
"""
FOR RATE TABLE:
"""
"""
Define REQUIRED Keywords for RATE TABLE
"""
reqkeys = ['TELESCOP', 'INSTRUME']
reqkeys.append('DATE-OBS')
reqkeys.append('DATE-END')
reqkeys.append('ONTIME')
reqkeys.append('TIMEZERO|TIMEZERI+TIMEZERF') # can be given as single keyword or integer + fraction; either ok
reqkeys.append('TSTART|TSTARTI+TSTARTF') # can be given as single keyword or integer + fraction; either ok
reqkeys.append('TSTOP|TSTOPI+TSTOPF') # can be given as single keyword or integer + fraction; either ok
reqkeys.append('TIMESYS')
reqkeys.append('TIMEUNIT')
reqkeys.append('TIMEREF')
reqkeys.append('HDUCLASS[OGIP]') # OGIP is the allowed keyword value
reqkeys.append('HDUCLAS1[LIGHTCURVE]') # LIGHTCURVE is the allowed keyword value
"""
Define recommended Keywords
"""
optkeys = ['DETNAM', 'FILTER']
optkeys.append('RA*')
optkeys.append('DEC*')
optkeys.append('CLOCKCOR')
optkeys.append('NUMBAND')
optkeys.append('TIME-OBS') # time-obs can be included in date-obs
optkeys.append('TIME-END') # time-end can be included in date-end
optkeys.append('TIMVERSN')
optkeys.append('OBJECT')
optkeys.append('AUTHOR')
optkeys.append('TASSIGN')
optkeys.append('TIERRELA')
optkeys.append('TIERABSO')
optkeys.append('ONTIME')
optkeys.append('BACKAPP')
optkeys.append('VIGNAPP')
optkeys.append('DEADAPP')
optkeys.append('EMIN*')
optkeys.append('EMAX*')
optkeys.append('BACKV*')
optkeys.append('BACKE*')
optkeys.append('DEADC*')
optkeys.append('GEOAREA')
optkeys.append('VIGNET')
optkeys.append('NPIXSOU')
optkeys.append('NPIXBACK')
"""
Define Required Columns
"""
reqcols = ['TIME']
reqcols.append('RATE|COUNTS') # means need either RATE or COUNTS column
"""
Define Optional Columns
"""
optcols = ['BACKV']
optcols.append('BACKE')
optcols.append('DEADC')
rate = {'KEYWORDS':{'REQUIRED':reqkeys,'RECOMMENDED':optkeys}, 'COLUMNS':{'REQUIRED':reqcols,'RECOMMENDED':optcols}}
"""
FOR EVENTS TABLE:
"""
"""
Define Required Keywords FOR EVENTS TABLE
"""
reqkeys = ['TELESCOP', 'INSTRUME']
reqkeys.append('DATE-OBS')
reqkeys.append('DATE-END')
reqkeys.append('ONTIME')
reqkeys.append('TIMEZER*') # can be given as single keyword or integer + fraction; either ok
reqkeys.append('TSTART*') # can be given as single keyword or integer + fraction; either ok
reqkeys.append('TSTOP*') # can be given as single keyword or integer + fraction; either ok
reqkeys.append('TIMESYS')
reqkeys.append('TIMEUNIT')
reqkeys.append('HDUCLASS[OGIP]')
reqkeys.append('HDUCLAS1[EVENTS]')
"""
Define Optional Keywords
"""
optkeys = ['DETNAM', 'FILTER']
optkeys.append('FILTER')
optkeys.append('RA*')
optkeys.append('DEC*')
optkeys.append('CLOCKCOR')
optkeys.append('NUMBAND')
optkeys.append('TIME-OBS') # time-obs can be included in date-obs
optkeys.append('TIME-END') # time-end can be included in date-end
optkeys.append('TIMVERSN')
optkeys.append('OBJECT')
optkeys.append('AUTHOR')
optkeys.append('TASSIGN')
optkeys.append('TIERRELA')
optkeys.append('TIERABSO')
optkeys.append('ONTIME')
optkeys.append('BACKAPP')
optkeys.append('VIGNAPP')
optkeys.append('DEADAPP')
"""
Define Required Columns
"""
reqcols = ['TIME']
"""
Define Optional Columns
"""
optcols = ['X', 'Y', 'PHA', 'PI', 'DETX', 'DETY']
events = {'KEYWORDS':{'REQUIRED':reqkeys,'RECOMMENDED':optkeys}, 'COLUMNS':{'REQUIRED':reqcols,'RECOMMENDED':optcols}}
"""
FOR GTI TABLE:
"""
"""
Define Required Keywords FOR GTI TABLE
"""
reqkeys = ['TELESCOP', 'INSTRUME']
"""
Define optional Keywords
"""
optkeys = ['DETNAM', 'FILTER']
optkeys.append('FILTER')
optkeys.append('RA*')
optkeys.append('DEC*')
optkeys.append('TIMEZERO|TIMEZERI+TIMEZERF') # can be given as single keyword or integer + fraction; either ok
optkeys.append('TSTART|TSTARTI+TSTARTF') # can be given as single keyword or integer + fraction; either ok
optkeys.append('TSTOP|TSTOPI+TSTARTF') # can be given as single keyword or integer + fraction; either ok
optkeys.append('TIMESYS')
optkeys.append('TIMEUNIT')
optkeys = ['DATE-OBS']
optkeys.append('DATE-END')
optkeys.append('ONTIME')
optkeys=['HDUCLASS[OGIP]']
optkeys.append('HDUCLAS1[GTI]')
"""
Define Required Columns
"""
reqcols = ['START', 'STOP']
"""
Define Optional Columns
"""
optcols = ['TIMEDEL']
gti={'KEYWORDS':{'REQUIRED':reqkeys,'RECOMMENDED':optkeys}, 'COLUMNS':{'REQUIRED':reqcols,'RECOMMENDED':optcols}}
"""
FOR ENEBANDS TABLE:
"""
"""
Define Required keywords
"""
reqkeys = ['TELESCOP', 'INSTRUME']# no ENEBANDS-specific required keywords
"""
Define Optional keywords
"""
optkeys = ['DETNAM', 'FILTER']
"""
Define Required Columns
"""
reqcols = ['E_MIN', 'E_MAX']
"""
Define Optional Columns
"""
optcols = ['MINCHAN', 'MAXCHAN']
eneband={'KEYWORDS':{'REQUIRED':reqkeys,'RECOMMENDED':optkeys}, 'COLUMNS':{'REQUIRED':reqcols,'RECOMMENDED':optcols}}
"""
FOR TIMEREF TABLE:
"""
"""
Define Required keywords
"""
reqkeys = ['TELESCOP', 'INSTRUME']
reqkeys.append('TSTART|TSTARTI+TSTARTF')
reqkeys.append('TSTOP|TSTOPI+TSTARTF')
reqkeys.append('TIMEZERO|TIMEZERI+TIMEZERF')
reqkeys.append('TIMEUNIT')
"""
Define Optional keywords
"""
optkeys = ['DETNAM', 'FILTER']
"""
Define Required Columns
"""
reqcols = ['TIME']
reqcols.append('REFEARTH|REFSUN|REFBSOLS|BARYTIME')
"""
Define Optional Columns
"""
optcols = []
timeref={'KEYWORDS':{'REQUIRED':reqkeys,'RECOMMENDED':optkeys}, 'COLUMNS':{'REQUIRED':reqcols,'RECOMMENDED':optcols}}
# Define which extensions must be present, and which are optional
extns={'REQUIRED':['RATE','EVENTS'],'OPTIONAL':['TIMEREF','ENEBAND','GTI']}
ogip = {'EXTENSIONS':extns,
'RATE':rate,
'EVENTS':events,
'TIMEREF':timeref,
'ENEBAND':eneband,
'GTI':gti,
'REFERENCE':'OGIP/93-003',
'REFTITLE':'The Proposed Timing FITS File Format for High Energy Astrophysics Data',
'REFURL':'http://heasarc.gsfc.nasa.gov/FTP/caldb/docs/ogip/fits_formats/docs/rates/ogip_93_003/ogip_93_003.pdf'}
return ogip