예제 #1
0
        else:
            raise ValueError('msname borked')

        msmd.open(msname)
        spws = msmd.spwsforfield(region)
        freqs = np.concatenate([msmd.chanfreqs(spw) for spw in spws])
        freqweights = np.concatenate([msmd.chanfreqs(spw) for spw in spws])
        msmd.close()
        print(msname)

        avfreq = np.average(freqs, weights=freqweights)
        wavelength = (avfreq * u.Hz).to(u.m, u.spectral())

        data = {}
        for spw in spws:
            ms.open(msname)
            ms.selectinit(spw)
            data[spw] = ms.getdata(items=['weight', 'uvdist', 'flag'])
            ms.close()

        beam = u.Quantity(mslist[(region, band)]['beam'], u.arcsec)

        with np.errstate(divide='ignore'):
            pctiles, majpct, minpct = make_figure(data, wavelength, beam)
        pl.suptitle(f"{region} {band}")
        savefig(
            f'/orange/adamginsburg/ALMA_IMF/2017.1.01355.L/paper_figures/uvhistograms/{region}_{band}_uvhistogram.pdf',
            bbox_inches='tight')

        uvdata.append({
            'region': region,
예제 #2
0
                   savemodel='modelcolumn',
                   datacolumn='data',
                   pbcor=True,
                   **impars_thisiter)
            test_tclean_success()
            sethistory(imname,
                       impars=impars_thisiter,
                       selfcalpars=selfcalpars,
                       selfcaliter=0)

            exportfits(imname + ".image.tt0", imname + ".image.tt0.fits")
            exportfits(imname + ".image.tt0.pbcor",
                       imname + ".image.tt0.pbcor.fits")

        # CHECK FOR MODEL FAILURES!
        ms.open(selfcal_ms)
        model_data = ms.getdata(['MODEL_PHASE'])
        ms.close()
        if 'model_phase' not in model_data or np.all(
                model_data['model_phase'] == 0):
            logprint(
                "SEVERE error encountered: model column was not populated!"
                "Therefore, populated model column from {0}".format(imname),
                origin='almaimf_cont_selfcal')
            if not dryrun:
                populate_model_column(imname, selfcal_ms, field,
                                      impars_thisiter, phasecenter, maskname,
                                      antennae)
        else:
            logprint("Model column was populated from pre-selfcal image.",
                     origin='almaimf_cont_selfcal')
예제 #3
0
                        )
                        continue
                    else:
                        logprint("No cont.dat file: Using {0} instead.".format(
                            contfile))
                else:
                    logprint(
                        "No cont.dat file: Skipping - this file will not be included in the merged continuum."
                    )
                    continue
            cont_channel_selection = parse_contdotdat(contfile)

            visfile = str(os.path.join(path, vis))

            msmd.open(visfile)
            ms.open(visfile)
            freqs = {}
            for spw in spws:
                try:
                    freqs[spw] = ms.cvelfreqs(spwid=[spw], outframe='LSRK')
                except TypeError:
                    freqs[spw] = ms.cvelfreqs(spwids=[spw], outframe='LSRK')

            msmd.close()
            ms.close()

            cont_selected = {}

            contsel = cont_channel_selection
            for spw, freq in freqs.items():
                fmin, fmax = np.min(freq), np.max(freq)