Example #1
0
for image in image_names:
    beammajor.append(imhead(imagename=image, mode='get', hdkey='beammajor'))
    beamminor.append(imhead(imagename=image, mode='get', hdkey='beamminor'))
    beampa.append(imhead(imagename=image, mode='get', hdkey='beampa'))

# determining what size the spectral line images should be smoothed to.
targetbeammajor = max(beammajor)
targetidx = beammajor.index(targetbeammajor)
targetbeamminor = beamminor[targetidx]
targetbeampa = beampa[targetidx]

# Apply PB correction
for image in image_names:
    outputimage = image + ".pbcor"
    impbcor(imagename=image, pbimage=image.replace(".image", ".flux"),
            outfile=outputimage)

image_names = [name + ".pbcor" for name in image_names]

# smoothing the images
for image in image_names:
    outputimage = image + '.smooth'
    if image != image_names[targetidx]:
        imsmooth(imagename=image, outfile=outputimage, kernel='gauss',
                 major=str(targetbeammajor['value']) + targetbeammajor['unit'],
                 minor=str(targetbeamminor['value']) + targetbeamminor['unit'],
                 pa=str(targetbeampa['value']) + targetbeampa['unit'],
                 targetres=True)
    else:
        # need to skip the one with the largest resolution or imsmooth fails.
        os.system('cp -ir ' + image + ' ' + outputimage)
Example #2
0
                for suffix in ('image', 'residual', 'model'):
                    ia.open(lineimagename + "." + suffix)
                    ia.sethistory(origin='almaimf_line_imaging',
                                  history=[
                                      "{0}: {1}".format(key, val)
                                      for key, val in impars.items()
                                  ])
                    ia.sethistory(origin='almaimf_line_imaging',
                                  history=[
                                      "git_version: {0}".format(git_version),
                                      "git_date: {0}".format(git_date)
                                  ])
                    ia.close()

                impbcor(imagename=lineimagename + '.image',
                        pbimage=lineimagename + '.pb',
                        outfile=lineimagename + '.image.pbcor',
                        overwrite=True)

            # TODO: Save the desired files, maybe as FITS or maybe not?

            # the cont_channel_selection is purely in frequency, so it should
            # "just work"
            # (there may be several cont.dats - we're just grabbing the first)
            # Different data sets are actually found to have different channel selections.
            path = os.path.split(vis[0])[0]

            contfile = os.path.join(path, '../calibration/cont.dat')

            cont_freq_selection = parse_contdotdat(contfile)
            logprint("Selected {0} as continuum channels".format(
                cont_freq_selection),
Example #3
0
               robust=0.5,
               niter=int(1e7),
               cycleniter=100,  # Force many major cycles
               nsigma=1.,
               # usemask='auto-multithresh',
               usemask='user',  # Use auto-mask from last step.
               sidelobethreshold=1.0,
               noisethreshold=3.0,
               lownoisethreshold=1.5,
               negativethreshold=0.0,
               minbeamfrac=0.1,
               growiterations=75,
               dogrowprune=True,
               minpercentchange=1.0,
               fastnoise=False,
               threshold='',
               interactive=0,
               savemodel='none',
               parallel=False,
               calcres=False,
               calcpsf=False,
               smallscalebias=0.6
               )

    np.save(stage2_summary_name, stage2_tclean_dict)

impbcor(imagename="{}.image".format(cleanimage_name),
        pbimage="{}.pb".format(cleanimage_name),
        outfile="{}.image.pbcor".format(cleanimage_name),
        overwrite=True)