Ejemplo n.º 1
0
    def test_create_gaintable_from_pointingtable_dynamic(self):
        comp = create_skycomponent(
            direction=self.phasecentre,
            flux=[[1.0]],
            frequency=self.frequency,
            polarisation_frame=PolarisationFrame('stokesI'))

        pt = create_pointingtable_from_blockvisibility(self.vis)
        pt = simulate_pointingtable(pt,
                                    pointing_error=0.01,
                                    static_pointing_error=None,
                                    global_pointing_error=[0.0, 0.0])
        vp = create_vp(self.model, 'MID')
        gt = simulate_gaintable_from_pointingtable(self.vis, [comp], pt, vp)
        if self.doplot:
            import matplotlib.pyplot as plt
            plt.clf()
            plt.plot(gt[0].time, numpy.real(1.0 / gt[0].gain[:, 0, 0, 0, 0]),
                     '.')
            plt.plot(gt[0].time, numpy.imag(1.0 / gt[0].gain[:, 0, 0, 0, 0]),
                     '.')
            plt.title('test_create_gaintable_from_pointingtable_dynamic')
            plt.show()
        assert gt[0].gain.shape == (self.ntimes, self.nants, 1, 1,
                                    1), gt[0].gain.shape
    def test_simulate_gaintable_from_time_series(self):
        numpy.random.seed(18051955)
        offset_phasecentre = SkyCoord(ra=+15.0 * u.deg,
                                      dec=-44.58 * u.deg,
                                      frame='icrs',
                                      equinox='J2000')
        component = [
            Skycomponent(frequency=self.frequency,
                         direction=offset_phasecentre,
                         polarisation_frame=PolarisationFrame("stokesI"),
                         flux=[[1.0]])
        ]

        for type in ['wind']:

            pt = create_pointingtable_from_blockvisibility(self.vis)

            import matplotlib.pyplot as plt
            ant = 15
            plt.clf()
            plt.plot(pt.time, pt.nominal[:, ant, 0, 0, 0], '.')
            plt.plot(pt.time, pt.nominal[:, ant, 0, 0, 1], '.')
            plt.xlabel('Time (s)')
            plt.ylabel('Nominal (rad)')
            plt.title("Nominal pointing for %s" % (type))
            plt.show()

            for reference_pointing in [False, True]:
                pt = simulate_pointingtable_from_timeseries(
                    pt, type=type, reference_pointing=reference_pointing)

                import matplotlib.pyplot as plt
                ant = 15
                plt.clf()
                r2a = 180.0 * 3600.0 / numpy.pi
                plt.plot(pt.time, r2a * pt.pointing[:, ant, 0, 0, 0], '.')
                plt.plot(pt.time, r2a * pt.pointing[:, ant, 0, 0, 1], '.')
                plt.xlabel('Time (s)')
                plt.ylabel('Pointing (arcsec)')
                plt.title("Pointing for %s, reference pointing %s" %
                          (type, reference_pointing))
                plt.show()

                vp = create_vp(self.model, 'MID')
                gt = simulate_gaintable_from_pointingtable(
                    self.vis, component, pt, vp)
                assert gt[0].gain.shape == (self.ntimes, self.nants, 1, 1,
                                            1), gt[0].gain.shape

                plt.clf()
                plt.plot(gt[0].time,
                         1.0 / numpy.real(gt[0].gain[:, ant, 0, 0, 0]), '.')
                plt.xlabel('Time (s)')
                plt.ylabel('Gain')
                plt.title("Gain for %s, reference pointing %s" %
                          (type, reference_pointing))
                plt.show()
Ejemplo n.º 3
0
    def test_create_gaintable_from_pointingtable(self):
        s3_components = create_test_skycomponents_from_s3(
            flux_limit=5.0,
            phasecentre=self.phasecentre,
            frequency=self.frequency,
            polarisation_frame=PolarisationFrame('stokesI'),
            radius=0.2)

        pt = create_pointingtable_from_blockvisibility(self.vis)
        pt = simulate_pointingtable(pt,
                                    pointing_error=0.01,
                                    static_pointing_error=[0.001, 0.0001])
        vp = create_vp(self.model, 'MID')
        gt = simulate_gaintable_from_pointingtable(self.vis, s3_components, pt,
                                                   vp)
        assert gt[0].gain.shape == (self.ntimes, self.nants, 1, 1,
                                    1), gt[0].gain.shape
    def test_create_gaintable_from_pointingtable_circlecut(self):
        self.sidelobe = SkyCoord(ra=+15.0 * u.deg,
                                 dec=-49.4 * u.deg,
                                 frame='icrs',
                                 equinox='J2000')
        comp = create_skycomponent(
            direction=self.sidelobe,
            flux=[[1.0]],
            frequency=self.frequency,
            polarisation_frame=PolarisationFrame('stokesI'))

        telescopes = ['MID', 'MID_GAUSS', 'MID_GRASP']
        for telescope in telescopes:
            pt = create_pointingtable_from_blockvisibility(self.vis)
            pt = simulate_pointingtable(pt,
                                        pointing_error=0.0,
                                        global_pointing_error=[0.0, 0.0])
            vp = create_vp(self.model, telescope)
            gt = simulate_gaintable_from_pointingtable(self.vis, [comp], pt,
                                                       vp)
            if self.doplot:
                import matplotlib.pyplot as plt
                plt.clf()
                plt.plot(gt[0].time,
                         numpy.real(1.0 / gt[0].gain[:, 0, 0, 0, 0]),
                         '.',
                         label='Real')
                plt.plot(gt[0].time,
                         numpy.imag(1.0 / gt[0].gain[:, 0, 0, 0, 0]),
                         '.',
                         label='Imaginary')
                plt.legend()
                plt.xlabel('Time (s)')
                plt.ylabel('Gain')
                plt.title('test_create_gaintable_from_pointingtable_%s' %
                          telescope)
                plt.show()
            assert gt[0].gain.shape == (self.ntimes, self.nants, 1, 1,
                                        1), gt[0].gain.shape