1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 """
19
20 This module provides the FITSImage and FITSUVData classes. These
21 classes implement most of the data oriented verb-like functionality
22 from classic FITS.
23
24 """
25
26
27 from FITS import FITS
28
29
30 import sys
31
32
33
34
35
36
37
38
39
40
41
43 """Return the name of the function that called us."""
44 return sys._getframe(1).f_code.co_name
45
46
48
49 """This class implements dispatching function calls to a proxy."""
50
54
56 func = self.inst._method(self.name)
57 return func(self.inst.desc, *args)
58
59
61
62 """This class implements the description of FITS data that is used
63 when dispatching function calls to a proxy."""
64
68
69
70
72 return self.__dict__[key]
73
74
76
77 """This class describes generic FITS data."""
78
84
85 filename = property(lambda self: self.desc.filename,
86 doc='Filename of this data set.')
87 disk = property(lambda self: self.desc.disk,
88 doc='Disk where this data set is stored.')
89
91 repr = "%s('%s', %d)" % \
92 (self.filename, self.disk)
93 return repr
94
97
102
103 - def table(self, type, version):
105
108
110 """Check whether this image or data set exists.
111
112 Returns True if the image or data set exists, False otherwise."""
113 return self._method(_whoami())(self.desc)
114
116 """Verify whether this image or data set can be accessed."""
117 return self._method(_whoami())(self.desc)
118
120 """Get the header for this image or data set.
121
122 Returns the header as a dictionary."""
123 return self._method(_whoami())(self.desc)
124
126 """Get the list of extension tables."""
127 return self._method(_whoami())(self.desc)
128
130 """Get the highest version of an extension table.
131
132 Returns the highest available version number of the extension
133 table TYPE."""
134 return self._method(_whoami())(self.desc, type)
135
137 """Destroy this image or data set."""
138 return self._method(_whoami())(self.desc)
139
141 """Get the header of an extension table.
142
143 Returns the header of version VERSION of the extension table
144 TYPE."""
145 return self._method(_whoami())(self.desc, type, version)
146
148 """Get a row from an extension table.
149
150 Returns row ROWNO from version VERSION of extension table TYPE
151 as a dictionary."""
152 return self._method(_whoami())(self.desc, type, version, rowno)
153
155 """Destroy an extension table.
156
157 Deletes version VERSION of the extension table TYPE. If
158 VERSION is 0, delete the highest version of table TYPE. If
159 VERSION is -1, delete all versions of table TYPE."""
160 return self._method(_whoami())(self.desc, type, version)
161
162
164
165 """This class describes an FITS image."""
166 pass
167
168
170
171 """This class describes an FITS UV data set."""
172 pass
173
174
176
177 """ This class implements dispatching table oriented function
178 calls to a proxy."""
179
182
184 func = self.inst.data._method(self.name + '_table')
185 return func(self.inst.data.desc,
186 self.inst.name, self.inst.version, *args)
187
188
190
191 """This class describes a generic FITS extension table."""
192
193 - def __init__(self, data, name, version):
197
200