This commit is contained in:
P.M. Sutter 2014-05-08 22:48:46 -04:00
commit cbc7a0299b
74 changed files with 689 additions and 2179 deletions

View file

@ -71,9 +71,9 @@ configure_exec(${CMAKE_SOURCE_DIR}/run_env.sh.in ${CMAKE_BINARY_DIR} run_env.sh
configure_exec(${CMAKE_SOURCE_DIR}/python_tools/pipeline_source/prepareInputs.in.py
${CMAKE_BINARY_DIR}/pipeline prepareInputs.py)
#configure_exec(${CMAKE_SOURCE_DIR}/python_tools/pipeline_source/applyMaskToMock.in.py
${CMAKE_BINARY_DIR}/pipeline applyMaskToMock.py)
#${CMAKE_BINARY_DIR}/pipeline applyMaskToMock.py)
#configure_exec(${CMAKE_SOURCE_DIR}/python_tools/pipeline_source/buildSkyProjections.in.py
${CMAKE_BINARY_DIR}/pipeline/miscTools buildSkyProjections.py)
#${CMAKE_BINARY_DIR}/pipeline/miscTools buildSkyProjections.py)
SET(python_build_environment
${CMAKE_COMMAND} -DPYTHON_LOCAL_SITE_PACKAGE=${PYTHON_LOCAL_SITE_PACKAGE} -DVOID_GSL=${CMAKE_BINARY_DIR}/ext_build/gsl -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DTARGET_PATH=${CMAKE_BINARY_DIR}/ext_build/python -P)

50
README
View file

@ -12,54 +12,8 @@ This is VIDE, the Void IDentification and Examination pipeline.
License/Copyright information
-----------------------------
Copyright (C) 2010-2013 Guilhem Lavaux, 2011-2013 P.M. Sutter.
Copyright (C) 2010-2014 Guilhem Lavaux, 2011-2014 P.M. Sutter.
This software is put under the GNU Public License. Please see LICENSE
for further information.
Parts of the pipeline includes ZOBOV. See zobov/zobov_readme.txt for
copyright/license information
Building
--------
After compiling, go to the pipeline directory.
Using the pipeline
------------------
Create a dataset parameter file. Look at datasets/multidark.py for
an example. Describe the simulation, where to put outputs, how many
redshift slices, subvolumes, etc. etc.
prepareCatalogs will produce a pipeline script for each
subsampling you choose. If you have multiple redshift particle files,
and choose multiple slices and/or subdivisions, they will be packaged
in the same pipeline script.
Run "./generateCatalog.py [name of pipeline script]" for each script
written by prepareGadgetCatalog. This will run generateMock, zobov,
and pruneVoids. At the end of it, you should have a void catalog for
each redshift, slice, and subdivision.
Check the logfiles for any error messages.
See the README of the public void catalog for the format of the
outputs.
Please do not change the outputs of pruneVoids etc. without
discussion, since further analysis relies on the current formats.
If you're wondering why these scripts are rather complex, it's because
it can also support A-P analysis, which is much more complicated :)
Good luck!
Important directories:
pipeline: scripts to set up and generate void catalogs
crossCompare: analysis and plotting tools designed to work with disparate catalogs
This pipeline includes ZOBOV. See zobov/zobov_readme.txt for copyright/license information.

View file

@ -1,51 +0,0 @@
#+
# VIDE -- Void IDentification and Examination -- ./crossCompare/analysis/datasetsToAnalyze.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.
#+
#!/usr/bin/env python
outputDir = "/home/psutter2/workspace/Voids/analysis/xcor/"
# Sim parameters
Ni = 1000237 # Number of dark matter particles per dimension in simulation
ss = 0.1 # Subsampling fraction of dark matter particles to read
Mpart = 8.721e9 # Particle mass [M_sol]
Npart = int(ss*Ni) # Particle number of subsample
Lboxcut = 0. # Size of optional margin to be cut from the box [h^(-1)Mpc]
Nmesh = 256 # Interpolation meshlength
Nbin = 70 # Number of bins for power spectrum and correlation function
r_H = 3000. # Hubble scale [h^(-1)Mpc]
ns = 0.95 # Spectral index
sigma_8 = 0.82 # Sigma_8
h = 0.7 # Dimensionless Hubble parameter
# Input files
matterDir = '/home/psutter2/workspace/Voids/catalogs/mergertree512/'
haloDir = '/home/psutter2/workspace/Voids/catalogs/mergertree512/'
matterFilename = 'mf_4s_1G_512_1.000'
haloFilename = 'mf_4s_1G_512_bgc2_1.000.sdf'
voidBaseDir = "/home/psutter2/workspace/Voids/"
sampleDirList = [
"mergertree512/mt_ss0.01/sample_mt_ss0.01_z0.00_d00/",
]
dataPortion = "central"

19
analysis/xcor.py Executable file → Normal file
View file

@ -1,3 +1,22 @@
#+
# VIDE -- Void IDentification and Examination -- ./analysis/xcor.py
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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.
#+
#!/usr/bin/env python
#+
# VIDE -- Void IDentification and Examination -- ./crossCompare/analysis/mergerTree.py

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./build_tools/gather_sources.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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
@ -41,8 +41,8 @@ def apply_license(license, relimit, filename):
def apply_python_license(filename):
license="""#+
# VIDE -- Void IDentification and Examination -- @FILENAME@
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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
@ -68,8 +68,8 @@ def apply_python_license(filename):
def apply_cpp_license(filename):
license="""/*+
VIDE -- Void IDentification and Examination -- @FILENAME@
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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
@ -85,13 +85,14 @@ def apply_cpp_license(filename):
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
"""
relimit = r'^(?s)/\*\+.*\+\*/'
relimit = r'^(?s)/\*\+.*\+\*/\n'
print("C++ file: %s" % filename)
apply_license(license, relimit, filename)
def analyze_tree(prefix, t):
for ename,entry in t.items():
for entry in t:
ename = entry.name
if ename == 'external' or ename == 'zobov':
continue
if type(entry) == Tree:

View file

@ -44,7 +44,7 @@ include_directories(
set(computeAverageDistortion_SRCS computeAverageDistortion.cpp)
add_genopt(computeAverageDistortion_SRCS computeAverageDistortion.ggo computeAverageDistortion_conf STRUCTNAME Params)
add_executable(computeAverageDistortion ${computeAverageDistortion_SRCS})
target_link_libraries(computeAverageDistortion ${ZOB_LIBS})
#add_executable(computeAverageDistortion ${computeAverageDistortion_SRCS})
#target_link_libraries(computeAverageDistortion ${ZOB_LIBS})
subdirs(libzobov test mock stacking visualization analysis zobov2 hod)
subdirs(libzobov mock stacking analysis zobov2 hod)

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/analysis/voidOverlap.cpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,3 +1,21 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/hod/complex.h
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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.
+*/
/* CAUTION: This is the ANSI C (only) version of the Numerical Recipes
utility file complex.h. Do not confuse this file with the same-named
file complex.h that is supplied in the 'misc' subdirectory.

View file

@ -1,3 +1,21 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/hod/header.h
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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.
+*/
#include "nrutil.h"
#include "stdlib.h"
#include "stdio.h"

View file

@ -1,3 +1,21 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/hod/nrutil.h
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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.
+*/
/* CAUTION: This is the ANSI C (only) version of the Numerical Recipes
utility file nrutil.h. Do not confuse this file with the same-named
file nrutil.h that is supplied in the 'misc' subdirectory.

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/libzobov/contour_pixels.cpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDEntification pipeline -- ./c_tools/libzobov/contour_pixels.hpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
VIDE -- Void IDentification and Examination -- ./c_tools/libzobov/contour_pixels.hpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDEntification pipeline -- ./c_tools/libzobov/gslIntegrate.hpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
VIDE -- Void IDentification and Examination -- ./c_tools/libzobov/gslIntegrate.hpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/libzobov/loadZobov.cpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDEntification pipeline -- ./c_tools/libzobov/loadZobov.hpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
VIDE -- Void IDentification and Examination -- ./c_tools/libzobov/loadZobov.hpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/libzobov/particleInfo.cpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDEntification pipeline -- ./c_tools/libzobov/particleInfo.hpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
VIDE -- Void IDentification and Examination -- ./c_tools/libzobov/particleInfo.hpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDEntification pipeline -- ./c_tools/libzobov/voidTree.hpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
VIDE -- Void IDentification and Examination -- ./c_tools/libzobov/voidTree.hpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/mock/generateFromCatalog.cpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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
@ -368,8 +368,8 @@ void generateSurfaceMask(generateFromCatalog_info& args ,
// TEST - insert mock galaxies along spheres of survey redshift boundaries
fp = fopen("mock_sphere.txt", "w");
for (int q = 0; q < 0; q++) {
//for (int q = 0; q < full_mask_list.size(); q++) {
//for (int q = 0; q < 0; q++) {
for (int q = 0; q < full_mask_list.size(); q++) {
vec3 v = mask.pix2vec(full_mask_list[q]);
Position p;

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/mock/generateMock.cpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/mock/generateTestMock.cpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/mock/loaders/basic_loader.cpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/mock/loaders/flash_loader.cpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/mock/loaders/gadget_loader.cpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/mock/loaders/multidark_loader.cpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/mock/loaders/ramses_loader.cpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/mock/loaders/sdf_loader.cpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDEntification pipeline -- ./c_tools/mock/loaders/sdfloader_internal.hpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
VIDE -- Void IDentification and Examination -- ./c_tools/mock/loaders/sdfloader_internal.hpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/mock/loaders/simulation_loader.cpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDEntification pipeline -- ./c_tools/mock/loaders/simulation_loader.hpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
VIDE -- Void IDentification and Examination -- ./c_tools/mock/loaders/simulation_loader.hpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,39 +1,39 @@
include_directories(${CMAKE_CURRENT_BINARY_DIR})
SET(stackVoids_SRCS stackVoids.cpp)
add_genopt(stackVoids_SRCS stackVoids.ggo stackVoids_conf STRUCTNAME stackVoids_info)
add_executable(stackVoids ${stackVoids_SRCS})
target_link_libraries(stackVoids ${ZOB_LIBS})
#SET(stackVoids_SRCS stackVoids.cpp)
#add_genopt(stackVoids_SRCS stackVoids.ggo stackVoids_conf STRUCTNAME stackVoids_info)
#add_executable(stackVoids ${stackVoids_SRCS})
#target_link_libraries(stackVoids ${ZOB_LIBS})
SET(stackVoidsZero_SRCS stackVoidsZero.cpp)
add_genopt(stackVoidsZero_SRCS stackVoidsZero.ggo stackVoidsZero_conf STRUCTNAME stackVoidsZero_info)
add_executable(stackVoidsZero ${stackVoidsZero_SRCS})
target_link_libraries(stackVoidsZero ${ZOB_LIBS})
#SET(stackVoidsZero_SRCS stackVoidsZero.cpp)
#add_genopt(stackVoidsZero_SRCS stackVoidsZero.ggo stackVoidsZero_conf STRUCTNAME stackVoidsZero_info)
#add_executable(stackVoidsZero ${stackVoidsZero_SRCS})
#target_link_libraries(stackVoidsZero ${ZOB_LIBS})
set(computeVelocityProfile_SRCS computeVelocityProfile.cpp)
add_genopt(computeVelocityProfile_SRCS computeVelocityProfile.ggo computeVelocityProfile_conf STRUCT Params)
add_executable(computeVelocityProfile ${computeVelocityProfile_SRCS})
target_link_libraries(computeVelocityProfile ${ZOB_LIBS})
#set(computeVelocityProfile_SRCS computeVelocityProfile.cpp)
#add_genopt(computeVelocityProfile_SRCS computeVelocityProfile.ggo computeVelocityProfile_conf STRUCT Params)
#add_executable(computeVelocityProfile ${computeVelocityProfile_SRCS})
#target_link_libraries(computeVelocityProfile ${ZOB_LIBS})
set(stackDensityField_SRCS stackDensityField.cpp)
add_genopt(stackDensityField_SRCS stackDensityField.ggo stackDensityField_conf STRUCT PARAMS)
add_executable(stackDensityField ${stackDensityField_SRCS})
target_link_libraries(stackDensityField ${ZOB_LIBS})
#set(stackDensityField_SRCS stackDensityField.cpp)
#add_genopt(stackDensityField_SRCS stackDensityField.ggo stackDensityField_conf STRUCT PARAMS)
#add_executable(stackDensityField ${stackDensityField_SRCS})
#target_link_libraries(stackDensityField ${ZOB_LIBS})
set(stackVelocityField_SRCS stackVelocityField.cpp)
add_genopt(stackVelocityField_SRCS stackVelocityField.ggo stackVelocityField_conf STRUCT PARAMS)
add_executable(stackVelocityField ${stackVelocityField_SRCS})
target_link_libraries(stackVelocityField ${ZOB_LIBS})
#set(stackVelocityField_SRCS stackVelocityField.cpp)
#add_genopt(stackVelocityField_SRCS stackVelocityField.ggo stackVelocityField_conf STRUCT PARAMS)
#add_executable(stackVelocityField ${stackVelocityField_SRCS})
#target_link_libraries(stackVelocityField ${ZOB_LIBS})
SET(pruneVoids_SRCS pruneVoids.cpp)
add_genopt(pruneVoids_SRCS pruneVoids.ggo pruneVoids_conf STRUCTNAME pruneVoids_info)
add_executable(pruneVoids ${pruneVoids_SRCS})
target_link_libraries(pruneVoids ${ZOB_LIBS})
SET(makeAHFOutput_SRCS makeAHFOutput.cpp)
add_genopt(makeAHFOutput_SRCS makeAHFOutput.ggo makeAHFOutput_conf STRUCTNAME makeAHFOutput_info)
add_executable(makeAHFOutput ${makeAHFOutput_SRCS})
target_link_libraries(makeAHFOutput ${ZOB_LIBS})
#SET(makeAHFOutput_SRCS makeAHFOutput.cpp)
#add_genopt(makeAHFOutput_SRCS makeAHFOutput.ggo makeAHFOutput_conf STRUCTNAME makeAHFOutput_info)
#add_executable(makeAHFOutput ${makeAHFOutput_SRCS})
#target_link_libraries(makeAHFOutput ${ZOB_LIBS})

View file

@ -1,7 +1,7 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/stacking/pruneVoids.cpp
Copyright (C) 2010-2013 Guilhem Lavaux
Copyright (C) 2011-2013 P. M. Sutter
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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

View file

@ -1,3 +1,21 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/zobov2/jozov2/jozov2.cpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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.
+*/
#include <boost/format.hpp>
#include <exception>
#include <iostream>

View file

@ -1,3 +1,21 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/zobov2/jozov2/jozov2.hpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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.
+*/
#ifndef __JOZOV2_HPP
#define __JOZOV2_HPP

View file

@ -1,3 +1,21 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/zobov2/jozov2/jozov2_io.cpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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.
+*/
#include <iostream>
#include <fstream>
#include <string>

View file

@ -1,3 +1,21 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/zobov2/jozov2/jozov2_watershed.cpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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.
+*/
#ifdef OPENMP
#include <omp.h>
#endif

View file

@ -1,3 +1,21 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/zobov2/jozov2/jozov2_zones.cpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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.
+*/
#include <iostream>
#include <fstream>
#include "jozov2.hpp"

View file

@ -1,3 +1,21 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/zobov2/jozov2/zobov.hpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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.
+*/
#ifndef __ZOBOV_HPP
#define __ZOBOV_HPP

View file

@ -1,3 +1,21 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/zobov2/voz1b1/voz.h
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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.
+*/
#ifndef __VOZ_H
#define __VOZ_H

View file

@ -1,3 +1,21 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/zobov2/voz1b1/voz1b1.cpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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.
+*/
#include <cassert>
#include <boost/format.hpp>
#include <iostream>

View file

@ -1,3 +1,21 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/zobov2/voz1b1/voz_io.cpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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.
+*/
#include <limits>
#include <iostream>
#include <fstream>

View file

@ -1,3 +1,21 @@
/*+
VIDE -- Void IDentification and Examination -- ./c_tools/zobov2/voz1b1/voz_io.hpp
Copyright (C) 2010-2014 Guilhem Lavaux
Copyright (C) 2011-2014 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.
+*/
#ifndef __VOZ_IO_HPP
#define __VOZ_IO_HPP

View file

@ -1,157 +0,0 @@
#!/usr/bin/env python
#+
# VIDE -- Void IDentification and Examination -- ./pipeline/apAnalysis.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.
#+
# takes voids of given radii, computes 1 profiles,
# then computes 1d profiles for higher-resolution catalogs using
# same positions
# computes radial density profiles centered on baseSample
import imp
import pickle
import os
import numpy as np
import argparse
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from void_python_tools.backend import *
from util import *
# ------------------------------------------------------------------------------
parser = argparse.ArgumentParser(description='Analyze.')
parser.add_argument('--parm', dest='parm', default='datasetsToAnalyze.py', help='path to parameter file')
parser.add_argument('--show', dest='showPlot', action='store_const',
const=True, default=False,
help='display the plot (default: just write eps)')
args = parser.parse_args()
# -----------------------------------------------------------------------------
# plot a slice of the density around the void in baseIDList,
# with any voids in the slice shown and any voids in baseIDList flagged
def saveProfiles(baseSample, stack, sampleList, profileList, radii,
figDir, showPlot, outputDir):
thisRadius = str(stack.rMin) + "-" + str(stack.rMax)
plotName = "1dprofile_cocenter_" + baseSample.fullName+"_"+thisRadius
np.savez(outputDir+"/1dprofile_cocentered_"+plotName+".dat",
profileList, radii)
return
# -----------------------------------------------------------------------------
filename = args.parm
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)
if not os.access(logDir, os.F_OK):
os.makedirs(logDir)
if not os.access(figDir, os.F_OK):
os.makedirs(figDir)
# get list of base voids
with open(workDir+baseSampleDir+"/sample_info.dat", 'rb') as input:
baseSample = pickle.load(input)
baseSampleName = baseSample.fullName
baseVoidList = np.loadtxt(workDir+baseSampleDir+"/centers_central_"+\
baseSampleName+".out")
sampleList = []
for sampleDir in sampleDirList:
if compareSampleTag in sampleDir: continue
with open(workDir+sampleDir+"/sample_info.dat", 'rb') as input:
sampleList.append(pickle.load(input))
sampleDirList.insert(0,baseSampleDir)
sampleList.insert(0,baseSample)
# pick our void sample
for stack in baseSample.stacks:
print " Stack:", stack.rMin, "-", stack.rMax
accepted = (baseVoidList[:,4] > stack.rMin) & (baseVoidList[:,4] < stack.rMax)
stackVoidList = baseVoidList[accepted]
print " We have", len(stackVoidList), "voids here"
profileList = []
radii = []
rMaxProfile = stack.rMin*3 + 2
if baseSample.profileBinSize == "auto":
density = 0.5 * 50 / rMaxProfile / 2
else:
density = baseSample.profileBinSize
nBins = rMaxProfile*density
for (iSample, sampleDir) in enumerate(sampleDirList):
if compareSampleTag in sampleDir: continue
sample = sampleList[iSample]
print " Working with", sample.fullName, "..."
sys.stdout.flush()
sampleName = sample.fullName
print " Loading particle data..."
partData, boxLen, volNorm = loadPart(workDir, sampleDir, sample)
stackedProfile = np.zeros((nBins))
print " Stacking voids..."
binCenters = []
for void in stackVoidList:
periodicLine = getPeriodic(sample)
center = void[0:3]
shiftedPart = shiftPart(partData, center, periodicLine, boxLen)
dist = np.sqrt(shiftedPart[:,0]**2 + shiftedPart[:,1]**2 + \
shiftedPart[:,2]**2)
thisProfile, radii = np.histogram(dist, bins=nBins, range=(0,rMaxProfile))
deltaV = 4*np.pi/3*(radii[1:]**3-radii[0:(radii.size-1)]**3)
thisProfile = np.float32(thisProfile)
thisProfile /= deltaV
stackedProfile += thisProfile
binCenters = 0.5*(radii[1:]+radii[:-1])
stackedProfile /= volNorm
stackedProfile /= len(stackVoidList)
profileList.append(stackedProfile)
# plot these profiles
print " Plotting..."
sys.stdout.flush()
#binCenters = 0.5*(radii[1:] + radii[:-1])
saveProfiles(baseSample, stack, sampleList, profileList, binCenters,
figDir, args.showPlot, outputDir)
print " Done!"

View file

@ -1,84 +0,0 @@
#!/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.
#+
# computes the overlap between two void catalogs
from void_python_tools.backend import *
from void_python_tools.plotting import *
import imp
import pickle
import os
import matplotlib.pyplot as plt
import numpy as np
import argparse
# ------------------------------------------------------------------------------
parser = argparse.ArgumentParser(description='Analyze.')
parser.add_argument('--parm', dest='parm', default='datasetsToAnalyze.py',
help='path to parameter file')
args = parser.parse_args()
# ------------------------------------------------------------------------------
filename = args.parm
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)
if not os.access(logDir, os.F_OK):
os.makedirs(logDir)
outFileName = outputDir + "/" + "voidOverlap" #+ ".dat"
with open(workDir+baseSampleDir+"/sample_info.dat", 'rb') as input:
baseSample = pickle.load(input)
for (iSample, sampleDir) in enumerate(sampleDirList):
with open(workDir+sampleDir+"/sample_info.dat", 'rb') as input:
sample = pickle.load(input)
print " Working with", sample.fullName, "...",
sys.stdout.flush()
sampleName = sample.fullName
binPath = CTOOLS_PATH+"/analysis/voidOverlap"
logFile = logDir+"/mergertree_"+baseSample.fullName+"_"+sampleName+".out"
stepOutputFileName = outFileName + "_" + baseSample.fullName + "_" + \
sampleName + "_"
launchVoidOverlap(baseSample, sample, workDir+baseSampleDir,
workDir+sampleDir, binPath,
thisDataPortion="central", logFile=logFile,
continueRun=False, workDir=workDir,
outputFile=stepOutputFileName,
#matchMethod="useID")
matchMethod="prox")
print " Done!"

View file

@ -1,32 +0,0 @@
#!/usr/bin/env python
workDir = "" # base directory for all samples
outputDir = ""
logDir = "./logs/"
figDir = "./figs/"
# path to c_tools directory in VIDE
CTOOLS_PATH = "/home/psutter2/projects/Voids/vide/c_tools/"
# the path under workDir/ which which holds the sample you want to compare againt (e.g., the fiducial case)
baseSampleDir = "sample_/"
# comma-separated list of samples to compare against baseSampleDir
sampleDirList = [
"sample1_/",
"sample2_/",
"sample3_/",
]
dataPortions = [ "all" ]
# this name gets appended to all output filenames and plots
plotLabel = "test"
# title to place on plots
plotTitle = "Test"
# don't touch this for now; it will be fully implemented and explained later
compareSampleTag = ""
doTheory = False

View file

@ -1,37 +0,0 @@
#+
# VIDE -- Void IDEntification pipeline -- ./crossCompare/plotting/datasetsToPlot.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.
#+
#!/usr/bin/env python
workDir = "/home/psutter2/workspace/Voids/"
figDir = "./figs"
sampleDirList = [
# "multidark/md_ss0.1_pv/sample_md_ss0.1_pv_z0.56_d00/",
# "multidark/md_halos_min1.393e12_pv/sample_md_halos_min1.393e12_pv_z0.56_d00/",
# "random/ran_ss0.000175/sample_ran_ss0.000175_z0.56_d00/",
# "random/ran_ss0.1/sample_ran_ss0.1_z0.56_d00/",
# "multidark/md_hod_dr9mid_pv/sample_md_hod_dr9mid_pv_z0.56_d00/",
# "multidark/md_ss0.000175_pv/sample_md_ss0.000175_pv_z0.56_d00/",
"sdss_dr9/sample_lss.dr9cmassmid.dat/",
"lanl/masked/masked_lanl_hod_dr9mid_pv/sample_masked_lanl_hod_dr9mid_pv_z0.5/" ]
dataPortion = "central"

View file

@ -1,174 +0,0 @@
#!/usr/bin/env python
#+
# VIDE -- Void IDentification and Examination -- ./pipeline/apAnalysis.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.
#+
# plots radial density profiles centered on baseVoid.
# requires makeCocenteredProfiles to be run first!
import imp
import pickle
import os
import numpy as np
import argparse
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from void_python_tools.backend import *
from util import *
from globalOptions import *
from scipy.optimize import curve_fit
matplotlib.rcParams.update({'font.size': 20})
# ------------------------------------------------------------------------------
parser = argparse.ArgumentParser(description='Analyze.')
parser.add_argument('--parm', dest='parm', default='datasetsToAnalyze.py', help='path to parameter file')
parser.add_argument('--show', dest='showPlot', action='store_const',
const=True, default=False,
help='display the plot (default: just write eps)')
args = parser.parse_args()
# -----------------------------------------------------------------------------
# Lavaux & Wandelt (2012) profile
def LWProfile(r, A0, A3, alpha):
return A0 + A3*r**3.
#return A0 + A3*r**alpha
# -----------------------------------------------------------------------------
# http://arxiv.org/pdf/astro-ph/0508297v1.pdf eq. 5
def PadillaProfile(r, A1, A2, alpha):
return 1.5-A1*np.exp(-(A2*r)**alpha)
# -----------------------------------------------------------------------------
# plot a slice of the density around the void in baseIDList,
# with any voids in the slice shown and any voids in baseIDList flagged
def plotProfiles(baseSample, stack, sampleList,
figDir, showPlot, outputDir, doTheory):
thisRadius = str(stack.rMin) + "-" + str(stack.rMax)
plotName = "1dprofile_cocenter_" + baseSample.fullName+"_"+thisRadius
filename = "1dprofile_cocenter_" + baseSample.fullName+"_"+thisRadius
npzfile = np.load(outputDir+"/1dprofile_cocentered_"+plotName+".dat.npz")
profileList = npzfile['arr_0']
radii = npzfile['arr_1']
plt.clf()
plt.xlabel(r"$R/R_{eff}$")
#plt.xlabel(r"$R/R_{v,\mathrm{max}}$")
plt.ylabel(r"$n / \bar n$")
plt.xlim(xmin=0.0, xmax=2.5)
plt.ylim(ymin=0.0, ymax=1.7)
#plt.xscale('log')
for (iSample, sample) in enumerate(sampleList):
lineTitle = sample.nickName[:-10]
if "DM LowDen" in lineTitle or "DM HighDen" in lineTitle: continue
thisPlotTitle = r"$R_{eff}$ = "+thisRadius+ r" $h^{-1}$Mpc"
legendTitle = "Fixed Center Samples"
thisProfile = profileList[iSample]
if np.all(thisProfile == 0.): continue
rV = (stack.rMin + stack.rMax)/2.
if len(radii) > 0:
scaledRadii = radii/rV
plt.plot(scaledRadii, thisProfile, label=lineTitle,
color=colorList[iSample],
linewidth=linewidth)
if doTheory:
nBins = len(scaledRadii)/2
try:
popt, pcov = curve_fit(PadillaProfile, scaledRadii[0:nBins],
thisProfile[0:nBins], maxfev=10000, xtol=5.e-3)
except RuntimeError:
print "Warning: no convergence reached"
label = r"A1=%.2f, A2=%.2f, $\alpha$=%.2f" % (popt[0], popt[1], popt[2])
rho = PadillaProfile(scaledRadii, popt[0], popt[1], popt[2])
plt.plot(scaledRadii, rho, '--', label=label,
color=colorList[iSample], linewidth=2)
plt.title(thisPlotTitle + " (center from " + plotTitle + ")", fontsize=18)
plt.legend(title = legendTitle, loc = "lower right", prop={'size':16})
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
if (showPlot):
os.system("display %s" % figDir+"/fig_"+plotName+".png")
return
# -----------------------------------------------------------------------------
filename = args.parm
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)
if not os.access(logDir, os.F_OK):
os.makedirs(logDir)
if not os.access(figDir, os.F_OK):
os.makedirs(figDir)
# get list of base voids
with open(workDir+baseSampleDir+"/sample_info.dat", 'rb') as input:
baseSample = pickle.load(input)
baseSampleName = baseSample.fullName
baseVoidList = np.loadtxt(workDir+baseSampleDir+"/centers_central_"+\
baseSampleName+".out")
sampleList = []
for sampleDir in sampleDirList:
if compareSampleTag in sampleDir: continue
with open(workDir+sampleDir+"/sample_info.dat", 'rb') as input:
sampleList.append(pickle.load(input))
sampleDirList.insert(0,baseSampleDir)
sampleList.insert(0,baseSample)
# pick our void sample
for stack in baseSample.stacks:
print " Stack:", stack.rMin, "-", stack.rMax
# plot these profiles
print " Plotting..."
sys.stdout.flush()
plotProfiles(baseSample, stack, sampleList,
figDir, args.showPlot, outputDir, doTheory)
print " Done!"

View file

