Exemple #1
0
 def setUp(self):
     self.lsb = SpectralWindow(1000.0, 10.0, 6, sideband=-1, product='lsb')
     self.usb = SpectralWindow(1000.0, 10.0, 6, sideband=1, band='X')
     self.odd = SpectralWindow(1000.0, 10.0, 5, sideband=1)
     # channel_width will not be an exact float. The values have been
     # chosen so that bandwidth / num_chans * num_chans does not quite
     # equal bandwidth.
     self.inexact = SpectralWindow(1000.0,
                                   None,
                                   14,
                                   sideband=1,
                                   bandwidth=230.0)
Exemple #2
0
 def setup(self):
     self.target = Target('PKS1934-638, radec, 19:39, -63:42')
     self.antennas = [
         Antenna('m000, -30:42:39.8, 21:26:38.0, 1086.6, 13.5, '
                 '-8.264 -207.29 8.5965'),
         Antenna('m063, -30:42:39.8, 21:26:38.0, 1086.6, 13.5, '
                 '-3419.5845 -1840.48 16.3825')
     ]
     corrprods = [('m000h', 'm000h'), ('m000v', 'm000v'),
                  ('m063h', 'm063h'), ('m063v', 'm063v'),
                  ('m000h', 'm063h'), ('m000v', 'm063v')]
     subarray = Subarray(self.antennas, corrprods)
     spw = SpectralWindow(centre_freq=1284e6,
                          channel_width=0,
                          num_chans=16,
                          sideband=1,
                          bandwidth=856e6)
     # Pick a time when the source is up as that seems more realistic
     self.timestamps = 1234667890.0 + 1.0 * np.arange(10)
     self.dataset = MinimalDataSet(self.target, subarray, spw,
                                   self.timestamps)
     self.array_ant = self.dataset.sensor.get('Antennas/array/antenna')[0]
Exemple #3
0
class TestSpectralWindow(object):
    def setUp(self):
        self.lsb = SpectralWindow(1000.0, 10.0, 6, sideband=-1, product='lsb')
        self.usb = SpectralWindow(1000.0, 10.0, 6, sideband=1, band='X')
        self.odd = SpectralWindow(1000.0, 10.0, 5, sideband=1)
        # channel_width will not be an exact float. The values have been
        # chosen so that bandwidth / num_chans * num_chans does not quite
        # equal bandwidth.
        self.inexact = SpectralWindow(1000.0,
                                      None,
                                      14,
                                      sideband=1,
                                      bandwidth=230.0)

    def test_width_properties(self):
        assert_equal(self.lsb.channel_width, 10.0)
        assert_equal(self.lsb.bandwidth, 60.0)
        assert_equal(self.inexact.channel_width, 230.0 / 14)
        assert_equal(self.inexact.bandwidth, 230.0)

    def test_channel_freqs(self):
        assert_array_equal(self.lsb.channel_freqs,
                           [1030.0, 1020.0, 1010.0, 1000.0, 990.0, 980.0])
        assert_array_equal(self.usb.channel_freqs,
                           [970.0, 980.0, 990.0, 1000.0, 1010.0, 1020.0])
        assert_array_equal(self.odd.channel_freqs,
                           [980.0, 990.0, 1000.0, 1010.0, 1020.0])
        assert_array_almost_equal(self.inexact.channel_freqs,
                                  np.arange(14) * 230.0 / 14 + 885.0)
        # Check that the exactly representable values are exact
        assert_equal(self.inexact.channel_freqs[0], 885.0)
        assert_equal(self.inexact.channel_freqs[7], 1000.0)

    def test_repr(self):
        # Just a smoke test to check that it doesn't crash
        repr(self.lsb)
        repr(self.usb)

    def test_subrange(self):
        lsb_sub = self.lsb.subrange(0, 3)
        assert_array_equal(lsb_sub.channel_freqs, [1030.0, 1020.0, 1010.0])
        assert_equal(lsb_sub.product, self.lsb.product)
        usb_sub = self.usb.subrange(2, 6)
        assert_array_equal(usb_sub.channel_freqs,
                           [990.0, 1000.0, 1010.0, 1020.0])
        assert_equal(usb_sub.band, self.usb.band)
        # Check that updated bandwidth doesn't have rounding errors
        inexact_sub = self.inexact.subrange(0, 7)
        assert_equal(inexact_sub.bandwidth, 115.0)

    def test_rechannelise_same(self):
        lsb = self.lsb.rechannelise(6)
        assert lsb == self.lsb

    def test_rechannelise_to_even(self):
        lsb = self.lsb.rechannelise(2)
        assert_array_equal(lsb.channel_freqs, [1020.0, 990.0])
        usb = self.usb.rechannelise(2)
        assert_array_equal(usb.channel_freqs, [980.0, 1010.0])

    def test_rechannelise_to_odd(self):
        lsb = self.lsb.rechannelise(3)
        assert_array_equal(lsb.channel_freqs, [1025.0, 1005.0, 985.0])
        usb = self.usb.rechannelise(3)
        assert_array_equal(usb.channel_freqs, [975.0, 995.0, 1015.0])
        odd = self.odd.rechannelise(1)
        assert_array_equal(odd.channel_freqs, [1000.0])
Exemple #4
0
                             add_applycal_sensors, calc_correction,
                             calibrate_flux)
from katdal.flags import POSTPROC
from katdal.visdatav4 import SENSOR_PROPS

POLS = ['v', 'h']
ANTS = ['m000', 'm001', 'm002', 'm003', 'm004']
N_DUMPS = 100
SAMPLE_RATE = 1712.0

CENTRE_FREQ = 1284.0
BANDWIDTH = 856.0
N_CHANS = 128
FREQS = SpectralWindow(CENTRE_FREQ,
                       None,
                       N_CHANS,
                       sideband=1,
                       bandwidth=BANDWIDTH).channel_freqs
CAL_CENTRE_FREQ = 1200.0
CAL_BANDWIDTH = 800.0
CAL_N_CHANS = 64
CAL_FREQS = SpectralWindow(CAL_CENTRE_FREQ,
                           None,
                           CAL_N_CHANS,
                           sideband=1,
                           bandwidth=CAL_BANDWIDTH).channel_freqs
DATA_TO_CAL_CHANNEL = np.abs(FREQS[:, np.newaxis] -
                             CAL_FREQS[np.newaxis, :]).argmin(axis=-1)

INPUTS = [ant + pol for ant in ANTS for pol in POLS]
INDEX1, INDEX2 = np.triu_indices(len(INPUTS))