plt.legend(loc='upper right') plt.xlabel(r'${\rm ZP_{GCM} - ZP_{qSLR}}') plt.ylabel("Number of CCDs") gcm_bands = dict() qslr_bands = dict() diff_bands = dict() for b in BANDS: zp_g = gcm['MAG_ZERO'][gcm['BAND'] == b] zp_q = qslr['MAG_ZERO'][qslr['BAND'] == b] delta = zp_g - zp_q labels = qslr[HPX][qslr['BAND'] == b] index = np.unique(labels) for data, out in [(zp_g, gcm_bands), (zp_q, qslr_bands), (delta, diff_bands)]: skymap = blank(nside) skymap[index] = nd.median(data, labels=labels, index=index) out[b] = skymap diff_colors = dict() for name, (b1, b2) in COLORS: gcm_color = gcm_bands[b1] - gcm_bands[b2] qslr_color = qslr_bands[b1] - qslr_bands[b2] skymap = gcm_color - qslr_color diff_colors[name] = skymap for b in BANDS: skymap = diff_bands[b] plt.figure() im = plotting.draw_footprint(skymap) plt.colorbar(im, label=r'${\rm ZP_{GCM} - ZP_{qSLR}}$')
and len(glob.glob(y2q1dir + '/*%05d.fits' % p)) ]) if len(pixels) == 0: msg = "Invalid pixel: %s" % opts.pix raise Exception(msg) args = [pix for pix in pixels] p = Pool(maxtasksperchild=1) out = p.map(residuals, args) median_skymaps = odict() mean_skymaps = odict() std_skymaps = odict() for band in BANDS: median_skymap = blank(nside) mean_skymap = blank(nside) std_skymap = blank(nside) for pix, val in out: median_skymap[pix] = val[band][0] mean_skymap[pix] = val[band][1] std_skymap[pix] = val[band][2] median_skymaps[band] = median_skymap mean_skymaps[band] = mean_skymap std_skymaps[band] = std_skymap for band in BANDS: plt.figure() im = plotting.draw_footprint(median_skymaps[band]) plt.colorbar(im, label=r'Median Offset (mag)') plt.title(r'Median Magnitude Offset (%s-band)' % band)
if opts.type == 'gaia': func = gaia_photometry kwargs['version'] = 'edr3' outbase += '_gaia_%(version)s'%kwargs elif opts.type == 'rms': func = rms_photometry outbase += '_rms' else: msg = "Unrecognized type: %s"%args.type raise Exception(msg) results = utils.multiproc(func,args,kwargs) #results = [func(*a,**kwargs) for a in args] hpxmap = blank(nside) if None in results: print("WARNING: %i processes failed..."%results.count(None)) for pix,stat in [r for r in results if r is not None]: hpxmap[pix] = stat hpxmap = np.ma.MaskedArray(hpxmap,np.isnan(hpxmap),fill_value=np.nan) hpxmaps[band] = hpxmap outfile = join(outdir,outbase+'_%s_n%i.fits'%(band,nside)) print("Writing %s..."%outfile) hp.write_map(outfile,hpxmap,overwrite=True) q = [5,50,95] p = np.percentile(hpxmap.compressed(),q)
config = yaml.load(open(args.config)) BANDS = config['bands'] NSIDE = args.nside outdir = mkdir('release/depth') infiles = sorted(glob.glob('cat/cat_hpx_*.fits')) p = Pool(maxtasksperchild=1,processes=20) out = p.map(depth,infiles) skymaps = dict() for b in BANDS: logger.info("Filling %s-band..."%b) skymap = blank(NSIDE) for i,maglims in enumerate(out): logger.info(str(i)) skymap[maglims[b][0]] = maglims[b][1] skymaps[b] = np.ma.MaskedArray(skymap,np.isnan(skymap),fill_value=np.nan) outfile = join(outdir,'y2q1_maglim_%s_n%i_ring.fits'%(b,NSIDE)) logger.info("Writing %s..."%outfile) healpy.write_map(outfile,skymaps[b].data) logger.info("Gzipping %s..."%outfile) subprocess.call('gzip -f %s'%outfile,shell=True) out = dict() outstr = '|_. Band |_. Footprint |_. Distribution |_. Magnitude Limit |\n' template = '|_. %(band)s |{{thumbnail(%(map)s, size=300)}}|{{thumbnail(%(hist)s, size=300)}}|_. %(maglim)s |\n' for b in BANDS: