Source
196
196
# check if weight image exists
197
197
self._checkfile(weight_image)
198
198
199
199
# check if brightness unit is empty
200
200
_ia.open(weight_image)
201
201
bunit = _ia.brightnessunit().strip()
202
202
_ia.close()
203
203
self.assertTrue(isinstance(bunit, str))
204
204
self.assertTrue(len(bunit) == 0)
205
205
206
+
# check if wcs related information is identical
207
+
# between science and weight images
208
+
_ia.open(imagename)
209
+
csys_science = _ia.coordsys()
210
+
_ia.close()
211
+
_ia.open(weight_image)
212
+
csys_weight = _ia.coordsys()
213
+
_ia.close()
214
+
try:
215
+
for name in ['referencepixel', 'referencevalue', 'increment']:
216
+
v0 = getattr(csys_science, name)()
217
+
v1 = getattr(csys_weight, name)()
218
+
for key in ['ar_type', 'pw_type']:
219
+
self.assertTrue(key in v0)
220
+
self.assertTrue(key in v1)
221
+
self.assertEqual(v0[key], v1[key])
222
+
key = 'numeric'
223
+
self.assertTrue(key in v0)
224
+
self.assertTrue(key in v1)
225
+
self.assertTrue(numpy.all(v0[key] == v1[key]))
226
+
finally:
227
+
csys_science.done()
228
+
csys_weight.done()
229
+
206
230
def _checkfile( self, name ):
207
231
isthere=os.path.exists(name)
208
232
self.assertEqual(isthere,True,
209
233
msg='output file %s was not created because of the task failure'%(name))
210
234
211
235
def _checkshape(self,name,nx,ny,npol,nchan):
212
236
self._checkfile(name)
213
237
_ia.open(name)
214
238
imshape=_ia.shape()
215
239
_ia.close()