@ -1,385 +0,0 @@
#!/usr/bin/env python
#+
# VIDE -- Void IDentification and Examination -- ./pipeline/apAnalysis.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.
#+
# takes nVoids evenly distributed, plots a slice of the local density and
# overlays the voids
import imp
import pickle
import os
import numpy as np
import argparse
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from void_python_tools.backend import *
import void_python_tools.xcor as xcor
from netCDF4 import Dataset
#import pylab as plt
NetCDFFile = Dataset
ncFloat = 'f8'
matplotlib.rcParams.update({'font.size': 16})
# ------------------------------------------------------------------------------
mergerNameBase = "voidOverlap"
parser = argparse.ArgumentParser(description='Analyze.')
parser.add_argument('--parm', dest='parm', default='datasetsToAnalyze.py', help='path to parameter file')
parser.add_argument('--show', dest='showPlot', action='store_const',
const=True, default=False,
help='display the plot (default: just write eps)')
args = parser.parse_args()
nVoids = 10
# ------------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# plot a slice of the density around the void in baseIDList,
# with any voids in the slice shown and any voids in baseIDList flagged
def plotVoidAndDen(idList, voidList, partData, boxLen, figDir,
sliceCenter=None, sliceWidth=200,
baseIDList=None, baseRadius=0, nickName=None,
baseNickName=None,
baseIndex=0,
periodic=None, showPlot=False, plotName=None):
if len(voidList) <= 1: return
plt.clf()
#sliceWidth = 220
sliceWidth = max(220, sliceWidth)
# make an appropriate box
xwidth = sliceWidth
ywidth = sliceWidth
zwidth = sliceWidth/4.
#zwidth = max(sliceWidth/4., 50)
# get mean density
part = 1.*partData
totalNumPart = len(part)
totalVol = (part[:,0].max() - part[:,0].min()) * \
(part[:,1].max() - part[:,1].min()) * \
(part[:,2].max() - part[:,2].min())
meanDen = totalNumPart/totalVol
# single out the matched void
keepVoid = []
if len(np.atleast_1d(idList)) > 0:
keepVoid = voidList[voidList[:,7] == idList]
if len(np.shape(keepVoid)) > 1: keepVoid = keepVoid[0,:]
filter = voidList[:,7] != idList
voidList = voidList[filter,:]
# convert everything to relative coordinates
part[:,0] -= sliceCenter[0]
part[:,1] -= sliceCenter[1]
part[:,2] -= sliceCenter[2]
shiftUs = np.abs(part[:,0]) > boxLen[0]/2.
if ("x" in periodicLine): part[shiftUs,0] -= \
np.copysign(boxLen[0],part[shiftUs,0])
shiftUs = np.abs(part[:,1]) > boxLen[1]/2.
if ("y" in periodicLine): part[shiftUs,1] -= \
np.copysign(boxLen[1],part[shiftUs,1])
shiftUs = np.abs(part[:,2]) > boxLen[2]/2.
if ("z" in periodicLine): part[shiftUs,2] -= \
np.copysign(boxLen[2],part[shiftUs,2])
voidList = np.atleast_2d(voidList)
np.atleast_2d(voidList)[:,0] -= sliceCenter[0]
np.atleast_2d(voidList)[:,1] -= sliceCenter[1]
np.atleast_2d(voidList)[:,2] -= sliceCenter[2]
shiftUs = np.abs(voidList[:,0]) > boxLen[0]/2.
if ("x" in periodicLine):
voidList[shiftUs,0] -= \
np.copysign(boxLen[0],voidList[shiftUs,0])
shiftUs = np.abs(voidList[:,1]) > boxLen[1]/2.
if ("y" in periodicLine): voidList[shiftUs,1] -= \
np.copysign(boxLen[1],voidList[shiftUs,1])
shiftUs = np.abs(voidList[:,2]) > boxLen[2]/2.
if ("z" in periodicLine): voidList[shiftUs,2] -= \
np.copysign(boxLen[2],voidList[shiftUs,2])
if len(np.atleast_1d(keepVoid)) >= 1:
keepVoid[0] -= sliceCenter[0]
keepVoid[1] -= sliceCenter[1]
keepVoid[2] -= sliceCenter[2]
shiftUs = np.abs(keepVoid[0]) > boxLen[0]/2.
if ("x" in periodicLine) and shiftUs: keepVoid[0] -= \
np.copysign(boxLen[0],keepVoid[0])
shiftUs = np.abs(keepVoid[1]) > boxLen[1]/2.
if ("y" in periodicLine) and shiftUs: keepVoid[1] -= \
np.copysign(boxLen[1],keepVoid[1])
shiftUs = np.abs(keepVoid[2]) > boxLen[2]/2.
if ("z" in periodicLine) and shiftUs: keepVoid[2] -= \
np.copysign(boxLen[2],keepVoid[2])
xmin = -xwidth/2.
xmax = xwidth/2.
ymin = -ywidth/2.
ymax = ywidth/2.
zmin = -zwidth/2.
zmax = zwidth/2.
# pull out voids that were potential matches
filter = np.sqrt(voidList[:,0]**2 + voidList[:,1]**2 + voidList[:,2]**2) <=\
baseRadius*1.5
potentialMatches = voidList[filter]
# get centers and radii of any other voids in slice
zminVoid = -zwidth/16.
zmaxVoid = zwidth/16.
filter = (voidList[:,0] > xmin) & (voidList[:,0] < xmax) & \
(voidList[:,1] > ymin) & (voidList[:,1] < ymax) & \
(voidList[:,2] > zminVoid) & (voidList[:,2] < zmaxVoid)
voidList = voidList[filter,:]
# slice particles
filter = (part[:,0] > xmin) & (part[:,0] < xmax) & \
(part[:,1] > ymin) & (part[:,1] < ymax) & \
(part[:,2] > zmin) & (part[:,2] < zmax)
part = part[filter]
# plot density
extent = [xmin, xmax, ymin, ymax]
hist, xedges, yedges = np.histogram2d(part[:,0], part[:,1], normed=False,
bins=64)
#hist /= meanDen
hist = np.log10(hist+1)
plt.imshow(hist,
aspect='equal',
extent=extent,
interpolation='gaussian',
cmap='YlGnBu_r')
#plt.colorbar()
# overlay voids as circles
fig = plt.gcf()
ax = fig.add_subplot(1,1,1)
# the original void
circle = plt.Circle((0,0), baseRadius,
edgecolor='orange', facecolor=None, fill=False,
linewidth=5)
fig.gca().add_artist(circle)
# our matched void
if len(np.atleast_1d(keepVoid)) > 0:
if idList == baseIDList:
edgecolor = 'orange'
else:
edgecolor = 'red'
circle = plt.Circle((keepVoid[0], keepVoid[1]), keepVoid[4],
edgecolor=edgecolor, facecolor=None, fill=False,
linewidth=5)
fig.gca().add_artist(circle)
# other voids in the slice
for void in voidList:
if np.any(void[7] == idList):
continue
else:
color = 'white'
circle = plt.Circle((void[0], void[1]), void[4],
edgecolor=color, facecolor=None, fill=False,
linewidth=5)
fig.gca().add_artist(circle)
# potential match voids
#for void in potentialMatches:
# if np.any(void[7] == idList):
# continue
# else:
# color = 'green'
# circle = plt.Circle((void[0], void[1]), void[4],
# edgecolor=color, facecolor=None, fill=False,
# linewidth=5)
# fig.gca().add_artist(circle)
baseNickName = baseNickName[:-10].lstrip()
nickName = nickName[:-10].lstrip()
if idList == baseIDList:
title = "%d $h^{-1}$Mpc" % int(baseRadius)
title += " (" + baseNickName + ")"
else:
title = r"$\rightarrow$ "
if len(np.atleast_1d(keepVoid)) > 0:
title += "%d $h^{-1}$Mpc" % int(keepVoid[4]) + " (" + nickName + ")"
else:
title += "No match"
#title += "(" + str(int(baseIDList)) + ")"
plt.title(title, fontsize=20)
#plt.xlabel("x [$h^{-1}$Mpc]", fontsize=14)
#plt.ylabel("y [$h^{-1}$Mpc]", fontsize=14)
plotName += "_" + str(int(baseIndex))
#plotName += "_" + str(int(baseRadius))
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
if showPlot: os.system("display %s" % figDir+"/fig_"+plotName+".png")
return
# -----------------------------------------------------------------------------
filename = args.parm
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)
if not os.access(logDir, os.F_OK):
os.makedirs(logDir)
if not os.access(figDir, os.F_OK):
os.makedirs(figDir)
mergerFileBase = outputDir + "/" + mergerNameBase
# get list of base voids
with open(workDir+baseSampleDir+"/sample_info.dat", 'rb') as input:
baseSample = pickle.load(input)
baseSampleName = baseSample.fullName
baseVoidList = np.loadtxt(workDir+baseSampleDir+"/centers_central_"+\
baseSampleName+".out")
# sort by size
radii = baseVoidList[:,4]
indices = np.argsort(radii)[::-1]
baseVoidList = baseVoidList[indices,:]
setName = baseSampleDir.split('/')[0]
# pick our void sample
bigVoidList = baseVoidList[0:10,:]
stride = len(baseVoidList)/nVoids
baseVoidList = baseVoidList[::stride]
baseVoidList = np.vstack((bigVoidList,baseVoidList))
sampleDirList.insert(0,baseSampleDir)
for (iSample, sampleDir) in enumerate(sampleDirList):
if compareSampleTag in sampleDir: continue
with open(workDir+sampleDir+"/sample_info.dat", 'rb') as input:
sample = pickle.load(input)
print " Working with", sample.fullName, "..."
sys.stdout.flush()
sampleName = sample.fullName
print " Loading particle data..."
sys.stdout.flush()
infoFile = workDir+"/"+sampleDir+"/zobov_slice_"+sample.fullName+".par"
File = NetCDFFile(infoFile, 'r')
ranges = np.zeros((3,2))
ranges[0][0] = getattr(File, 'range_x_min')
ranges[0][1] = getattr(File, 'range_x_max')
ranges[1][0] = getattr(File, 'range_y_min')
ranges[1][1] = getattr(File, 'range_y_max')
ranges[2][0] = getattr(File, 'range_z_min')
ranges[2][1] = getattr(File, 'range_z_max')
File.close()
mul = np.zeros((3))
mul[:] = ranges[:,1] - ranges[:,0]
boxLen = mul
partFile = workDir+"/"+sampleDir+"/zobov_slice_"+sample.fullName
#partFile = catalogDir+"/"+sample.dataFile
iLine = 0
partData = []
part = np.zeros((3))
File = file(partFile)
chk = np.fromfile(File, dtype=np.int32,count=1)
Np = np.fromfile(File, dtype=np.int32,count=1)
chk = np.fromfile(File, dtype=np.int32,count=1)
chk = np.fromfile(File, dtype=np.int32,count=1)
x = np.fromfile(File, dtype=np.float32,count=Np)
x *= mul[0]
x += ranges[0][0]
chk = np.fromfile(File, dtype=np.int32,count=1)
chk = np.fromfile(File, dtype=np.int32,count=1)
y = np.fromfile(File, dtype=np.float32,count=Np)
y *= mul[1]
y += ranges[1][0]
chk = np.fromfile(File, dtype=np.int32,count=1)
chk = np.fromfile(File, dtype=np.int32,count=1)
z = np.fromfile(File, dtype=np.float32,count=Np)
z *= mul[2]
z += ranges[2][0]
chk = np.fromfile(File, dtype=np.int32,count=1)
File.close()
partData = np.column_stack((x,y,z))#.transpose()
for (iBaseVoid,baseVoid) in enumerate(baseVoidList):
print " Void:", int(baseVoid[7]), "(", int(baseVoid[4]), ")"
baseIDList = baseVoid[7]
sliceCenter = baseVoid[0:3]
sliceWidth = baseVoid[4]*4
# get matched void
idList = []
if sample.fullName == baseSample.fullName:
idList = baseIDList
else:
matchFile=mergerFileBase+"_"+baseSampleName+"_"+sampleName+"_summary.out"
if os.access(matchFile, os.F_OK):
matchList = np.loadtxt(matchFile)
for i,testID in enumerate(matchList[:,0]):
if testID == baseIDList:
if (matchList[i,8] > 0): idList.append(matchList[i,8])
idList = np.array(idList)
idList = idList.astype(int)
voidList = np.loadtxt(workDir+sampleDir+"/trimmed_nodencut_centers_central_"+\
sampleName+".out")
periodicLine = getPeriodic(sample)
plotVoidAndDen(idList, voidList, partData, boxLen, figDir,
sliceCenter=sliceCenter, sliceWidth=sliceWidth,
baseIDList=baseIDList, baseRadius=baseVoid[4],
baseIndex=iBaseVoid,
nickName=sample.nickName, periodic=periodicLine,
baseNickName=baseSample.nickName,
showPlot=args.showPlot,
plotName="denmap_"+setName+"_"+baseSampleName+"_"+sampleName)
print " Done!"

View file

@ -1,135 +0,0 @@
#!/usr/bin/env python
# plots cumulative distributions of number counts
import matplotlib
matplotlib.use('Agg')
from void_python_tools.backend import *
from void_python_tools.plotting import *
import void_python_tools.apTools as vp
import imp
import pickle
import os
import matplotlib.pyplot as plt
import numpy as np
import argparse
from globalOptions import *
# plots the ratio of ellipticities for matched voids
# ------------------------------------------------------------------------------
parser = argparse.ArgumentParser(description='Plot.')
parser.add_argument('--show', dest='showPlot', action='store_const',
const=True, default=False,
help='display the plot (default: just write eps)')
parser.add_argument('--parm', dest='parm', default='datasetsToPlot.py',
help='path to parameter file')
args = parser.parse_args()
# ------------------------------------------------------------------------------
print "Plotting ellipticity ratio"
filename = args.parm
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(figDir, os.F_OK):
os.makedirs(figDir)
dataSampleList = []
compareSampleList = []
with open(workDir+baseSampleDir+"/sample_info.dat", 'rb') as input:
baseSample = pickle.load(input)
for sampleDir in sampleDirList:
with open(workDir+sampleDir+"/sample_info.dat", 'rb') as input:
thisSample = pickle.load(input)
if compareSampleTag in thisSample.fullName:
compareSampleList.append(thisSample)
else:
dataSampleList.append(thisSample)
plt.clf()
numSubPlots = len(dataSampleList)
fig, axesList = plt.subplots(numSubPlots, sharex=True, sharey=True)
axesList = np.atleast_1d(axesList)
for (iSample,sample) in enumerate(dataSampleList):
if sample.fullName == baseSample.fullName: continue
sampleName = sample.fullName
lineTitle = sample.nickName[:-10]
# plt.xlabel("Void Radius [Mpc/h]")
# plt.ylabel(r"1st Progenitor Relative Ellipticity")
#plt.yscale('log')
# plt.xlim(xmax=rMax)
plt.xlim(rMin, rMax)
plotNameBase = "matchrelellip"
plotName = plotNameBase + "_" + plotLabel# + "_" + sampleName
filename = outputDir+"/voidOverlap_"+baseSample.fullName+"_"+sampleName+"_summary.out"
if not os.access(filename, os.F_OK):
print "File not found: ", filename
continue
data = np.loadtxt(filename, comments="#")
if data.ndim == 1:
print " Too few!"
continue
# find a sample to compare it to
for compareSample in compareSampleList:
if compareSample.nickName[:10] == sample.nickName[:10]:
filename = outputDir+"/voidOverlap_"+baseSample.fullName+"_"+compareSample.fullName+"_summary.out"
compareData = np.loadtxt(filename, comments="#")
axesList[iSample].scatter(compareData[:,1], compareData[:,10],
color='blue', alpha=alpha, s=pointsize)
#plt.scatter(data[:,1], data[:,10],
# label=lineTitle, color=colorList[iSample])
axesList[iSample].scatter(data[:,1], data[:,10],
label=lineTitle, color='red', alpha=alpha, s=pointsize)
axesList[iSample].legend(loc = "upper left", prop={'size':10})
plt.ylim(0., 4.0)
yticks = axesList[iSample].yaxis.get_major_ticks()
yticks[-1].label1.set_visible(False)
yticks[0].label1.set_visible(False)
#axesList[iSample].set_xlim([20,rMax])
fig.subplots_adjust(hspace=0)
plt.setp([a.get_xticklabels() for a in fig.axes[:-1]], visible=False)
axesList[0].set_title(plotTitle, fontsize=14)
#axesList[0].set_title("Match ellipticity ratio - "+plotTitle)
fig.text(0.5, 0.04, r'$R_{eff}$ [$h^{-1}$Mpc]', ha='center', va='center', fontsize=14)
fig.text(0.06, 0.5, 'Match Ellipticity Ratio', ha='center', va='center', rotation='vertical', fontsize=14)
#plt.legend(title = "Samples", loc = "upper left", prop={'size':8})
#plt.title("Match ellipticity ratio - "+plotTitle+" - "+sample.nickName)
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
if args.showPlot:
os.system("display %s" % figDir+"/fig_"+plotName+".png")

