if plotcals: sols = applycals.solutions(g1name, fluxfile=fluxfile) sols.parsebp(b1name) p.figure(1) for spw in range(len(sols.gain[0,0])): for pol in range(len(sols.gain[0,0,0])): p.plot(n.abs(sols.gain[:,:,spw,pol]),'b.') p.xlabel('Solution number') p.ylabel('Gain amp') p.savefig(g1name[:-3] + '_gain.png') p.figure(2) p.plot(n.abs(sols.bandpass[:,::10,0].transpose()),'b.') p.plot(n.angle(sols.bandpass[:,::10,1].transpose()),'r.') p.xlabel('Channel') p.ylabel('Bandpass amp (1-mean) and angle (rad)') p.savefig(g1name[:-3] + '_bp.png') if imagetest: # then image middle integrations for both CASA gain cal and telcal solutions for scan in range(len(gainstr.split(','))): try: d = leanpipet.pipe_thread(filename=gainms2, nints=15, nskip=gainints[scan]/fps/2, iterint=15, spw=[0,1], chans=chans, dmarr=[0], fwhmsurvey=0.5, fwhmfield=0.5, selectpol=['RR','LL'], scan=scan, datacol='data', size=0, res=0, sigma_image=threshold, searchtype='imageall', filtershape=None, savecands=False, candsfile='', flagmode=flagmode, gainfile=g1name, bpfile=b1name, fluxfile=fluxfile) d = leanpipet.pipe_thread(filename=gainms2, nints=15, nskip=gainints[scan]/fps/2, iterint=15, spw=[0,1], chans=chans, dmarr=[0], fwhmsurvey=0.5, fwhmfield=0.5, selectpol=['RR','LL'], scan=scan, datacol='data', size=0, res=0, sigma_image=threshold, searchtype='imageall', filtershape=None, savecands=False, candsfile='', flagmode=flagmode, telcalfile=telcalfile) except IndexError: print 'Ran out of ints in that scan?' continue if fluxmodel: d = leanpipet.pipe_thread(filename=bpms2, nints=15, nskip=30, iterint=15, spw=[0,1], chans=chans, dmarr=[0], fwhmsurvey=0.5, fwhmfield=0.5, selectpol=['RR','LL'], scan=0, datacol='data', size=0, res=0, sigma_image=threshold, searchtype='imageall', filtershape=None, savecands=False, candsfile='', flagmode=flagmode, gainfile=g1name, bpfile=b1name, fluxfile=fluxfile) print 'Flux scale calibrator flux = %.3f' % (leanpipet.data.real.mean())
else: ddm = dmarrall[canddm + 1] - dmarrall[canddm] dmarr = range(0, 2 * ddm, 2 * ddm / ndm) print "Searching %s for dmrange %s with %d ints by %d ints." % (msfile, dmarr, nints, iterint) d = leanpipet.pipe_thread( filename=msfile, nints=nints, nskip=0, iterint=iterint, spw=[0, 1], chans=chans, dmarr=dmarr, fwhmsurvey=0.5, fwhmfield=0.5, selectpol=["RR", "LL"], scan=0, datacol="data", size=npix * res, res=res, sigma_image=threshold, searchtype="imageall", gainfile=gainfile, bpfile=bpfile, filtershape=filtershape, savecands=False, flagmode=flagmode, nthreads=min(14, ndm), ) # d = leanpipet.pipe_thread(filename=msfile, nints=nints, nskip=0, iterint=iterint, spw=[0,1], chans=chans, dmarr=dmarr, fwhmsurvey=0.5, fwhmfield=0.5, selectpol=['RR','LL'], scan=0, datacol='corrected_data', size=npix*res, res=res, sigma_image=threshold, searchtype='imageall', telcalfile=telcalfile, filtershape=filtershape, savecands=False, flagmode=flagmode, nthreads=min(14,ndm))