Ejemplo n.º 1
0
 def test_add_masks(self):
     ccd = MaskedCCD(self.mask_image)
     ccd.add_masks(self.summed_mask_file)
     total_signal = (self.signal * (self.ymax - self.ymin) *
                     (self.xmax - self.xmin))
     ny, nx = ccd[ccd.keys()[0]].getImage().getArray().shape
     for amp in ccd:
         self.assertEqual(sum(ccd[amp].getImage().getArray().flat),
                          total_signal)
     stat_ctrl = ccd.setMask('BAD')
     for amp in ccd:
         stats = afwMath.makeStatistics(ccd[amp], afwMath.MEAN, stat_ctrl)
         self.assertEqual(0, stats.getValue(afwMath.MEAN))
     stat_ctrl = ccd.setMask(clear=True)
     for amp in ccd:
         stats = afwMath.makeStatistics(ccd[amp], afwMath.MEAN, stat_ctrl)
         self.assertAlmostEqual(float(total_signal) / (nx * ny),
                                stats.getValue(afwMath.MEAN),
                                places=10)
Ejemplo n.º 2
0
 def test_setMask(self):
     ccd = MaskedCCD(self.mask_image)
     for mp, bit in self.mpd.items():
         sctrl = ccd.setMask(mask_name=mp, clear=True)
         self.assertEqual(sctrl.getAndMask(), 2**bit)