def actualSetUp(self, add_errors=False, freqwin=1, block=False, dospectral=True, dopol=False):
     
     self.npixel = 256
     self.low = create_named_configuration('LOWBD2', rmax=750.0)
     self.freqwin = freqwin
     self.vis_list = list()
     self.ntimes = 5
     self.times = numpy.linspace(-3.0, +3.0, self.ntimes) * numpy.pi / 12.0
     self.frequency = numpy.linspace(0.8e8, 1.2e8, self.freqwin)
     if freqwin > 1:
         self.channelwidth = numpy.array(freqwin * [self.frequency[1] - self.frequency[0]])
     else:
         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)
     
     self.model = create_unittest_model(self.vis, self.image_pol, npixel=self.npixel)
    def actualSetUp(self, freqwin=1, block=False, dopol=False, zerow=False):

        self.npixel = 1024
        self.low = create_named_configuration('LOWBD2', rmax=750.0)
        self.freqwin = freqwin
        self.vis_list = list()
        self.ntimes = 5
        self.cellsize = 0.0005
        # Choose the interval so that the maximum change in w is smallish
        integration_time = numpy.pi * (24 / (12 * 60))
        self.times = numpy.linspace(-integration_time * (self.ntimes // 2),
                                    integration_time * (self.ntimes // 2),
                                    self.ntimes)

        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([1.0e8])
            self.channelwidth = numpy.array([4e7])

        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])

        self.phasecentre = SkyCoord(ra=+30.0 * u.deg,
                                    dec=-60.0 * u.deg,
                                    frame='icrs',
                                    equinox='J2000')
        self.vis_list = [
            ingest_unittest_visibility(self.low, [self.frequency[freqwin]],
                                       [self.channelwidth[freqwin]],
                                       self.times,
                                       self.vis_pol,
                                       self.phasecentre,
                                       block=block,
                                       zerow=zerow)
            for freqwin, _ in enumerate(self.frequency)
        ]
    def actualSetUp(self, freqwin=1, block=True, dopol=False, zerow=False):

        self.npixel = 1024
        self.low = create_named_configuration('LOWBD2', rmax=550.0)
        self.freqwin = freqwin
        self.blockvis_list = list()
        self.ntimes = 5
        self.cellsize = 0.0005
        # Choose the interval so that the maximum change in w is smallish
        integration_time = numpy.pi * (24 / (12 * 60))
        self.times = numpy.linspace(-integration_time * (self.ntimes // 2),
                                    integration_time * (self.ntimes // 2),
                                    self.ntimes)

        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([1.0e8])
            self.channelwidth = numpy.array([4e7])

        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])

        self.phasecentre = SkyCoord(ra=+0.0 * u.deg,
                                    dec=-40.0 * u.deg,
                                    frame='icrs',
                                    equinox='J2000')
        self.blockvis_list = [
            ingest_unittest_visibility(self.low, [self.frequency[freqwin]],
                                       [self.channelwidth[freqwin]],
                                       self.times,
                                       self.vis_pol,
                                       self.phasecentre,
                                       block=block,
                                       zerow=zerow)
            for freqwin, _ in enumerate(self.frequency)
        ]
        self.vis_list = [
            convert_blockvisibility_to_visibility(bv)
            for bv in self.blockvis_list
        ]

        self.skymodel_list = [
            create_low_test_skymodel_from_gleam(
                npixel=self.npixel,
                cellsize=self.cellsize,
                frequency=[self.frequency[f]],
                phasecentre=self.phasecentre,
                polarisation_frame=PolarisationFrame("stokesI"),
                flux_limit=0.6,
                flux_threshold=1.0,
                flux_max=5.0) for f, freq in enumerate(self.frequency)
        ]

        assert isinstance(self.skymodel_list[0].image,
                          Image), self.skymodel_list[0].image
        assert isinstance(self.skymodel_list[0].components[0],
                          Skycomponent), self.skymodel_list[0].components[0]
        assert len(self.skymodel_list[0].components) == 35, len(
            self.skymodel_list[0].components)
        self.skymodel_list = expand_skymodel_by_skycomponents(
            self.skymodel_list[0])
        assert len(self.skymodel_list) == 36, len(self.skymodel_list)
        assert numpy.max(numpy.abs(
            self.skymodel_list[-1].image.data)) > 0.0, "Image is empty"
        self.vis_list = [
            copy_visibility(self.vis_list[0], zero=True)
            for i, _ in enumerate(self.skymodel_list)
        ]
    def actualSetUp(self,
                    add_errors=False,
                    freqwin=3,
                    block=True,
                    dospectral=True,
                    dopol=False,
                    zerow=False,
                    makegcfcf=False):

        self.npixel = 256
        self.low = create_named_configuration('LOWBD2', rmax=750.0)
        self.freqwin = freqwin
        self.bvis_list = list()
        self.ntimes = 5
        self.cellsize = 0.0005
        # Choose the interval so that the maximum change in w is smallish
        integration_time = numpy.pi * (24 / (12 * 60))
        self.times = numpy.linspace(-integration_time * (self.ntimes // 2),
                                    integration_time * (self.ntimes // 2),
                                    self.ntimes)

        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([1.0e8])
            self.channelwidth = numpy.array([4e7])

        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.bvis_list = [
            ingest_unittest_visibility(
                self.low,
                numpy.array([self.frequency[freqwin]]),
                numpy.array([self.channelwidth[freqwin]]),
                self.times,
                self.vis_pol,
                self.phasecentre,
                block=block,
                zerow=zerow) for freqwin, _ in enumerate(self.frequency)
        ]

        self.model_list = [
            create_unittest_model(self.bvis_list[freqwin],
                                  self.image_pol,
                                  cellsize=self.cellsize,
                                  npixel=self.npixel)
            for freqwin, _ in enumerate(self.frequency)
        ]

        self.components_list = [
            create_unittest_components(self.model_list[freqwin],
                                       flux[freqwin, :][numpy.newaxis, :],
                                       single=False)
            for freqwin, _ in enumerate(self.frequency)
        ]

        self.model_list = [
            insert_skycomponent(self.model_list[freqwin],
                                self.components_list[freqwin])
            for freqwin, _ in enumerate(self.frequency)
        ]

        self.bvis_list = [
            dft_skycomponent_visibility(self.bvis_list[freqwin],
                                        self.components_list[freqwin])
            for freqwin, _ in enumerate(self.frequency)
        ]
        centre = self.freqwin // 2
        # Calculate the model convolved with a Gaussian.
        self.model = self.model_list[centre]

        self.cmodel = smooth_image(self.model)
        if self.persist:
            export_image_to_fits(self.model,
                                 '%s/test_imaging_model.fits' % self.dir)
        if self.persist:
            export_image_to_fits(self.cmodel,
                                 '%s/test_imaging_cmodel.fits' % self.dir)

        if add_errors and block:
            self.bvis_list = [
                insert_unittest_errors(self.bvis_list[i])
                for i, _ in enumerate(self.frequency)
            ]

        self.components = self.components_list[centre]

        if makegcfcf:
            self.gcfcf = [
                create_awterm_convolutionfunction(self.model,
                                                  nw=61,
                                                  wstep=16.0,
                                                  oversampling=8,
                                                  support=64,
                                                  use_aaf=True)
            ]
            self.gcfcf_clipped = [
                (self.gcfcf[0][0],
                 apply_bounding_box_convolutionfunction(self.gcfcf[0][1],
                                                        fractional_level=1e-3))
            ]

            self.gcfcf_joint = [
                create_awterm_convolutionfunction(self.model,
                                                  nw=11,
                                                  wstep=16.0,
                                                  oversampling=8,
                                                  support=64,
                                                  use_aaf=True)
            ]

        else:
            self.gcfcf = None
            self.gcfcf_clipped = None
            self.gcfcf_joint = None
예제 #5
0
    def actualSetUp(self,
                    add_errors=False,
                    freqwin=7,
                    block=False,
                    dospectral=True,
                    dopol=False,
                    zerow=True):

        self.npixel = 256
        self.low = create_named_configuration('LOWBD2', rmax=750.0)
        self.freqwin = freqwin
        self.vis_list = list()
        self.ntimes = 5
        cellsize = 0.001
        self.times = numpy.linspace(-3.0, +3.0, self.ntimes) * numpy.pi / 12.0
        self.frequency = numpy.linspace(0.8e8, 1.2e8, self.freqwin)

        if freqwin > 1:
            self.channelwidth = numpy.array(
                freqwin * [self.frequency[1] - self.frequency[0]])
        else:
            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_list = [
            ingest_unittest_visibility(self.low, [self.frequency[freqwin]],
                                       [self.channelwidth[freqwin]],
                                       self.times,
                                       self.vis_pol,
                                       self.phasecentre,
                                       block=block,
                                       zerow=zerow)
            for freqwin, _ in enumerate(self.frequency)
        ]

        self.model_imagelist = [
            create_unittest_model(self.vis_list[freqwin],
                                  self.image_pol,
                                  cellsize=cellsize,
                                  npixel=self.npixel)
            for freqwin, _ in enumerate(self.frequency)
        ]

        self.componentlist = [
            create_unittest_components(self.model_imagelist[freqwin],
                                       flux[freqwin, :][numpy.newaxis, :])
            for freqwin, _ in enumerate(self.frequency)
        ]

        self.model_imagelist = [
            insert_skycomponent(self.model_imagelist[freqwin],
                                self.componentlist[freqwin])
            for freqwin, _ in enumerate(self.frequency)
        ]

        self.vis_list = [
            dft_skycomponent_visibility(self.vis_list[freqwin],
                                        self.componentlist[freqwin])
            for freqwin, _ in enumerate(self.frequency)
        ]

        # Calculate the model convolved with a Gaussian.

        model = self.model_imagelist[0]

        self.cmodel = smooth_image(model)
        if self.persist:
            export_image_to_fits(
                model,
                '%s/test_imaging_serial_deconvolved_model.fits' % self.dir)
        if self.persist:
            export_image_to_fits(
                self.cmodel,
                '%s/test_imaging_serial_deconvolved_cmodel.fits' % self.dir)

        if add_errors and block:
            self.vis_list = [
                insert_unittest_errors(self.vis_list[i])
                for i, _ in enumerate(self.frequency)
            ]
예제 #6
0
    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,
                               use_local=False)
        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)
