start_chan = int(center_chan - width // 2)

        imagename = "test_images/{0}.{1}.spw_{2}".format(ms_active[:-3], source, spw_num)

        # Remove old image products
        rmtables(imagename + "*")

        clean(
            vis=ms_active,
            imagename=imagename,
            field="*" + source + "*",
            spw=str(spw_num),
            mode="channel",
            niter=0,
            imagermode=imagermode,
            cell=cellsize,
            imsize=imagesize,
            start=start_chan,
            width=width,
            nchan=1,
            weighting=weighting,
            pbcor=False,
            minpb=0.1,
            phasecenter=phasecenter,
        )

        remove_products(imagename)


logprint("Finished EVLA_pipe_testimage_lines.py", logfileout="logs/testimage_lines.log")

pipeline_save()
Example #2
0
    # Check that the concatenated MS exists
    if not os.path.exists(concat_ms):
        raise IOError("Concatenated MS does not exist in the given directory.")

    if not os.path.exists(dirty_image_direc):
        os.mkdir(dirty_image_direc)

    out_image = os.path.join(dirty_image_direc,
                             line_name + "_" + project_name + "_dirty_nocontsub")

    rmtables(out_image + ".*")

    clean(vis=concat_ms, imagename=out_image, niter=0, imsize=imsize,
          cell=cell, mode=mode, nchan=nchan, width=width, start=start,
          threshold=threshold, field=field, phasecenter=phasecenter, spw=spw,
          imagermode=imagermode, multiscale=multiscale, outframe=outframe,
          veltype=veltype, minpb=0.3, weighting=weighting, robust=robust,
          restfreq=restfreq, usescratch=usescratch,
          interpolation=interpolation, pbcor=True)

if contsub:
    # Check that the concatenated MS exists
    if not os.path.exists(concat_ms):
        raise IOError("Concatenated MS does not exist in the given directory.")

    if os.path.exists(contsub_ms) and delete_old:
        rmtables(contsub_ms)

    uvcontsub(vis=concat_ms, fitspw=fitspw, excludechans=excludechans,
              fitorder=0, want_cont=False)
    stats_dict = ia.statistics()
    ia.close()
    # If there's nothing there, max == min
    max_val = stats_dict["max"]
    if max_val == 0:
        casalog.post("No valid region in the given mask. Skipping clean.")
        valid_mask = False
    else:
        casalog.post("Mask contains valid region. Proceeding with clean.")

if valid_mask:
    clean(vis=vis, imagename=out_root + '.clean', field='M33*',
          restfreq='1420.40575177MHz',
          mode='channel', width=1, nchan=1, start=1,
          cell='1.5arcsec', multiscale=[0, 4, 8, 20, 40, 80],
          threshold='2.2mJy/beam', imagermode='mosaic', gain=0.1,
          imsize=[4096, 4096], weighting='natural', robust=0.0, niter=200000,
          pbcor=True, minpb=0.2, interpolation='linear', usescratch=False,
          phasecenter='J2000 01h33m50.904 +30d39m35.79', veltype='radio',
          modelimage=model, mask=mask)

    # Only run if the image was actually produces
    if os.path.exists(out_root + ".clean.image") and model is not None:
        feather(imagename=out_root + ".clean.image.feathered",
                highres=out_root + ".clean.image",
                lowres=model)

    # If something went awry, and the image wasn't produced, remove the
    # remnants.
    if not os.path.exists(out_root + ".clean.image"):
        rmtables(out_root + ".clean.*")
        cellsize = set_cellsize(ms_active, spw_num, sample_factor=6.)
        imagesize = set_imagesize(ms_active, spw_num, source, sample_factor=6.,
                                  pblevel=minpb, max_size=max_size)

        if imagermode == "mosaic":
            # XXX Set this to centre of M33 for now.
            phasecenter = 'J2000 01h33m50.904 +30d39m35.79'
        else:
            phasecenter = ''

        imagename = \
            'test_images/{0}.{1}.spw_{2}'.format(ms_active[:-3],
                                                 source,
                                                 spw_num)
        # Remove old image products
        rmtables(imagename + "*")

        clean(vis=ms_active,
              imagename=imagename,
              field= '*' + source + '*', spw=str(spw_num), mode='mfs', niter=0,
              imagermode=imagermode, cell=cellsize, imsize=imagesize,
              weighting=weighting, pbcor=False, minpb=0.1,
              phasecenter=phasecenter)

        remove_products(imagename)

logprint("Finished EVLA_pipe_testimage_cont.py",
         logfileout='logs/testimage_cont.log')

pipeline_save()
Example #5
0
    def testCleanup(self):
        RandomNumberProfile.objects.create(range_start=10, range_end=25, create_date=timezone.now()-datetime.timedelta(days=2))
        clean()

        self.assertEquals(RandomNumberProfile.objects.all().count(), 0)