def actualSetUp(self,
                    freqwin=1,
                    block=False,
                    dospectral=True,
                    dopol=False,
                    zerow=False):

        self.npixel = 512
        self.low = create_named_configuration('LOWBD2', rmax=750.0)
        self.freqwin = freqwin
        self.vis = list()
        self.ntimes = 5
        self.times = numpy.linspace(-3.0, +3.0, self.ntimes) * numpy.pi / 12.0

        if freqwin > 1:
            self.frequency = numpy.linspace(0.8e8, 1.2e8, self.freqwin)
            self.channelwidth = numpy.array(
                freqwin * [self.frequency[1] - self.frequency[0]])
        else:
            self.frequency = numpy.array([1e8])
            self.channelwidth = numpy.array([1e6])

        if dopol:
            self.vis_pol = PolarisationFrame('linear')
            self.image_pol = PolarisationFrame('stokesIQUV')
            f = numpy.array([100.0, 20.0, -10.0, 1.0])
        else:
            self.vis_pol = PolarisationFrame('stokesI')
            self.image_pol = PolarisationFrame('stokesI')
            f = numpy.array([100.0])

        if dospectral:
            flux = numpy.array(
                [f * numpy.power(freq / 1e8, -0.7) for freq in self.frequency])
        else:
            flux = numpy.array([f])

        self.phasecentre = SkyCoord(ra=+180.0 * u.deg,
                                    dec=-60.0 * u.deg,
                                    frame='icrs',
                                    equinox='J2000')
        self.vis = ingest_unittest_visibility(self.low, [self.frequency],
                                              [self.channelwidth],
                                              self.times,
                                              self.vis_pol,
                                              self.phasecentre,
                                              block=block,
                                              zerow=zerow)

        self.model = create_unittest_model(self.vis,
                                           self.image_pol,
                                           npixel=self.npixel)

        self.components = create_unittest_components(self.model, flux)

        self.model = insert_skycomponent(self.model, self.components)

        self.vis = predict_skycomponent_visibility(self.vis, self.components)

        # Calculate the model convolved with a Gaussian.

        self.cmodel = smooth_image(self.model)
        export_image_to_fits(self.model,
                             '%s/test_imaging_model.fits' % self.dir)
        export_image_to_fits(self.cmodel,
                             '%s/test_imaging_cmodel.fits' % self.dir)
    def actualSetUp(self, zerow=True):
        self.doplot = False
        self.npixel = 256
        self.cellsize = 0.0009
        self.low = create_named_configuration('LOWBD2', rmax=750.0)
        self.freqwin = 1
        self.vis_list = list()
        self.ntimes = 3
        self.times = numpy.linspace(-2.0, +2.0, self.ntimes) * numpy.pi / 12.0

        if self.freqwin == 1:
            self.frequency = numpy.array([1e8])
            self.channelwidth = numpy.array([4e7])
        else:
            self.frequency = numpy.linspace(0.8e8, 1.2e8, self.freqwin)
            self.channelwidth = numpy.array(
                self.freqwin * [self.frequency[1] - self.frequency[0]])

        self.vis_pol = PolarisationFrame('linear')
        self.image_pol = PolarisationFrame('stokesIQUV')

        f = numpy.array([100.0, 20.0, -10.0, 1.0])

        flux = numpy.array(
            [f * numpy.power(freq / 1e8, -0.7) for freq in self.frequency])

        self.phasecentre = SkyCoord(ra=+180.0 * u.deg,
                                    dec=-60.0 * u.deg,
                                    frame='icrs',
                                    equinox='J2000')
        self.vis = ingest_unittest_visibility(self.low,
                                              self.frequency,
                                              self.channelwidth,
                                              self.times,
                                              self.vis_pol,
                                              self.phasecentre,
                                              block=False,
                                              zerow=zerow)

        self.model = create_unittest_model(self.vis,
                                           self.image_pol,
                                           cellsize=self.cellsize,
                                           npixel=self.npixel,
                                           nchan=self.freqwin)
        self.components = create_unittest_components(self.model,
                                                     flux,
                                                     applypb=False,
                                                     scale=0.5,
                                                     single=False,
                                                     symmetric=True)
        self.model = insert_skycomponent(self.model, self.components)
        self.vis = predict_skycomponent_visibility(self.vis, self.components)

        # Calculate the model convolved with a Gaussian.
        self.cmodel = smooth_image(self.model)
        if self.persist:
            export_image_to_fits(self.model,
                                 '%s/test_gridding_model.fits' % self.dir)
            export_image_to_fits(self.cmodel,
                                 '%s/test_gridding_cmodel.fits' % self.dir)
        pb = create_pb_generic(self.model, diameter=35.0, blockage=0.0)
        self.cmodel.data *= pb.data
        if self.persist:
            export_image_to_fits(self.cmodel,
                                 '%s/test_gridding_cmodel_pb.fits' % self.dir)
        self.peak = numpy.unravel_index(
            numpy.argmax(numpy.abs(self.cmodel.data)), self.cmodel.shape)