Пример #1
0
    def test_update_scan_zap(self):
        scanset = ScanSet('test.hdf5')

        images = scanset.calculate_images()
        ysize, xsize = images['Feed0_RCP'].shape
        ra_xs, ra_ys, dec_xs, dec_ys, scan_ids, ra_masks, dec_masks, coord = \
            scanset.find_scans_through_pixel(xsize//2, 0, test=True)

        sname = sorted(list(dec_xs.keys()))[0]
        s = Scan(sname)

        info = {sname: copy.copy(self.stdinfo)}
        info[sname]['zap'].xs = [np.float(s['dec'][0]), np.float(s['dec'][10])]
        sid = scan_ids[sname]
        mask = scanset['Scan_id'] == sid
        before = scanset['Feed0_RCP-filt'][mask]
        scanset.update_scan(sname, scan_ids[sname], coord[sname],
                            info[sname]['zap'],
                            info[sname]['fitpars'], info[sname]['FLAG'],
                            test=True)
        after = scanset['Feed0_RCP-filt'][mask]

        assert np.all(before[:10] != after[:10])
        s = Scan(sname)

        assert np.all(np.array(after, dtype=bool) ==
                      np.array(s['Feed0_RCP-filt'], dtype=bool))
Пример #2
0
    def test_update_scan_invalid(self):
        scanset = ScanSet('test.hdf5')

        images = scanset.calculate_images()
        ysize, xsize = images['Feed0_RCP'].shape
        ra_xs, ra_ys, dec_xs, dec_ys, scan_ids, ra_masks, dec_masks, coord = \
            scanset.find_scans_through_pixel(xsize//2, 0, test=True)

        sname = 'xkd'
        coord['xkd'] = None
        scan_ids['xkd'] = None

        info = {sname: copy.copy(self.stdinfo)}
        info[sname]['FLAG'] = True
        with pytest.warns(UserWarning):
            scanset.update_scan(sname, scan_ids[sname], coord[sname],
                                info[sname]['zap'],
                                info[sname]['fitpars'], info[sname]['FLAG'],
                                test=True)
Пример #3
0
    def test_update_scan_fit(self):
        scanset = ScanSet('test.hdf5')

        images = scanset.calculate_images()
        ysize, xsize = images['Feed0_RCP'].shape
        ra_xs, ra_ys, dec_xs, dec_ys, scan_ids, ra_masks, dec_masks, coord = \
            scanset.find_scans_through_pixel(xsize//2, 0, test=True)

        sname = list(scan_ids.keys())[0]

        info = {sname: copy.copy(self.stdinfo)}
        info[sname]['fitpars'] = np.array([0.1, 0.3])
        sid = scan_ids[sname]
        mask = scanset['Scan_id'] == sid
        before = scanset['Feed0_RCP'][mask]
        scanset.update_scan(sname, scan_ids[sname], coord[sname],
                            info[sname]['zap'],
                            info[sname]['fitpars'], info[sname]['FLAG'],
                            test=True)
        after = scanset['Feed0_RCP'][mask]
        assert np.all(before != after)
        s = Scan(sname)
        assert np.all(after == s['Feed0_RCP'])