forked from mfacorcoran/ogip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathogip_dictionary_image.py
86 lines (70 loc) · 2.06 KB
/
ogip_dictionary_image.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
def ogip_dictionary_image():
"""
For a given OGIP file type, returns a dictionary giving the
extnames, the keywords and columns for that extension, and whether
the entry is required (level=1) or not, and the specific
values for the entry, if any.
All logic is possible, as the requirement is given as a string
that will be passed to eval() in a context where the object h will
contain a class instance that contains the header and the
functions
h.Exists('KEY')
h.hasVal('KEY','VAL')
etc.
@return:
"""
"""
this function returns the required and optional keywords and columns
as defined by OGIP. Reference file TBD.
"""
global status
global REPORT
"""
FOR the IMAGE file:
"""
"""
Define requirements for keywords for PRIMARY or IMAGE extension
"""
reqkeys = {
'TELESCOP':{"level":1,"req":"h.Exists('TELESCOP')"},
'INSTRUME':{"level":1,"req":"h.Exists('INSTRUME')"},
'HDUCLASS':{"level":1,"req":"h.hasVal('HDUCLASS','OGIP')"},
'FILTER': {"level":3,"req":"h.Exists('FILTER')"},
}
"""
Define requirements for columns
"""
reqcols = {
}
image = {'KEYWORDS':reqkeys, 'COLUMNS':reqcols}
"""
For GTI extension
"""
"""
Define requirements for keywords for GTI table
"""
reqkeys = {
'TELESCOP':{"level":1,'req':"h.Exists('TELESCOP')"},
'INSTRUME':{"level":1,'req':"h.Exists('INSTRUME')"},
}
"""
Define requirements for columns
"""
reqcols = {
}
gti={'KEYWORDS':reqkeys, 'COLUMNS':reqcols}
extns={'REQUIRED':[''],'OPTIONAL':['GTI']}
# Alternate extension names for those required. Will generate an
# error but allow checking to continue.
alt_extns={}
#
# create structure for redistribution matrix file
#
ogip = {'EXTENSIONS':extns,
'ALT_EXTNS':alt_extns,
'IMAGE':image,
'GTI':gti,
'REFERENCE':'TBD',
'REFURL':'TBD',
'REFTITLE':''}
return ogip