compr_error[p + 2, t] = compr_result[1] compr_error_bar = float(delay_compression)/nfreq * np.array([compr_result[3][i,i] for i in range(delay_compression)])**.5 compr_flags[p + 2, t, compr_error_bar > min(compr_error_bar) * 1.05] = True print "Done. %fmin"%(float(time.time()-timer)/60.) sys.stdout.flush() #######save uvs print FILENAME + " MSG: saving compressed uv files", sys.stdout.flush() if len(wantpols.keys()) == 1: compr_uvfile = oppath + '/' + dataano + "_%s.uvOE"%pol else: compr_uvfile = oppath + '/' + dataano + ".uvOE" uv=ap.miriad.UV(uvfiles[0]) omni.exportuv(compr_uvfile, compressed_data, compr_flags, list(wantpols.values()) + list(crosspols.values()), jd, uv['inttime'], uv['sfreq'], uv['sdf'], sa.lat, sa.lon, overwrite=False, comment=ano) del(uv) print "Done." sys.stdout.flush() if create_new_uvs: print FILENAME + " MSG: saving new uv files", sys.stdout.flush() infos = {} for pol in wantpols.keys(): infos[pol[0]] = omni.read_redundantinfo(infopaths[pol]) for uvfile in uvfiles: omni.apply_omnigain_uvs([uvfile], omnigains, calibrators[wantpols.keys()[0]].totalVisibilityId, infos, oppath, ano, adds= adds, verbose = True, comment = '_'.join(sys.argv), flags = flags, overwrite = overwrite_uvs) print "Done." sys.stdout.flush()
print "Done. %fmin" % (float(time.time() - timer) / 60.) sys.stdout.flush() #######save uvs print FILENAME + " MSG: saving compressed uv files", sys.stdout.flush() if len(wantpols.keys()) == 1: compr_uvfile = oppath + '/' + dataano + "_%s.uvOEE" % pol else: compr_uvfile = oppath + '/' + dataano + ".uvOEE" uv = ap.miriad.UV(uvfiles[0]) jd = np.array(jd) deljd = np.mean(jd[1:] - jd[:-1]) new_jd = np.arange(compr_shape[1])**2 * deljd / data.shape[1] omni.exportuv(compr_uvfile, compressed_data[:, delay_compression:-delay_compression], compr_flags[:, delay_compression:-delay_compression], wantpols.values(), new_jd[delay_compression:-delay_compression], uv['inttime'], uv['sfreq'], uv['sdf'], sa.lat, sa.lon, overwrite=False, comment=ano) del (uv) print "Done." sys.stdout.flush()
print '.', sys.stdout.flush() flag = rawflag[p, :, f].all(axis = -1) badbl = np.sum(rawflag[p, :, f], axis = 0) > np.sum(flag) compr_result = omni.deconvolve_spectra2(data[p, :, f], ~flag, (compr_shape[1]+1)/2, correction_weight=1e-6) compressed_data[p, :, f] = float(compr_shape[1])/nfreq * compr_result[0] compr_error[p,f] = compr_result[1] compr_error_bar = float(compr_shape[1])/nfreq * np.array([compr_result[3][i,i] for i in range(compr_shape[1])])**.5 compr_flags[p, compr_error_bar > min(compr_error_bar) * 1.05, f] = True compr_flags[p, :, f, badbl] = True print "Done. %fmin"%(float(time.time()-timer)/60.) sys.stdout.flush() #######save uvs print FILENAME + " MSG: saving compressed uv files", sys.stdout.flush() if len(wantpols.keys()) == 1: compr_uvfile = oppath + '/' + dataano + "_%s.uvOEE"%pol else: compr_uvfile = oppath + '/' + dataano + ".uvOEE" uv=ap.miriad.UV(uvfiles[0]) jd=np.array(jd) deljd = np.mean(jd[1:] - jd[:-1]) new_jd = np.arange(compr_shape[1])**2 * deljd / data.shape[1] omni.exportuv(compr_uvfile, compressed_data[:,delay_compression:-delay_compression], compr_flags[:,delay_compression:-delay_compression], wantpols.values(), new_jd[delay_compression:-delay_compression], uv['inttime'], uv['sfreq'], uv['sdf'], sa.lat, sa.lon, overwrite=False, comment=ano) del(uv) print "Done." sys.stdout.flush()
sys.stdout.flush() #######save uvs print FILENAME + " MSG: saving compressed uv files", sys.stdout.flush() if len(wantpols.keys()) == 1: compr_uvfile = oppath + '/' + dataano + "_%s.uvOE" % pol else: compr_uvfile = oppath + '/' + dataano + ".uvOE" uv = ap.miriad.UV(uvfiles[0]) omni.exportuv(compr_uvfile, compressed_data, compr_flags, wantpols.values(), jd, uv['inttime'], uv['sfreq'], uv['sdf'], sa.lat, sa.lon, overwrite=False, comment=ano) del (uv) print "Done." sys.stdout.flush() if create_new_uvs: print FILENAME + " MSG: saving new uv files", sys.stdout.flush() infos = {} for pol in wantpols.keys(): infos[pol[0]] = omni.read_redundantinfo(infopaths[pol])