View file

@ -1,144 +0,0 @@
#!/usr/bin/env python
# plots cumulative distributions of number counts
import matplotlib
matplotlib.use('Agg')
from void_python_tools.backend import *
from void_python_tools.plotting import *
import void_python_tools.apTools as vp
import imp
import pickle
import os
import matplotlib.pyplot as plt
import numpy as np
import argparse
from globalOptions import *
from scipy.optimize import curve_fit
# plots the ratio of sizes for matched voids
# ------------------------------------------------------------------------------
parser = argparse.ArgumentParser(description='Plot.')
parser.add_argument('--show', dest='showPlot', action='store_const',
const=True, default=False,
help='display the plot (default: just write eps)')
parser.add_argument('--parm', dest='parm', default='datasetsToPlot.py',
help='path to parameter file')
args = parser.parse_args()
# -----------------------------------------------------------------------------
def Linear(x, a, b):
return a*x+b
# ------------------------------------------------------------------------------
print "Plotting match size ratio"
filename = args.parm
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(figDir, os.F_OK):
os.makedirs(figDir)
dataSampleList = []
compareSampleList = []
with open(workDir+baseSampleDir+"/sample_info.dat", 'rb') as input:
baseSample = pickle.load(input)
for sampleDir in sampleDirList:
with open(workDir+sampleDir+"/sample_info.dat", 'rb') as input:
thisSample = pickle.load(input)
if compareSampleTag in thisSample.fullName:
compareSampleList.append(thisSample)
else:
dataSampleList.append(thisSample)
plt.clf()
#plt.yscale('log')
numSubPlots = len(dataSampleList)
fig, axesList = plt.subplots(numSubPlots, sharex=True, sharey=True)
axesList = np.atleast_1d(axesList)
for (iSample,sample) in enumerate(dataSampleList):
if sample.fullName == baseSample.fullName: continue
sampleName = sample.fullName
lineTitle = sample.nickName[:-10]
plotNameBase = "matchvolrelradius"
plotName = plotNameBase + "_" + plotLabel# + "_" + sampleName
filename = outputDir+"/voidOverlap_"+baseSample.fullName+"_"+sampleName+"_summary.out"
if not os.access(filename, os.F_OK):
print "File not found: ", filename
continue
data = np.loadtxt(filename, comments="#")
if data.ndim == 1:
print " Too few!"
continue
# find a sample to compare it to
for compareSample in compareSampleList:
if compareSample.nickName[:10] == sample.nickName[:10]:
filename = outputDir+"/voidOverlap_"+baseSample.fullName+"_"+compareSample.fullName+"_summary.out"
compareData = np.loadtxt(filename, comments="#")
axesList[iSample].scatter(compareData[:,1], compareData[:,2],
color='blue', alpha=alpha, s=pointsize)
axesList[iSample].scatter(data[:,1], data[:,2],
label=lineTitle, color='red', alpha=alpha, s=pointsize)
try:
popt, pcov = curve_fit(Linear, data[:,1],
data[:,2], maxfev=10000, xtol=5.e-3)
except RuntimeError:
print "Warning: no convergence reached"
label = r"$a$=%.2f, $b$=%.2f" % (popt[0], popt[1])
radii = np.arange(rMin, rMax, 1)
relRad = Linear(radii, popt[0], popt[1])
#axesList[iSample].plot(radii, relRad, '-', label=label,
# color='black', linewidth=2)
axesList[iSample].legend(loc = "best", fancybox=True,prop={'size':10})
plt.ylim(0., 2.5)
yticks = axesList[iSample].yaxis.get_major_ticks()
yticks[-1].label1.set_visible(False)
yticks[0].label1.set_visible(False)
axesList[iSample].set_xlim([rMin,rMax])
fig.subplots_adjust(hspace=0)
plt.setp([a.get_xticklabels() for a in fig.axes[:-1]], visible=False)
axesList[0].set_title(plotTitle, fontsize=14)
#axesList[0].set_title("Match size ratio - "+plotTitle)
fig.text(0.5, 0.04, r'$R_{eff}$ [$h^{-1}$Mpc]', ha='center', va='center', fontsize=14)
fig.text(0.06, 0.5, 'Match Relative Radius', ha='center', va='center', rotation='vertical', fontsize=14)
#plt.legend(title = "Samples", loc = "upper left", prop={'size':8})
#plt.title("Match size ratio - "+plotTitle+" - "+sample.nickName)
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
if args.showPlot:
os.system("display %s" % figDir+"/fig_"+plotName+".png")

View file

