mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 15:21:11 +00:00
added cross-comparison utilities
This commit is contained in:
parent
cbc7a0299b
commit
1c0964ba54
2 changed files with 96 additions and 20 deletions
79
python_tools/void_python_tools/voidUtil/matchUtil.py
Executable file
79
python_tools/void_python_tools/voidUtil/matchUtil.py
Executable file
|
@ -0,0 +1,79 @@
|
|||
#!/usr/bin/env python
|
||||
#+
|
||||
# VIDE -- Void IDentification and Examination -- ./crossCompare/analysis/mergerTree.py
|
||||
# Copyright (C) 2010-2013 Guilhem Lavaux
|
||||
# Copyright (C) 2011-2013 P. M. Sutter
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#+
|
||||
|
||||
|
||||
from void_python_tools.backend import *
|
||||
import imp
|
||||
import pickle
|
||||
import os
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import argparse
|
||||
|
||||
def compareCatalogs(baseCatalogDir, compareCatalogDir,
|
||||
outputDir="./", logDir="./",
|
||||
matchMethod="useID", dataPortion="central",
|
||||
strictMatch=True,
|
||||
pathToCTools="../../../c_tools")
|
||||
|
||||
# reports the overlap between two void catalogs
|
||||
# baseCatalogDir: directory of catalog 1
|
||||
# compareCatagDir: directory of catalog 2
|
||||
# outputDir: directory to place outputs
|
||||
# logDir: directory to place log files
|
||||
# matchMethod: "useID" to use unique IDs, "prox" to use overlap of Voronoi cells
|
||||
# dataPortion: "central" or "all"
|
||||
# strictMatch: if True, only attempt to match to trimmed catalog
|
||||
# pathToCTools: path to location of VIDE c_tools directory
|
||||
|
||||
if not os.access(outputDir, os.F_OK):
|
||||
os.makedirs(outputDir)
|
||||
|
||||
if not os.access(logDir, os.F_OK):
|
||||
os.makedirs(logDir)
|
||||
|
||||
outFileName = outputDir + "/" + "voidOverlap" #+ ".dat"
|
||||
|
||||
with open(baseCatalogDir+"/sample_info.dat", 'rb') as input:
|
||||
baseSample = pickle.load(input)
|
||||
|
||||
with open(compareCatalogDir+"/sample_info.dat", 'rb') as input:
|
||||
sample = pickle.load(input)
|
||||
|
||||
print " Comparing", baseSample.fullName, "to", sample.fullName, "...",
|
||||
sys.stdout.flush()
|
||||
|
||||
sampleName = sample.fullName
|
||||
|
||||
binPath = pathToCTools+"/analysis/voidOverlap"
|
||||
logFile = logDir+"/compare_"+baseSample.fullName+"_"+sampleName+".out"
|
||||
stepOutputFileName = outFileName + "_" + baseSample.fullName + "_" + \
|
||||
sampleName + "_"
|
||||
|
||||
launchVoidOverlap(baseSample, sample, baseCatalogDir,
|
||||
compareCatalogDir, binPath,
|
||||
thisDataPortion=dataPortion, logFile=logFile,
|
||||
continueRun=False, workDir=workDir,
|
||||
outputFile=stepOutputFileName,
|
||||
matchMethod=matchMethod,
|
||||
strictMatch=strictMatch)
|
||||
|
||||
print " Done!"
|
|
@ -58,29 +58,26 @@ import sys
|
|||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
dataNameBase = "xcor"
|
||||
def computeCrossCor(catalogDir,
|
||||
outputDir="./", logDir="./",
|
||||
matchMethod="useID", dataPortion="central",
|
||||
strictMatch=True,
|
||||
pathToCTools="../../../c_tools")
|
||||
|
||||
parser = argparse.ArgumentParser(description='Analyze.')
|
||||
parser.add_argument('--parmFile', dest='parmFile', default='datasetsToAnalyze.py',
|
||||
help='path to parameter file')
|
||||
args = parser.parse_args()
|
||||
# Computes void-void and void-matter(galaxy) correlations
|
||||
# baseCatalogDir: directory of catalog
|
||||
# compareCatagDir: directory of catalog 2
|
||||
# outputDir: directory to place outputs
|
||||
# logDir: directory to place log files
|
||||
# matchMethod: "useID" to use unique IDs, "prox" to use overlap of Voronoi cells
|
||||
# dataPortion: "central" or "all"
|
||||
# strictMatch: if True, only attempt to match to trimmed catalog
|
||||
# pathToCTools: path to location of VIDE c_tools directory
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
if not os.access(outputDir, os.F_OK):
|
||||
os.makedirs(outputDir)
|
||||
|
||||
filename = args.parmFile
|
||||
print " Loading parameters from", filename
|
||||
if not os.access(filename, os.F_OK):
|
||||
print " Cannot find parameter file %s!" % filename
|
||||
exit(-1)
|
||||
parms = imp.load_source("name", filename)
|
||||
globals().update(vars(parms))
|
||||
|
||||
if not os.access(outputDir, os.F_OK):
|
||||
os.makedirs(outputDir)
|
||||
|
||||
for (iSample, sampleDir) in enumerate(sampleDirList):
|
||||
|
||||
with open(voidBaseDir+sampleDir+"/sample_info.dat", 'rb') as input:
|
||||
with open(catalogDir+"/sample_info.dat", 'rb') as input:
|
||||
sample = pickle.load(input)
|
||||
|
||||
print " Working with", sample.fullName, "...",
|
Loading…
Add table
Add a link
Reference in a new issue