ax2 = fig.add_axes([left, bottom, width, height]) ## hardwired column names and file paths here. Remember to change. cluster = pyfits.open( '/home/s1/ynzhang/redmapper_centering/data_dump_June21/SDSS-aug-30-2017-highsnr-peak-sample-noastro.fits' )[1].data lambdas = cluster['lambda'] rdmp_ra = cluster['redMaPPer_ra'] rdmp_dec = cluster['redMaPPer_dec'] xray_ra = cluster['x_ray_peak_ra'] xray_dec = cluster['x_ray_peak_dec'] centr = SkyCoord(rdmp_ra, rdmp_dec, frame='icrs', unit='deg') coord = SkyCoord(xray_ra, xray_dec, frame='icrs', unit='deg') sep = centr.separation(coord).arcminute * u.arcmin psep = sep * cosmo.kpc_proper_per_arcmin(cluster['Redshift']).to( u.Mpc / u.arcmin) roffs = psep.value rlmds = (0.01 * lambdas)**0.2 / 0.7 ###################### lmd_bins = [20] lmd_bins_max = [300] for ii in np.arange(0, len(lmd_bins)): lmd_min = lmd_bins[ii] lmd_max = lmd_bins_max[ii] ind, = np.where((lambdas < lmd_max) & (lambdas >= lmd_min) & (rlmds > 0)) r_offset = roffs[ind] lmd = lambdas[ind] rlmd = rlmds[ind]
'/home/s1/ynzhang/redmapper_centering/data_dump_June21/RM_SDSS_YUANYUAN-oct11.fits' )[1].data lambdas = cluster['LAMBDA_OPTICAL'] zs = cluster['Z_LAMBDA_OPTICAL'] rdmp_ra = cluster['RM ra'] rdmp_dec = cluster['RM dec'] xray_ra = cluster['peak ra'] xray_dec = cluster['peak dec'] ##################### # calculate separations centr = SkyCoord(rdmp_ra, rdmp_dec, frame='icrs', unit='deg') coord = SkyCoord(xray_ra, xray_dec, frame='icrs', unit='deg') sep = centr.separation(coord).arcminute * u.arcmin psep = sep * cosmo.kpc_proper_per_arcmin(cluster['Z_LAMBDA_OPTICAL']).to( u.Mpc / u.arcmin) roffs = psep.value rlmds = (0.01 * lambdas)**0.2 / 0.7 lmd_bins = [20] lmd_bins_max = [1000] for ii in np.arange(0, len(lmd_bins)): # some additional purging and binning lmd_min = lmd_bins[ii] lmd_max = lmd_bins_max[ii] ind, = np.where((rlmds > 0) & (cluster['Z_LAMBDA_OPTICAL'] < 0.35) & (cluster['Z_LAMBDA_OPTICAL'] > 0.1) & (lambdas >= lmd_min) & (lambdas < lmd_max)) r_offset = roffs[ind] lmd = lambdas[ind] rlmd = rlmds[ind]