@ -1,286 +0,0 @@
#!/usr/bin/env python
# plots cumulative distributions of number counts
import matplotlib
matplotlib.use('Agg')
from void_python_tools.backend import *
from void_python_tools.plotting import *
import void_python_tools.apTools as vp
import imp
import pickle
import os
import matplotlib.pyplot as plt
import numpy as np
import argparse
import svdw
from scipy.optimize import curve_fit
from scipy.interpolate import interp1d
from globalOptions import *
# ------------------------------------------------------------------------------
histBinWidth = 1 # Mpc
parser = argparse.ArgumentParser(description='Plot.')
parser.add_argument('--show', dest='showPlot', action='store_const',
const=True, default=False,
help='display the plot (default: just write eps)')
parser.add_argument('--binned', dest='binned', action='store_const',
const=True, default=False,
help='plot binned function (default: cumulative)')
parser.add_argument('--parm', dest='parm', default='datasetsToPlot.py',
help='path to parameter file')
parser.add_argument('--xmax', dest='xmax', default=120.,
help='x limit of plot')
parser.add_argument('--xmin', dest='xmin', default=20.,
help='x limit of plot')
args = parser.parse_args()
# ------------------------------------------------------------------------------
def svdwFunc(r, scaleFactor):
radius, cumu_ps = svdw.getSvdW(.01, 100, 100, scaleFactor=scaleFactor)
cumu_ps += 0.1
cumu_ps = np.log10(cumu_ps)
interped = interp1d(radius, cumu_ps)
interpVal = interped(r)
interpVal[interpVal<1.0] = 1.0
#print "HELLO", r, interpVal
return interpVal
# ------------------------------------------------------------------------------
def loadData(sampleDir, dataPortion, treePortion='all'):
with open(workDir+sampleDir+"/sample_info.dat", 'rb') as input:
sample = pickle.load(input)
filename = workDir+"/"+sampleDir+"/centers_"+dataPortion+"_"+sample.fullName+".out"
if not os.access(filename, os.F_OK):
print "File not found: ", filename
return -1, -1, -1
data = np.loadtxt(filename, comments="#")
if data.ndim == 1:
print " Too few!"
return -1, -1, -1
if treePortion == "parents":
filter = data[:,10] == -1
data = data[filter]
elif treePortion == "children":
filter = data[:,10] != -1
data = data[filter]
data = data[:,4]
indices = np.arange(0, len(data), 1)
sorted = np.sort(data)
if sample.dataType == "observation":
boxVol = vp.getSurveyProps(sample.maskFile,
sample.zBoundary[0], sample.zBoundary[1],
sample.zRange[0], sample.zRange[1], "all",
selectionFuncFile=None)[0]
#selectionFuncFile=sample.selFunFile)[0]
boxVol *= obsFudgeFactor
else:
boxVol = sample.boxLen*sample.boxLen*(sample.zBoundaryMpc[1] -
sample.zBoundaryMpc[0])
boxVol *= 1.e-9 # Mpc->Gpc
indices /= boxVol
#xmin = sorted[0]
#xmax = sorted[-1]
#bins = int((xmax-xmin)/histBinWidth)
bins = args.xmax/histBinWidth
hist, binEdges = np.histogram(sorted, bins=bins, range=(0., args.xmax))
#hist, binEdges = np.histogram(sorted, bins=bins, range=(xmin,xmax))
binCenters = 0.5*(binEdges[1:] + binEdges[:-1])
if not args.binned:
foundStart = False
for iBin in xrange(len(hist)):
if not foundStart and hist[iBin] == 0:
continue
foundStart = True
hist[iBin] = np.sum(hist[iBin:])
hist /= boxVol
hist = np.log10(hist)
lineTitle = sample.nickName[:-10]
return hist, binCenters, lineTitle
def fill_between(x, y1, y2=0, ax=None, **kwargs):
"""Plot filled region between `y1` and `y2`.
This function works exactly the same as matplotlib's fill_between, except
that it also plots a proxy artist (specifically, a rectangle of 0 size)
so that it can be added it appears on a legend.
"""
ax = ax if ax is not None else plt.gca()
ax.fill_between(x, y1, y2, interpolate=True, **kwargs)
p = plt.Rectangle((0, 0), 0, 0, **kwargs)
ax.add_patch(p)
# ------------------------------------------------------------------------------
print "Plotting number function"
filename = args.parm
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(figDir, os.F_OK):
os.makedirs(figDir)
plt.clf()
plt.xlabel(r"$R_{eff}$ [$h^{-1}$Mpc]", fontsize=14)
plt.ylabel(r"log ($n$ > $R_{eff}$ [$h^3$ Gpc$^{-3}$])", fontsize=14)
#plt.yscale('log')
plt.xlim(xmin=5.)
plt.xlim(xmax=100.)
plt.ylim(ymin=1)
plt.ylim(ymax=5)
plotNameBase = "numberfunc"
plotName = plotNameBase + "_" + plotLabel
sampleDirList.append(baseSampleDir)
for (iSample,sampleDir) in enumerate(sampleDirList):
for dataPortion in dataPortions:
# get all the data
allHist = []
if "ZZZZ" in sampleDir:
for fileZ in fileList:
thisSampleDir = sampleDir.replace("ZZZZ", fileZ)
hist, binCenters, lineTitle = loadData(thisSampleDir, dataPortion)
if lineTitle == -1: continue
allHist.append(hist)
lineLabel = lineTitle.replace(fileZ, "all")
if dataPortion != 'all': lineLabel += ", " + dataPortion
maxHist = 1.*allHist[-1]
minHist = 1.*allHist[-1]
for iHist in xrange(len(allHist)-1):
maxHist = np.maximum(maxHist, allHist[iHist])
minHist = np.minimum(minHist, allHist[iHist])
trim = (maxHist > 1)
minHist = minHist[trim]
maxHist = maxHist[trim]
binCentersToUse = binCenters[trim]
alpha = 0.75
if dataPortion == "central":
hatch = '//'
else:
hatch = None
fill_between(binCentersToUse, minHist, maxHist,
label=lineLabel, color=colorList[iSample],
alpha=alpha,
hatch=hatch
)
else:
#treeList = ["children", "parents", "all"]
treeList = ["all"]
for (iTree,treeItem) in enumerate(treeList):
hist, binCenters, lineLabel = loadData(sampleDir, dataPortion, treePortion=treeItem)
trim = (hist > 1)
hist = hist[trim]
binCentersToUse = binCenters[trim]
if lineLabel == -1: continue
if dataPortion != 'all': lineLabel += ", " + dataPortion
if treeItem != "all": lineLabel += ", " + treeItem
iColor = iSample + iTree
if dataPortion == "central":
lineStyle = '--'
else:
lineStyle = '-'
if "DM" in lineLabel: lineColor = colorList[0]
if "Halos" in lineLabel: lineColor = colorList[1]
if "HOD" in lineLabel: lineColor = colorList[2]
if "FullDen" in lineLabel:
lineColor = colorList[4]
lineStyle = '-'
linewidth = 5
if "HighDen" in lineLabel or "HighRes" in lineLabel or \
"All" in lineLabel:
lineStyle = "-"
linewidth = 5
if "LowDen" in lineLabel or "LowRes" in lineLabel or \
"1.20" in lineLabel:
lineStyle = "--"
linewidth = 5
plt.plot(binCentersToUse, hist, lineStyle,
label=lineLabel, color=lineColor,
linewidth=linewidth)
#if doTheory and "LowRes" in sampleDir:
# popt, pcov = curve_fit(svdwFunc, binCentersToUse, hist, p0=25.)
# radius, cumu_ps = svdw.getSvdW(.01, 100, 100, scaleFactor=popt[0])
# cumu_ps = np.log10(cumu_ps)
# print "HELLO", binCentersToUse, hist, cumu_ps
# plt.plot(radius, cumu_ps, color='black', label="SVdW/%g" % popt[0])
# and now the theoretical curve
if doTheory:
#radius, cumu_ps = svdw.getSvdW(.01, 100, 100)
#cumu_ps = np.log10(cumu_ps)
#plt.plot(radius, cumu_ps, color='black', label="SVdW" )
iLine = 0
scaleFactorList = []
#scaleFactorList = [10, 5]
for scaleFactor in scaleFactorList:
#radius, cumu_ps = svdw.getSvdW(.01, 100, 100, scaleFactor=scaleFactor)
#cumu_ps = np.log10(cumu_ps)
#plt.plot(radius, cumu_ps, lineList[iLine], color='black', label="SVdW/%g" % scaleFactor)
iLine += 1
dvList = [-.07]
iLine = 0
for dv in dvList:
radius, cumu_ps = svdw.getSvdW(.01, 100, 1000, d_v=dv)
cumu_ps = np.log10(cumu_ps)
plt.plot(radius, cumu_ps, lineList[iLine], color='black', label=r"SVdW $\delta_v$=%g" % dv, linewidth=3)
iLine += 1
dvList = [-.015]
for dv in dvList:
radius, cumu_ps = svdw.getSvdW(.01, 100, 1000, d_v=dv)
#radius, cumu_ps = svdw.getSvdW(.01, 100, 100, d_v=dv)
cumu_ps = np.log10(cumu_ps)
plt.plot(radius, cumu_ps, lineList[iLine], color='black', label="SVdW $\delta_v$=%g" % dv, linewidth=3)
iLine += 1
plt.legend(loc = "best", fancybox=True, prop={'size':12})
#plt.legend(title = "Samples", loc = "upper right", prop={'size':8})
#plt.title("Number func - "+plotTitle)
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
if args.showPlot:
os.system("display %s" % figDir+"/fig_"+plotName+".png")

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./pipeline/sdss/sdss_dr7LCDM.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# VIDE -- Void IDentification and Examination -- ./pipeline/datasets/example_observation.py
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDEntification pipeline -- ./pipeline/datasets/mergertree.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# VIDE -- Void IDentification and Examination -- ./pipeline/datasets/example_simulation.py
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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

19
pipeline/generateCatalog.py Executable file → Normal file
View file

@ -1,3 +1,22 @@
#+
# VIDE -- Void IDentification and Examination -- ./pipeline/generateCatalog.py
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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.
#+
#!/usr/bin/env python
#+
# VIDE -- Void IDentification and Examination -- ./pipeline/generateCatalog.py

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./pipeline/datasets/mergertree.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# VIDE -- Void IDentification and Examination -- ./python_tools/pipeline_source/defaults.py
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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

View file

