def paintmasklist(list,plotout,io,logger): cp,m = graphmask.plot_mangle_map(list,autoscale=True,enlarge_border=0.01,bgcolor='white',cmap=cm.jet) plt.savefig(plotout) plt.close()
def preptimetile(filter_list,bole,tilename,mask_path,io,logger): maskplots = [] masktime = [] www = [] for i,filter in enumerate(filter_list): if bole[i]: print bole[i] maskmask = str(mask_path)+str(tilename)+'_holymolys_time_'+str(filter)+'.pol' maskout = 'trimmask_time_'+str(filter)+'.pol' command='cp '+str(maskmask)+' '+str(maskout) mvcount=io.run_command(command,logger) logger.info("Executed %s. Return code = %s" % (command,mvcount)) masktime.append(maskout) listtemp = str(mask_path)+str(tilename)+'_holymolys_time_'+str(filter)+'.list' listout = 'trimmask_time_'+str(filter)+'.list' if os.path.isfile(listtemp): command = 'cp '+listtemp+' '+listout mvcount=io.run_command(command,logger) logger.info("Executed %s. Return code = %s" % (command,mvcount)) command = 'cp '+listtemp+'.weight '+listout+'.weight' else: command='poly2poly -ol30 '+str(maskout)+' '+str(listout) mvcount=io.run_command(command,logger) logger.info("Executed %s. Return code = %s" % (command,mvcount)) cp,m = graphmask.plot_mangle_map(listout,autoscale=True,enlarge_border=0.01,bgcolor='white',cmap=cm.jet) plotname= 'trimmask_time_'+str(filter)+'.png' plt.savefig(plotname) plt.close() maskplots.append(plotname) os.system('grep weight '+str(maskout)+' > tt') name="awk 'FS=" name2='" " {print' name3=" $6;}'" nametot=str(name)+str(name2)+str(name3)+' tt > time_'+str(filter)+'.w' os.system(nametot) www.append('time_'+str(filter)+'.w') else: maskplots.append("nomask") masktime.append("nomask") www.append("nomask") return maskplots,masktime,www
def paintmaskdens(mask,plotout,io,logger): command='poly2poly -ol30 '+str(mask)+' trimregion.list' #os.system(command) mvcount=io.run_command(command,logger) logger.info("Executed %s. Return code = %s" % (command,mvcount)) cp,m = graphmask.plot_mangle_map('trimregion.list',vmax=8,autoscale=True,enlarge_border=0.01,bgcolor='white',cmap=cm.winter) plt.savefig(plotout) plt.close()
def paintmasklistwithpoints(list,ra,dec,plotout,io,logger): plt.clf() plt.figure(1)#, figsize=(8,6)) plt.plot(ra,dec,'ko',alpha=0.75) cp,m = graphmask.plot_mangle_map(list,autoscale=True,enlarge_border=0.01,bgcolor='white',cmap=cm.jet) plt.savefig(plotout) plt.close(1)
def paintmask_consolida(mask,rm,rM,dm,dM,maskout,io,logger): command='poly2poly -ol30 '+str(mask)+' trimregion.list' os.system(command) #mvcount=io.run_command(command,logger) #logger.info("Executed %s. Return code = %s" % (command,mvcount)) cp,m = graphmask.plot_mangle_map('trimregion.list',autoscale=True,enlarge_border=0.01,minaz=rm,maxaz=rM,minel=dm,maxel=dM,bgcolor='white',cmap=cm.jet) plt.savefig(maskout) plt.close()
def paintmask_fromlist_redgreen(lisst,maskout,title,io,logger): cmap3 = discrete_cmap() bounds =[0,1,2,3] norm = col.BoundaryNorm(bounds, cmap3.N) #mvcount=io.run_command(command,logger) #logger.info("Executed %s. Return code = %s" % (command,mvcount)) cp,m = graphmask.plot_mangle_map(lisst,autoscale=True,enlarge_border=0.01,edgecolor='black',draw_colorbar=False,plottitle=str(title),bgcolor='white',cmap=cmap3,vmin=0.,vmax=3.,norm=norm) cbar = colorbar(cp, ticks=[0.5,1.5,2.5]) cbar.ax.set_yticklabels(['error', 'failed', 'passed']) plt.savefig(maskout) plt.close()
def paintt(mask,io,logger): command='poly2poly -ol30 '+str(mask)+' trimregion.list' mvcount=io.run_command(command,logger) logger.info("Executed %s. Return code = %s" % (command,mvcount)) cp,m = graphmask.plot_mangle_map('trimregion.list',autoscale=True,enlarge_border=0.01,bgcolor='white',cmap=cm.jet) name='mask.png' plt.savefig(name) plt.close() return name
print e ramin=io.getConfigById("RAMIN") ramax=io.getConfigById("RAMAX") decmin=io.getConfigById("DECMIN") decmax=io.getConfigById("DECMAX") mask='/archive/staging/DES/coadds/masks/'+str(release)+'/'+str(release)+'_holymolys_maglims_'+str(band)+'.pol' said='trimregion_'+str(band)+'_maglims.pol' trim_mask(mask,ramin,ramax,decmin,decmax,said,io,logger) command='poly2poly -ol30 '+str(said)+' trimregion.list' mvcount=io.run_command(command,logger) logger.info("Executed %s. Return code = %s" % (command,mvcount)) cp,m = graphmask.plot_mangle_map('trimregion.list',autoscale=True,enlarge_border=0.01,bgcolor='white',cmap=cm.jet) nameI='mask_'+str(release)+'_holymolys_maglims_'+str(band)+'.png' plt.savefig(nameI) plt.close() os.system('grep weight '+str(said)+' > tt') name="awk 'FS=" name2='" " {print' name3=" $6;}'" nametot=str(name)+str(name2)+str(name3)+' tt > maglims_'+str(band) #mvcount=io.run_command(nametot,stdout='maglims') #io.logger.info("Executed %s. Return code = %s" % (comfour,mvcount)) os.system(nametot)