only_7m=only_7m, spw='all', pixfraction_of_fwhm=1 / 4.)) imsize = [dra, ddec] cellsize = ['{0:0.2f}arcsec'.format(pixscale)] * 2 contimagename = os.path.join(imaging_root, basename) + "_" + arrayname if not os.path.exists(contimagename + ".uvwave_vs_amp.png"): # make a diagnostic plot to show the UV distribution plotms( vis=selfcal_ms, xaxis='uvwave', yaxis='amp', avgchannel='1000', # minimum possible # of channels plotfile=contimagename + ".uvwave_vs_amp.png", coloraxis='observation', showlegend=True, showgui=False, antenna=antennae, ) # only do robust = 0 robust = 0 pars_key = "{0}_{1}_{2}_robust{3}".format(field, band, arrayname, robust) impars = imaging_parameters[pars_key] dirty_impars = copy.copy(impars) dirty_impars['niter'] = 0 # NOTE: if anything besides `maskname` and `niter` ends up with a # dictionary, we'll need to parse it here
for ms in ms_names: print("Plotting " + ms.split("/")[-1]) default('plotms') vis = ms xaxis = 'time' yaxis = 'amp' ydatacolumn = 'corrected' selectdata = True field = '' scan = str(bad_scan_dict[ms.split("/")[-1]]).rstrip(",") spw = '' correlation = "RR,LL" iteraxis = "scan" averagedata = True avgbaseline = True transform = False extendflag = False plotrange = [] xlabel = '' ylabel = '' showmajorgrid = False showminorgrid = False overwrite = False showgui = True async = False plotms() raw_input("Continue?")
field=field, phasecenter=(racen, deccen), spw=0, exclude_7m=exclude_7m)) #, pixfraction_of_fwhm=1/4.)) imsize = [dra, ddec] cellsize = ['{0:0.2f}arcsec'.format(pixscale)] * 2 contimagename = os.path.join(imaging_root, basename) + "_" + suffix if not os.path.exists(contimagename + ".uvwave_vs_amp.png"): # make a diagnostic plot to show the UV distribution plotms( vis=continuum_ms, xaxis='uvwave', yaxis='amp', avgchannel='1000', # minimum possible # of channels plotfile=contimagename + ".uvwave_vs_amp.png", showlegend=True, showgui=False, antenna=antennae, ) # ---------------------------------------------- # CLEAN FOR THE 'CLEANEST' CONTINUUM: for robust in (-2, 0, 2): imname = contimagename + "_robust{0}".format(robust) + "_cleanest" logprint("Im={0}".format(imname), origin='almaimf_contimg_both') if not os.path.exists(imname + ".image.tt0"): tclean( vis=continuum_ms, field=field.encode(),
def everythings_diagnostic_plots(msname='', plot_spw=8): # Find restfreq msmd.open(msname) freqs = msmd.chanfreqs(plot_spw) restfreq = str(np.mean(freqs) / 1000000) + 'MHz' del freqs msmd.close() plot_spw = str(plot_spw) # spath = 'EveryTHINGS_Diagnostic_Plots/' if not os.path.isdir(spath): os.mkdir(spath) # # amp-time plotms(vis=msname, xaxis='time', yaxis='amp', avgchannel='4096', coloraxis='ant1', avgantenna=True, overwrite=True, ydatacolumn='corrected', plotfile=spath + 'amp-time_target.png', avgtime='10', showgui=False, intent='*TARGET*', spw=plot_spw) # plotms(vis='finalcalibrators.ms', xaxis='time', yaxis='amp', avgchannel='4096', coloraxis='ant1', avgantenna=True, overwrite=True, ydatacolumn='corrected', plotfile=spath + 'amp-time_calibrators.png', avgtime='10', showgui=False, spw=plot_spw) # # amp-vel plotms(vis=msname, xaxis='vel', yaxis='amp', avgchannel='', coloraxis='ant1', avgtime='100000', avgscan=True, restfreq=restfreq, veldef='RADIO', avgantenna=True, overwrite=True, ydatacolumn='corrected', plotfile=spath + 'amp-vel_target.png', intent='*TARGET*', showgui=False, exprange='all', spw=plot_spw) plotms(vis='finalcalibrators.ms', xaxis='vel', yaxis='amp', avgchannel='', coloraxis='ant1', avgtime='100000', avgscan=True, restfreq=restfreq, veldef='RADIO', avgantenna=True, overwrite=True, ydatacolumn='corrected', plotfile=spath + 'amp-vel_calibrators.png', showgui=False, iteraxis='field', exprange='all', spw=plot_spw) # # phase-vel plotms(vis='finalcalibrators.ms', xaxis='vel', yaxis='phase', coloraxis='ant1', avgtime='100000', avgscan=True, restfreq=restfreq, veldef='RADIO', avgantenna=True, overwrite=True, ydatacolumn='corrected', plotfile=spath + 'phase-vel.png', showgui=False, iteraxis='field', exprange='all', plotrange=[0, 0, -180, 180], spw=plot_spw) # # uvdist-amp plotms(vis=msname, xaxis='uvdist', yaxis='amp', avgchannel='4096', coloraxis='ant1', avgtime='5000', avgscan=False, avgantenna=False, overwrite=True, ydatacolumn='corrected', plotfile=spath + 'amp-uv_target.png', showgui=False, iteraxis='field', exprange='all', intent='*TARGET*', spw=plot_spw) # plotms(vis='finalcalibrators.ms', xaxis='uvdist', yaxis='amp', avgchannel='4096', coloraxis='field', avgtime='5000', avgscan=False, avgantenna=False, overwrite=True, ydatacolumn='corrected', plotfile=spath + 'amp-uv_calibrators.png', showgui=False, spw=plot_spw) # # uvdist-phase plotms(vis='finalcalibrators.ms', xaxis='uvdist', yaxis='phase', avgchannel='4096', coloraxis='ant1', avgtime='5000', avgscan=False, avgantenna=False, overwrite=True, ydatacolumn='corrected', plotfile=spath + 'phase-uv.png', showgui=False, iteraxis='field', exprange='all', plotrange=[0, 0, -180, 180], spw=plot_spw) # # BPcal tblname = msname + '.hifv_finalcals.s13_4.finalBPcal.tbl' plotcal(caltable=tblname, xaxis='freq', yaxis='amp', iteration='antenna', subplot=651, overplot=False, clearpanel='Auto', showflags=False, showgui=False, figfile=spath + 'finalBPcal.png', spw=plot_spw) # # UV coverage plotms(vis=msname, intent='*TARGET*', xaxis='Uwave', yaxis='Vwave', avgchannel='4096', coloraxis='ant1', customflaggedsymbol=True, showgui=False, plotfile=spath + 'uvcoverage.png', spw=plot_spw) # # flagdata summary flagsummary = flagdata(msname, mode='summary', spw=plot_spw) antsummary = flagsummary['antenna'] flaglist = [] for ant in antsummary.keys(): flaglist.append([ ant, round(antsummary[ant]['flagged'] / antsummary[ant]['total'], 3) ]) flaglist = np.sort(flaglist, axis=0) np.savetxt(spath + 'flagsummary_all.txt', flaglist, fmt='%s') # flagsummary = flagdata(msname, mode='summary', intent='*CALI*', spw=plot_spw) antsummary = flagsummary['antenna'] flaglist = [] for ant in antsummary.keys(): flaglist.append([ ant, round(antsummary[ant]['flagged'] / antsummary[ant]['total'], 3) ]) flaglist = np.sort(flaglist, axis=0) np.savetxt(spath + 'flagsummary_cali.txt', flaglist, fmt='%s') # flagcmd(msname, inpmode='list', inpfile=msname[:-3] + '.flagcmds.txt', action='plot', plotfile=spath + 'onlineFlags.png')
averagedata = True avgbaseline = True transform = False extendflag = False plotrange = [] title = 'Amp vs Time: Field {0} Scan {1}'.format(names[ii], jj) xlabel = '' ylabel = '' showmajorgrid = False showminorgrid = False plotfile = os.path.join( spw_folder, 'field_{0}_amp_scan_{1}.png'.format(names[ii], jj)) overwrite = True showgui = False async = False plotms() # Amp vs. channel default('plotms') vis = ms_active xaxis = 'chan' yaxis = 'amp' ydatacolumn = 'corrected' selectdata = True field = names[ii] scan = str(jj) spw = str(spw_num) avgchannel = str(avg_chan) avgtime = "1e8" correlation = "RR,LL" averagedata = True