@ -1,3 +1,22 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/pipeline_source/prepareCatalogs.in.py
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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.
#+
#!/usr/bin/env python
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/pipeline_source/prepareCatalogs.in.py
@ -251,71 +270,6 @@ newSample = Sample(dataFile = "{dataFile}",
dataSampleList.append(newSample)
"""
if stackMode == "fixed":
stackInfo = """
# {zMin}, {zMax}, {minRadius}
newSample.addStack(0.0, 5.0, 5 , 10, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 10, 15, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 15, 20, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 20, 25, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 25, 30, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 30, 35, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 35, 40, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 40, 45, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 45, 50, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 50, 55, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 55, 60, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 60, 65, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 65, 70, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 70, 75, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 75, 80, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 80, 85, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 85, 90, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 90, 95, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack(0.0, 5.0, 95, 100, False, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
"""
elif stackMode == "sample_thick":
stackInfo = """
# {zMin}, {zMax}, {minRadius}
newSample.addStack({zMin}, {zMax}, 10, 20, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack({zMin}, {zMax}, 20, 30, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack({zMin}, {zMax}, 30, 40, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack({zMin}, {zMax}, 40, 50, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack({zMin}, {zMax}, 50, 60, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack({zMin}, {zMax}, 60, 70, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack({zMin}, {zMax}, 70, 80, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack({zMin}, {zMax}, 80, 90, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack({zMin}, {zMax}, 90, 100, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
"""
elif stackMode == "log":
stackInfo = ""
rMin = 10
rMax = 100
rStart = rMin
rEnd = rMin
dlogR = 0.25
while rEnd < rMax:
rEnd = (1+0.5*dlogR)*rStart/(1-0.5*dlogR)
stackInfo += """newSample.addStack({zMin}, {zMax}"""+ ", %g, %g, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})" % (rStart, rEnd)
rStart = rEnd
elif stackMode == "auto":
stackInfo = """
newSample.addStack({zMin}, {zMax}, 2*{minRadius} , 2*{minRadius}+2, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack({zMin}, {zMax}, 2*{minRadius} , 2*{minRadius}+4, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack({zMin}, {zMax}, 2*{minRadius}+2, 2*{minRadius}+6, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack({zMin}, {zMax}, 2*{minRadius}+6, 2*{minRadius}+10, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack({zMin}, {zMax}, 2*{minRadius}+10, 2*{minRadius}+18, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
newSample.addStack({zMin}, {zMax}, 2*{minRadius}+18, 2*{minRadius}+24, True, False, rescaleMode='{rescaleMode}', maxVoids={maxVoids})
"""
else:
stackInfo = """
# {zMin}, {zMax}, {minRadius}
"""
for (iFile, redshift) in enumerate(redshifts):
fileNum = fileNums[iFile]

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/setup.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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
@ -31,12 +31,12 @@ setup(
cmdclass = {'build_ext': build_ext},
include_dirs = [np.get_include()],
packages=
['void_python_tools','void_python_tools.backend','void_python_tools.apTools', 'void_python_tools.xcor', 'void_python_tools.partUtil',
'void_python_tools.apTools.profiles','void_python_tools.apTools.chi2', 'void_python_tools.plotting'],
['void_python_tools','void_python_tools.backend','void_python_tools.apTools', 'void_python_tools.xcor', 'void_python_tools.voidUtil',
'void_python_tools.apTools.profiles','void_python_tools.apTools.chi2',],
#ext_modules = [Extension("void_python_tools.chi2.velocityProfileFitNative", ["void_python_tools/chi2/velocityProfileFitNative.pyx"], libraries=["gsl", "gslcblas"]), Extension("void_python_tools.chi2.likelihoo", ["void_python_tools/chi2/likelihood.pyx"], libraries=["gsl", "gslcblas"])]
ext_modules = [
Extension("void_python_tools.apTools.chi2.velocityProfileFitNative",
["void_python_tools/apTools/chi2/velocityProfileFitNative.pyx"],
libraries=["gsl", "gslcblas"], library_dirs=[VOID_GSL+"/lib"], include_dirs=[VOID_GSL+"/include"])
]
#ext_modules = [
# Extension("void_python_tools.apTools.chi2.velocityProfileFitNative",
# ["void_python_tools/apTools/chi2/velocityProfileFitNative.pyx"],
# libraries=["gsl", "gslcblas"], library_dirs=[VOID_GSL+"/lib"], include_dirs=[VOID_GSL+"/include"])
#]
)

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/__init__.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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
@ -19,6 +19,5 @@
#+
from void_python_tools.backend import *
from void_python_tools.apTools import *
from void_python_tools.plotting import *
from void_python_tools.xcor import *
from void_python_tools.partUtil import *
from void_python_tools.voidUtil import *

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/apTools/__init__.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/apTools/chi2/__init__.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/apTools/chi2/cosmologyTools.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/apTools/profiles/__init__.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/apTools/profiles/getSurveyProps.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/backend/__init__.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/backend/classes.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/backend/launchers.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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

View file

@ -1,20 +0,0 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/plotting/__init__.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 partUtil import *

View file

@ -1,363 +0,0 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/plotting/plotTools.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.
#+
__all__=['plotRedshiftDistribution', 'plotSizeDistribution', 'plot1dProfiles',
'plotMarg1d', 'plotNumberDistribution', 'plotVoidDistribution']
from void_python_tools.backend.classes import *
from plotDefs import *
import numpy as np
import os
import pylab as plt
import void_python_tools.apTools as vp
import void_python_tools.xcor as xcor
# -----------------------------------------------------------------------------
def plotRedshiftDistribution(workDir=None, sampleList=None, figDir=None,
plotNameBase="zdist",
showPlot=False, dataPortion=None, setName=None):
plt.ioff()
maptplotlib.pyplot.switch_backed('Agg')
plt.clf()
plt.xlabel("Redshift")
plt.ylabel("Number of Voids")
plotTitle = setName
plotName = plotNameBase
xMin = 1.e00
xMax = 0
for (iSample,sample) in enumerate(sampleList):
sampleName = sample.fullName
lineTitle = sampleName
filename = workDir+"/sample_"+sampleName+"/centers_"+dataPortion+"_"+\
sampleName+".out"
if not os.access(filename, os.F_OK):
print "File not found: ", filename
continue
data = np.loadtxt(filename, comments="#")
if data.ndim == 1:
print " Too few!"
continue
zMin = sample.zRange[0]
zMax = sample.zRange[1]
range = (zMin, zMax)
nbins = np.ceil((zMax-zMin)/0.02)
thisMax = np.max(data[:,5])
thisMin = np.min(data[:,5])
if thisMax > xMax: xMax = thisMax
if thisMin < xMin: xMin = thisMin
plt.hist(data[:,5], bins=nbins,
label=lineTitle, color=colorList[iSample],
histtype = "step", range=range,
linewidth=linewidth)
#plt.legend(title = "Samples", loc = "upper right")
plt.title(plotTitle)
plt.xlim(xMin, xMax)
#plt.xlim(xMin, xMax*1.4) # make room for legend
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
if showPlot:
os.system("display %s" % figDir+"/fig_"+plotName+".png")
# -----------------------------------------------------------------------------
def plotSizeDistribution(workDir=None, sampleList=None, figDir=None,
plotNameBase="sizedist",
showPlot=False, dataPortion=None, setName=None):
plt.ioff()
maptplotlib.pyplot.switch_backed('Agg')
plt.clf()
plt.xlabel("Void Radius (Mpc/h)")
plt.ylabel("Number of Voids")
plotTitle = setName
plotName = plotNameBase
xMin = 1.e00
xMax = 0
for (iSample,sample) in enumerate(sampleList):
sampleName = sample.fullName
lineTitle = sampleName
filename = workDir+"/sample_"+sampleName+"/centers_"+dataPortion+"_"+\
sampleName+".out"
if not os.access(filename, os.F_OK):
print "File not found: ", filename
continue
data = np.loadtxt(filename, comments="#")
if data.ndim == 1:
print " Too few!"
continue
xMin = 5
xMax = 140
range = (xMin, xMax)
nbins = np.ceil((xMax-xMin)/5)
#thisMax = np.max(data[:,5])
#thisMin = np.min(data[:,5])
#if thisMax > xMax: xMax = thisMax
#if thisMin < xMin: xMin = thisMin
plt.hist(data[:,4], bins=nbins,
label=lineTitle, color=colorList[iSample],
histtype = "step", range=range,
linewidth=linewidth)
plt.legend(title = "Samples", loc = "upper right")
plt.title(plotTitle)
plt.xlim(xMin, xMax)
#plt.xlim(xMin, xMax*1.4) # make room for legend
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
if showPlot:
os.system("display %s" % figDir+"/fig_"+plotName+".png")
# -----------------------------------------------------------------------------
def plot1dProfiles(workDir=None, sampleList=None, figDir=None,
plotNameBase="1dprofile",
showPlot=False, dataPortion=None, setName=None):
plt.ioff()
maptplotlib.pyplot.switch_backed('Agg')
plt.clf()
plt.xlabel(r"$R/R_{v,\mathrm{max}}$")
plt.ylabel(r"$n / \bar n$")
for (iSample,sample) in enumerate(sampleList):
sampleName = sample.fullName
for (iStack,stack) in enumerate(sample.stacks):
plotTitle = setName
plotName = plotNameBase
runSuffix = getStackSuffix(stack.zMin, stack.zMax, stack.rMin,
stack.rMax, dataPortion)
plotTitle = sampleName + ", z = "+str(stack.zMin)+"-"+str(stack.zMax)+", R = "+str(stack.rMin)+"-"+str(stack.rMax)+ r" $h^{-1}$ Mpc"
filename = workDir+"/sample_"+sampleName+"/stacks_"+runSuffix+\
"profile_1d.txt"
if not os.access(filename, os.F_OK):
print "File not found: ", filename
continue
data = np.loadtxt(filename, comments="#")
if data.ndim == 1:
print " Too few!"
continue
data[:,1] /= stack.rMax
plt.ylim(ymin=0.0, ymax=np.amax(data[:,2])+0.1)
plt.xlim(xmin=0.0, xmax=2.1)
plt.plot(data[:,1], data[:,2], label=lineTitle, color=colorList[0],
linewidth=linewidth)
plt.title(plotTitle)
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
if showPlot:
os.system("display %s" % figDir+"/fig_"+plotName+".png")
# -----------------------------------------------------------------------------
def plotMarg1d(workDir=None, sampleList=None, figDir=None,
plotNameBase="marg1d",
showPlot=False, dataPortion=None, setName=None):
plt.ioff()
maptplotlib.pyplot.switch_backed('Agg')
plotNames = ("Om", "w0", "wa")
plotTitles = ("$\Omega_M$", "$w_0$", "$w_a$")
files = ("Om", "w0", "wa")
for iPlot in range(len(plotNames)):
plt.clf()
plotName = plotNameBase+"_"+plotNames[iPlot]+"_"+dataPortion
plotTitle = plotTitles[iPlot]
dataFile = workDir + "/likelihoods_"+dataPortion+"_"+files[iPlot]+".dat"
plt.xlabel(plotTitle, fontsize="20")
plt.ylabel("Likelihood", fontsize="20")
plt.ylim(0.0, 1.0)
data = np.loadtxt(dataFile, comments="#")
plt.plot(data[:,0], data[:,1], color='k', linewidth=linewidth)
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
if showPlot:
os.system("display %s" % figDir+"/fig_"+plotName+".png")
# -----------------------------------------------------------------------------
def plotNumberDistribution(workDir=None, sampleList=None, figDir=None,
plotNameBase="numberdist",
showPlot=False, dataPortion=None, setName=None):
plt.ioff()
maptplotlib.pyplot.switch_backed('Agg')
plt.clf()
plt.xlabel("Void Radius (Mpc/h)")
plt.ylabel(r"N > R [$h^3$ Mpc$^{-3}$]")
plotTitle = setName
plotName = plotNameBase
plt.yscale('log')
for (iSample,sample) in enumerate(sampleList):
sampleName = sample.fullName
lineTitle = sampleName
if sample.dataType == "observation":
boxVol = vp.getSurveyProps(sample.maskFile,
sample.zBoundary[0], sample.zBoundary[1],
sample.zRange[0], sample.zRange[1], "all",
selectionFuncFile=None)[0]
else:
boxVol = sample.boxLen*sample.boxLen*(sample.zBoundaryMpc[1] -
sample.zBoundaryMpc[0])
boxVol *= 1.e-9
filename = workDir+"/sample_"+sampleName+"/untrimmed_centers_"+dataPortion+"_"+\
sampleName+".out"
if not os.access(filename, os.F_OK):
print "File not found: ", filename
continue
data = np.loadtxt(filename, comments="#")
if data.ndim == 1:
print " Too few!"
continue
data = data[:,4]
indices = np.arange(0, len(data), 1)
sorted = np.sort(data)
plt.plot(sorted, indices[::-1]/boxVol, '-',
label=lineTitle, color=colorList[iSample],
linewidth=linewidth)
plt.legend(title = "Samples", loc = "upper right")
plt.title(plotTitle)
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
if showPlot:
os.system("display %s" % figDir+"/fig_"+plotName+".png")
# -----------------------------------------------------------------------------
def plotVoidDistribution(workDir=None, sampleList=None, figDir=None,
plotNameBase="dv",
showPlot=False, dataPortion=None, setName=None):
plt.ioff()
maptplotlib.pyplot.switch_backed('Agg')
Nmesh = 256
for (iSample,sample) in enumerate(sampleList):
plt.clf()
plt.xlabel("x (Mpc/h)")
plt.ylabel("y (Mpc/h)")
sampleName = sample.fullName
plotName = plotNameBase+"_"+sampleName
filename = workDir+"/sample_"+sampleName+"/untrimmed_centers_"+dataPortion+"_"+\
sampleName+".out"
if not os.access(filename, os.F_OK):
print "File not found: ", filename
continue
void_file = open(filename,'r')
void_header1 = void_file.readline().split(",")
void_data1 = np.reshape(void_file.read().split(),
(-1,len(void_header1))).astype(np.float32)
void_file.close()
xv = void_data1[:,0:3]
rv = void_data1[:,4]
vv = void_data1[:,6]
dv, wm, ws = xcor.cic(xv, sample.boxLen, Lboxcut = 0., Nmesh = Nmesh)
plt.imshow(np.sum(dv+1,2)/Nmesh,extent=[0,sample.boxLen,0,sample.boxLen],
aspect='equal',
cmap='YlGnBu_r',interpolation='gaussian')
plt.colorbar()
plt.title("Voids: "+sampleName)
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
if showPlot:
os.system("display %s" % figDir+"/fig_"+plotName+".png")

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/plotting/__init__.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/partUtil/__init__.py
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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
@ -17,5 +17,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#+
from plotTools import *
from catalogUtil import *
from plotDefs import *
from plotUtil import *

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/plotting/__init__.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/partUtil/partUtil.py
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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
@ -144,10 +144,11 @@ def loadPartVel(sampleDir):
return partVel
# -----------------------------------------------------------------------------
def getPartTree(sampleDir, partData, boxLen):
def getPartTree(catalog):
with open(sampleDir+"/sample_info.dat", 'rb') as input:
sample = pickle.load(input)
sample = catalog.sampleInfo
partData = catalog.partData
boxLen = catalog.boxLen
periodicLine = getPeriodic(sample)
@ -219,15 +220,21 @@ class Catalog:
zones2Parts = None
void2Zones = None
voids = None
sampleInfo = None
# -----------------------------------------------------------------------------
def loadVoidCatalog(sampleDir):
#print " Loading particle data..."
def loadVoidCatalog(sampleDir, dataPortion="central", loadPart=True):
# loads a void catalog
# sampleDir: path to VIDE output directory
# dataPortion: "central" or "all"
# loadPart: if True, also load particle information
sys.stdout.flush()
catalog = Catalog()
with open(sampleDir+"/sample_info.dat", 'rb') as input:
sample = pickle.load(input)
catalog.sampleInfo = sample
print "Loading info..."
infoFile = sampleDir+"/zobov_slice_"+sample.fullName+".par"
@ -244,32 +251,8 @@ def loadVoidCatalog(sampleDir):
catalog.boxLen[2] = ranges[2][1] - ranges[2][0]
File.close()
print "Loading all particles..."
partData, boxLen, volNorm, isObservationData, ranges = loadPart(sampleDir)
numPartTot = len(partData)
catalog.numPartTot = numPartTot
catalog.part = []
for i in xrange(len(partData)):
catalog.part.append(Bunch(x = partData[i][0],
y = partData[i][1],
z = partData[i][2],
volume = 0,
ra = 0,
dec = 0,
redshift = 0,
uniqueID = 0))
print "Loading volumes..."
volFile = sampleDir+"/vol_"+sample.fullName+".dat"
File = file(volFile)
chk = np.fromfile(File, dtype=np.int32,count=1)
vols = np.fromfile(File, dtype=np.float32,count=numPartTot)
for ivol in xrange(len(vols)):
catalog.part[ivol].volume = vols[ivol] / volNorm
print "Loading voids..."
fileName = sampleDir+"/voidDesc_central_"+sample.fullName+".out"
fileName = sampleDir+"/untrimmed_voidDesc_"+dataPortion+"_"+sample.fullName+".out"
catData = np.loadtxt(fileName, comments="#", skiprows=2)
catalog.voids = []
for line in catData:
@ -283,56 +266,121 @@ def loadVoidCatalog(sampleDir):
voidVol = line[7],
numPart = int(line[8]),
densCon = line[9],
voidProp = line[10],
voidProb = line[10],
radius = pow(line[7]/volNorm*3./4./np.pi, 1./3.),
barycenter = np.zeros((3))))
barycenter = np.zeros((3))
parentID = 0,
treeLevel = 0,
numChildren = 0,
centralDen = 0.,
eigenVals = np.zeros((3)),
eigenVecs = np.zeros((3,3)),
))
print "Read %d voids" % len(catalog.voids)
print "Loading barycenters..."
iLine = 0
for line in open(sampleDir+"/barycenters_central_"+sample.fullName+".out"):
for line in open(sampleDir+"/untrimmed_barycenters_"+dataPortion+"_"+sample.fullName+".out"):
line = line.split()
catalog.voids[iLine].barycenter[0] = float(line[1])
catalog.voids[iLine].barycenter[1] = float(line[2])
catalog.voids[iLine].barycenter[2] = float(line[3])
iLine += 1
print "Loading derived void information..."
iLine = 0
for line in open(sampleDir+"/untrimmed_centers_"+dataPortion+"_"+sample.fullName+".out"):
line = line.split()
catalog.voids[iLine].volume = float(line[6])
catalog.voids[iLine].radius = float(line[4])
catalog.voids[iLine].parentID = float(line[10])
catalog.voids[iLine].treeLevel = float(line[11])
catalog.voids[iLine].numChildren = float(line[12])
catalog.voids[iLine].centralDen = float(line[13])
iLine += 1
print "Loading zone-void membership info..."
zoneFile = sampleDir+"/voidZone_"+sample.fullName+".dat"
catalog.void2Zones = []
File = file(zoneFile)
numZonesTot = np.fromfile(File, dtype=np.int32,count=1)
catalog.numZonesTot = numZonesTot
for iZ in xrange(numZonesTot):
numZones = np.fromfile(File, dtype=np.int32,count=1)
catalog.void2Zones.append(Bunch(numZones = numZones,
zoneIDs = []))
print "Loading shapes..."
iLine = 0
for line in open(sampleDir+"/untrimmed_shapes_"+dataPortion+"_"+sample.fullName+".out"):
line = line.split()
catalog.voids[iLine].eigenVals[0] = float(line[1])
catalog.voids[iLine].eigenVals[1] = float(line[2])
catalog.voids[iLine].eigenVals[2] = float(line[3])
for p in xrange(numZones):
zoneID = np.fromfile(File, dtype=np.int32,count=1)
catalog.void2Zones[iZ].zoneIDs.append(zoneID)
catalog.voids[iLine].eigenVecs[0][0] = float(line[4])
catalog.voids[iLine].eigenVecs[0][1] = float(line[5])
catalog.voids[iLine].eigenVecs[0][2] = float(line[6])
catalog.voids[iLine].eigenVecs[1][0] = float(line[7])
catalog.voids[iLine].eigenVecs[1][1] = float(line[8])
catalog.voids[iLine].eigenVecs[1][2] = float(line[9])
catalog.voids[iLine].eigenVecs[2][0] = float(line[10])
catalog.voids[iLine].eigenVecs[2][1] = float(line[11])
catalog.voids[iLine].eigenVecs[2][2] = float(line[12])
iLine += 1
if loadPart:
print "Loading all particles..."
partData, boxLen, volNorm, isObservationData, ranges = loadPart(sampleDir)
numPartTot = len(partData)
catalog.numPartTot = numPartTot
catalog.partPos = partData
catalog.part = []
for i in xrange(len(partData)):
catalog.part.append(Bunch(x = partData[i][0],
y = partData[i][1],
z = partData[i][2],
volume = 0,
ra = 0,
dec = 0,
redshift = 0,
uniqueID = 0))
print "Loading volumes..."
volFile = sampleDir+"/vol_"+sample.fullName+".dat"
File = file(volFile)
chk = np.fromfile(File, dtype=np.int32,count=1)
vols = np.fromfile(File, dtype=np.float32,count=numPartTot)
for ivol in xrange(len(vols)):
catalog.part[ivol].volume = vols[ivol] / volNorm
print "Loading zone-void membership info..."
zoneFile = sampleDir+"/voidZone_"+sample.fullName+".dat"
catalog.void2Zones = []
File = file(zoneFile)
numZonesTot = np.fromfile(File, dtype=np.int32,count=1)
catalog.numZonesTot = numZonesTot
for iZ in xrange(numZonesTot):
numZones = np.fromfile(File, dtype=np.int32,count=1)
catalog.void2Zones.append(Bunch(numZones = numZones,
zoneIDs = []))
for p in xrange(numZones):
zoneID = np.fromfile(File, dtype=np.int32,count=1)
catalog.void2Zones[iZ].zoneIDs.append(zoneID)
print "Loading particle-zone membership info..."
zonePartFile = sampleDir+"/voidPart_"+sample.fullName+".dat"
catalog.zones2Parts = []
File = file(zonePartFile)
chk = np.fromfile(File, dtype=np.int32,count=1)
numZonesTot = np.fromfile(File, dtype=np.int32,count=1)
for iZ in xrange(numZonesTot):
numPart = np.fromfile(File, dtype=np.int32,count=1)
catalog.zones2Parts.append(Bunch(numPart = numPart,
partIDs = []))
print "Loading particle-zone membership info..."
zonePartFile = sampleDir+"/voidPart_"+sample.fullName+".dat"
catalog.zones2Parts = []
File = file(zonePartFile)
chk = np.fromfile(File, dtype=np.int32,count=1)
numZonesTot = np.fromfile(File, dtype=np.int32,count=1)
for iZ in xrange(numZonesTot):
numPart = np.fromfile(File, dtype=np.int32,count=1)
catalog.zones2Parts.append(Bunch(numPart = numPart,
partIDs = []))
for p in xrange(numPart):
partID = np.fromfile(File, dtype=np.int32,count=1)
catalog.zones2Parts[iZ].partIDs.append(partID)
for p in xrange(numPart):
partID = np.fromfile(File, dtype=np.int32,count=1)
catalog.zones2Parts[iZ].partIDs.append(partID)
return catalog
# -----------------------------------------------------------------------------
def getVoidPart(catalog, voidID):
@ -346,3 +394,22 @@ def getVoidPart(catalog, voidID):
return partOut
# -----------------------------------------------------------------------------
def filterVoidsOnSize(catalog, rMin):
catalog.voids = catalog.voids[ catalog.voids[:].radius >= rMin ]
return catalog
# -----------------------------------------------------------------------------
def filterVoidsOnTreeLevel(catalog, level):
catalog.voids = catalog.voids[ catalog.voids[:].treeLevel == level ]
if level == -1:
catalog.voids = catalog.voids[ catalog.voids[:].numChildren == 0 ]
return catalog
# -----------------------------------------------------------------------------
def filterVoidsOnCentralDen(catalog, maxCentralDen):
catalog.voids = catalog.voids[ catalog.voids[:].centralDen <= maxCentralDen ]
return catalog

View file

@ -0,0 +1,110 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/plotting/plotTools.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.
#+
__all__=['plotNumberFunction',]
from void_python_tools.backend.classes import *
from plotDefs import *
import numpy as np
import os
import pylab as plt
import void_python_tools.apTools as vp
def fill_between(x, y1, y2=0, ax=None, **kwargs):
"""Plot filled region between `y1` and `y2`.
This function works exactly the same as matplotlib's fill_between, except
that it also plots a proxy artist (specifically, a rectangle of 0 size)
so that it can be added it appears on a legend.
"""
ax = ax if ax is not None else plt.gca()
ax.fill_between(x, y1, y2, interpolate=True, **kwargs)
p = plt.Rectangle((0, 0), 0, 0, **kwargs)
ax.add_patch(p)
# -----------------------------------------------------------------------------
def plotNumberFunction(catalogList, figDir="./",
plotName="numberfunc",
dataPortion="central"):
print "Plotting number function"
plt.clf()
plt.xlabel("$R_{eff}$ [$h^{-1}Mpc$]", fontsize=14)
plt.ylabel(r"log ($n$ (> R) [$h^3$ Gpc$^{-3}$])", fontsize=14)
for (iSample,catalog) in enumerate(catalogList):
sample = catalog.sampleInfo
data = catalog.voids[:].radius
if sample.dataType == "observation":
maskFile = sample.maskFile
boxVol = vp.getSurveyProps(maskFile,
sample.zBoundary[0], sample.zBoundary[1],
sample.zRange[0], sample.zRange[1], "all",
selectionFuncFile=None)[0]
#selectionFuncFile=sample.selFunFile)[0]
boxVol *= obsFudgeFactor
else:
boxVol = sample.boxLen*sample.boxLen*(sample.zBoundaryMpc[1] -
sample.zBoundaryMpc[0])
boxVol *= 1.e-9 # Mpc->Gpc
bins = args.xmax/5.
hist, binEdges = np.histogram(data, bins=bins, range=(0., 100.))
binCenters = 0.5*(binEdges[1:] + binEdges[:-1])
nvoids = len(data)
var = hist * (1. - hist/nvoids)
sig = np.sqrt(var)
lowerbound = hist - sig
upperbound = hist + sig
mean = np.log10(hist/boxVol)
lowerbound = np.log10(lowerbound/boxVol)
upperbound = np.log10(upperbound/boxVol)
lineColor = colorList[iSample]
lineTitle = sample.fullName
trim = (bounds[0] > .01)
mean = mean[trim]
binCentersToUse = binCenters[trim]
lower = lowerbound[trim]
upper = upperbound[trim]
alpha = 0.55
fill_between(binCentersToUse, lower, upper,
label=lineTitle, color=lineColor,
alpha=alpha,
)
lineStyle = '-'
plt.plot(binCentersToUse, mean, lineStyle,
color=lineColor,
linewidth=3)
plt.legend(loc = "upper right", fancybox=True, prop={'size':14})
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")

View file

@ -1,7 +1,7 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/plotting/__init__.py
# Copyright (C) 2010-2013 Guilhem Lavaux
# Copyright (C) 2011-2013 P. M. Sutter
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/xcor/__init__.py
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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

View file

@ -1,3 +1,22 @@
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_python_tools/xcor/xcorlib.py
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 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.
#+
import numpy as np
def cic( x, Lbox, Lboxcut = 0, Nmesh = 128, weights = None ):