예제 #7
0
    f = numpy.array([100.0])

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

phasecentre = SkyCoord(ra=+180.0 * u.deg,
                       dec=-45.0 * u.deg,
                       frame='icrs',
                       equinox='J2000')
blockvis = ingest_unittest_visibility(low,
                                      frequency,
                                      channelwidth,
                                      times,
                                      blockvis_pol,
                                      phasecentre,
                                      block=block,
                                      zerow=zerow)

vis = convert_blockvisibility_to_visibility(blockvis)

model = create_unittest_model(vis, image_pol, npixel=npixel, nchan=freqwin)

components = create_unittest_components(model, flux)
model = insert_skycomponent(model, components)

blockvis = predict_skycomponent_visibility(blockvis, components)
#blockvis = dft_skycomponent_visibility(blockvis, components)

blockvis1 = copy_visibility(blockvis)
예제 #8
0
    def actualSetUp(self,
                    nfreqwin=3,
                    dospectral=True,
                    dopol=False,
                    amp_errors=None,
                    phase_errors=None,
                    zerow=True):

        if amp_errors is None:
            amp_errors = {'T': 0.0, 'G': 0.1}
        if phase_errors is None:
            phase_errors = {'T': 1.0, 'G': 0.0}

        self.npixel = 512
        self.low = create_named_configuration('LOWBD2', rmax=750.0)
        self.freqwin = nfreqwin
        self.vis_list = list()
        self.ntimes = 1
        self.times = numpy.linspace(-3.0, +3.0, self.ntimes) * numpy.pi / 12.0
        self.frequency = numpy.linspace(0.8e8, 1.2e8, self.freqwin)

        if self.freqwin > 1:
            self.channelwidth = numpy.array(
                self.freqwin * [self.frequency[1] - self.frequency[0]])
        else:
            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.blockvis_list = [
            ingest_unittest_visibility(self.low, [self.frequency[i]],
                                       [self.channelwidth[i]],
                                       self.times,
                                       self.vis_pol,
                                       self.phasecentre,
                                       block=True,
                                       zerow=zerow) for i in range(nfreqwin)
        ]

        for v in self.blockvis_list:
            v.data['vis'][...] = 1.0 + 0.0j

        self.error_blockvis_list = [
            copy_visibility(v) for v in self.blockvis_list
        ]
        gt = create_gaintable_from_blockvisibility(self.blockvis_list[0])
        gt = simulate_gaintable(gt,
                                phase_error=0.1,
                                amplitude_error=0.0,
                                smooth_channels=1,
                                leakage=0.0)
        self.error_blockvis_list = [
            apply_gaintable(self.error_blockvis_list[i], gt)
            for i in range(self.freqwin)
        ]

        assert numpy.max(
            numpy.abs(self.error_blockvis_list[0].vis -
                      self.blockvis_list[0].vis)) > 0.0
