def cross_match(self, inCatalogFileName, outCatalogFileName, radiusArcmin=1.0): """Cross matches input and output source catalogs. """ inTab = atpy.Table().read(inCatalogFileName) outTab = atpy.Table().read(outCatalogFileName) self.inTab, self.outTab, self.rDeg = catalogs.crossMatch( inTab, outTab, radiusArcmin=radiusArcmin)
'Mpivot': 3.0e+14, 'sigma_int': 0.0 } tckQFitDict = signals.loadQ("../MFMF_SOSim_3freq_tiles/selFn/QFit.fits") fRelWeightsDict = signals.loadFRelWeights( "../MFMF_SOSim_3freq_tiles/selFn/fRelWeights.fits") # Make combined table mergedTabFileName = "trueMasses_MFMF_SOSim_3freq_tiles_M500.fits" if os.path.exists(mergedTabFileName) == False: halos = atpy.Table().read("../halos.fits") tab = atpy.Table().read( "../MFMF_SOSim_3freq_tiles/MFMF_SOSim_3freq_tiles_M500.fits") tab = tab[tab['fixed_SNR'] > 6] tab, halos, rDeg = catalogs.crossMatch(tab, halos, radiusArcmin=1.0) zs = halos['z'] yc = tab['fixed_y_c'] M200m = halos['M200m'] M500c = [] count = 0 for m, z in zip(M200m, zs): count = count + 1 print(count, len(M200m)) M500c.append(signals.convertM200mToM500c(m, z)) M500c = np.array(M500c) M500c = M500c[:, 0] tab['true_M500'] = M500c / 1e14 tab['true_M200'] = M200m / 1e14 tab['redshift'] = zs
yc = {} ycErr = {} labels = {} # Cross match against nemo output print("Collecting fixed_y_c measurements for each cluster across all maps") xMatchFiles = glob.glob("outputCatalogs/*.fits") xMatchFiles.sort() for f in xMatchFiles: label = os.path.split(f)[-1].split("_optimal")[0] print(" %s" % (label)) tab = atpy.Table().read(f) #tab=tab[tab['fixed_SNR'] > SNRCut] try: refMatched, tabMatched, sep = catalogs.crossMatch(refTab, tab, radiusArcmin=1.4) except: raise Exception( "Matching probably failed because SNRCut is too low so there were no matches" ) for ref, match in zip(refMatched, tabMatched): name = ref['name'] if name not in yc.keys(): yc[name] = [] ycErr[name] = [] labels[name] = [] ycRef[name] = ref['fixed_y_c'] * calFactor ycErrRef[name] = ref['fixed_err_y_c'] yc[name].append(match['fixed_y_c'])