Example #1
0
    def setUp(self):

        # build an MCCD
        self.level1 = 10.
        win1 = Winhead(31, 41, 5, 5, 1, 2)
        data1 = np.empty((win1.ny, win1.nx))
        data1[:] = self.level1
        wind1 = Window(win1, data1)

        self.level3 = 20.
        win2 = Winhead(250, 561, 5, 5, 1, 2)
        data2 = np.empty((win1.ny, win1.nx))
        data2[:] = self.level3
        wind2 = Window(win2, data2)

        winds = ((1, wind1), (3, wind2))

        head = fits.Header()
        head['OBJECT'] = ('Fake 1', 'Name')
        head['FILTER'] = ('r', 'Filter')
        ccd1 = CCD(winds, 2048, 1024, head)

        ccd2 = ccd1.copy()
        ccd2.head['FILTER'] = ('g', 'Filter')

        ccds = ((3, ccd1), (5, ccd2))
        head = fits.Header()
        head['TEST'] = 'This is HiPERCAM'

        self.mccd = MCCD(ccds, head)
Example #2
0
 def setUp(self):
     self.agroup = Agroup()
     win = Winhead(1, 1, 10, 10, 1, 1)
     self.val1 = 1.
     wind = Window(win, self.val1 * np.ones((win.ny, win.nx)))
     self.agroup[1] = wind
     win = Winhead(100, 200, 10, 10, 1, 1)
     self.val2 = 10.
     wind = Window(win, self.val2 * np.ones((win.ny, win.nx)))
     self.agroup[2] = wind
Example #3
0
    def setUp(self):

        # build a CCD
        self.level1 = 10.
        win1 = Winhead(31,41,5,5,1,2)
        data1 = np.empty((win1.ny,win1.nx))
        data1[:] = self.level1
        wind1 = Window(win1,data1)

        self.level3 = 20.
        win2 = Winhead(250,561,5,5,1,2)
        data2 = np.empty((win1.ny,win1.nx))
        data2[:] = self.level3
        wind2 = Window(win2,data2)

        winds = ((1,wind1),(3,wind2))

        head = fits.Header()
        head['OBJECT'] = ('Fake 1','Name')
        self.ccd = CCD(winds, 2048, 1024, head)
Example #4
0
    def setUp(self):

        # build some (small) Windows
        self.win1 = Winhead(31,41,3,4,1,2)
        self.data1 = np.ones((self.win1.ny,self.win1.nx))
        self.wind1 = Window(self.win1, self.data1)

        # should be compatible with win1
        self.wind2 = copy.deepcopy(self.wind1)

        # designed to be incompatible with win1
        self.wind3 = copy.deepcopy(self.wind1)
        self.wind3.llx += 1
Example #5
0
    def test_windat_add_noise(self):
        """Rather crude test this, but it should pick up disasters"""
        win = Winhead(1,1,100,100,1,1)
        data = np.zeros((win.ny,win.nx))
        wind = Window(win, data)

        wind.add_noise(1.,1.)
        mean = wind.mean()
        std = wind.std()
        npix = wind.size

        self.assertTrue(abs(mean) < 7./np.sqrt(npix),
                        'mean out of expected range')
        self.assertTrue(abs(std - 1.) < 7./np.sqrt(2*np.sqrt(npix)),
                        'standard deviation out of expected range')
Example #6
0
 def test_windat_percentile(self):
     win = Winhead(1,1,3,3,1,1)
     data = np.array([[-1.,-1.,-1.],[-1.,0.,1.],[1.,1.,1.]])
     wind = Window(win, data)
     self.assertEqual(wind.percentile(50.), 0.,
                      'incorrect percentile value returned')
Example #7
0
 def test_windat_std(self):
     win = Winhead(1,1,2,2,1,1)
     data = np.array([[-1.,-1.],[1.,1.]])
     wind = Window(win, data)
     self.assertEqual(wind.std(), 1.,
                      'incorrect standard deviation returned')