예제 #9
0
    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)
        if self.persist:
            export_image_to_fits(self.model,
                                 '%s/test_imaging_model.fits' % self.dir)
        if self.persist:
            export_image_to_fits(self.cmodel,
                                 '%s/test_imaging_cmodel.fits' % self.dir)
 def actualSetUp(self, add_errors=False, nfreqwin=7, dospectral=True, dopol=False, zerow=True):
     
     self.npixel = 512
     self.low = create_named_configuration('LOWBD2', rmax=750.0)
     self.freqwin = nfreqwin
     self.vis_list = list()
     self.ntimes = 5
     self.times = numpy.linspace(-3.0, +3.0, self.ntimes) * numpy.pi / 12.0
     self.frequency = numpy.linspace(0.8e8, 1.2e8, self.freqwin)
     
     if self.freqwin > 1:
         self.channelwidth = numpy.array(self.freqwin * [self.frequency[1] - self.frequency[0]])
     else:
         self.channelwidth = numpy.array([1e6])
     
     if dopol:
         self.vis_pol = PolarisationFrame('linear')
         self.image_pol = PolarisationFrame('stokesIQUV')
         f = numpy.array([100.0, 20.0, 0.0, 0.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.blockvis_list = [ingest_unittest_visibility(self.low,
                                                      [self.frequency[i]],
                                                      [self.channelwidth[i]],
                                                      self.times,
                                                      self.vis_pol,
                                                      self.phasecentre, block=True,
                                                      zerow=zerow)
                           for i in range(nfreqwin)]
     
     self.vis_list = [convert_blockvisibility_to_visibility(bv) for bv in self.blockvis_list]
     
     self.model_imagelist = [
         create_unittest_model(self.vis_list[i], self.image_pol, npixel=self.npixel, cellsize=0.0005)
         for i in range(nfreqwin)]
     
     self.components_list = [create_unittest_components(self.model_imagelist[freqwin],
                                                        flux[freqwin, :][numpy.newaxis, :])
                             for freqwin, m in enumerate(self.model_imagelist)]
     
     self.blockvis_list = [
         dft_skycomponent_visibility(self.blockvis_list[freqwin], self.components_list[freqwin])
         for freqwin, _ in enumerate(self.blockvis_list)]
     
     self.model_imagelist = [insert_skycomponent(self.model_imagelist[freqwin], self.components_list[freqwin])
                             for freqwin in range(nfreqwin)]
     model = self.model_imagelist[0]
     self.cmodel = smooth_image(model)
     if self.persist:
         export_image_to_fits(model, '%s/test_imaging_serial_model.fits' % self.dir)
         export_image_to_fits(self.cmodel, '%s/test_imaging_serial_cmodel.fits' % self.dir)
     
     if add_errors:
         gt = create_gaintable_from_blockvisibility(self.blockvis_list[0])
         gt = simulate_gaintable(gt, phase_error=0.1, amplitude_error=0.0, smooth_channels=1, leakage=0.0)
         self.blockvis_list = [apply_gaintable(self.blockvis_list[i], gt)
                               for i in range(self.freqwin)]
     
     self.vis_list = [convert_blockvisibility_to_visibility(bv) for bv in self.blockvis_list]
     
     self.model_imagelist = [
         create_unittest_model(self.vis_list[i], self.image_pol, npixel=self.npixel, cellsize=0.0005)
         for i in range(nfreqwin)]