vide_public/examples/example_observation/example_observation.py
Paul M. Sutter 3dce2593d9 Implemented (yet another) new boundary handling scheme, whereby we scan radially along survey edge while flagging nearest galaxies. The prepObservation routine was significantly cleaned up to accommodate this, but it was ultimately implemented in python (surveyTools.py) for ease of prototyping, with the intent to move it back into C later.
Some general housekeeping, making sure some new parameters are passed around correctly, and removing the storage of some unused files.

This update is considered HIGHLY UNSTABLE. It will almost certainly break somewhere for simulations.

Still under active development.
2025-01-07 20:04:29 +08:00

127 lines
4.3 KiB
Python

#!/usr/bin/env python
#+
# VIDE -- Void IDentification and Examination -- ./python_tools/void_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
# 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 os
import numpy as np
from backend.classes import *
# if True, will scan log files for last known completed state and run from there
continueRun = False
# stages:
# 1 : extract redshift slices from data
# 2 : void extraction using zobov
# 3 : removal of small voids and voids near the edge
startCatalogStage = 2
endCatalogStage = 3
basePath = os.path.dirname(os.path.abspath(__file__))
# directory for input data files
inputDataDir = basePath
# void catalog output directory
workDir = basePath
# output directory for log files
logDir = os.path.join(workDir,"logs","example_observation")
# output directory for figures
figDir = os.path.join(workDir,"figs","example_observation")
# optimization: maximum number of parallel threads to use
numZobovThreads = 2
# optimization: number of subdivisions of the volume
numZobovDivisions = 2
# Maximum density for merging voids
# 0 (equivalent to infinitely large value) -> Merge everything (no threshold)
# 1e-9 (or smaller != 0) -> Do not merge anything
mergingThreshold = 1e-9
# when trimming away voids near the bounaries, what multiple of the radius to
# use for safety
boundaryTolerance = 1.0
# don't change this
dataSampleList = []
# define your data samples
newSample = Sample(
# path to galaxy file is inputDataDir+dataFile
dataFile = "example_observation.dat",
# full name for this sample
fullName = "example_observation",
# a convenient nickname
nickName = "exobs",
# don't change this or nothing will make sense
dataType = "observation",
# assume sample is volume-limited?
volumeLimited = True,
# HEALpix mask file - set to None to auto-compute
# NOTE: auto-computed masks are pretty terrible, so
# only do that if you have no other options
#maskFile = "",
maskFile = inputDataDir+"/example_observation_mask.fits",
# resolution for HEALpix mapping of survey edge contours
# Set to -1 to use nside from given fits file
# MUST be set if auto-computing mask
nsideForContour = 128,
# radial selection function (if not volume limited)
selFunFile = None,
# max and min redshifts of galaxies in your sample
zBoundary = (0.0, 0.15),
# max and min redshifts where you want to find voids
zRange = (0.1, 0.15),
# width of redshift boundaries to flag edge galaxies
# (interpreted as boundaryWidth*(zMax-zMin))
boundaryWidth = 0.01,
# leave this at -1 for mean particle separation,
# or specify your own in Mpc/h
minVoidRadius = -1,
# density of mock particles in cubic Mpc/h
# (make this as high as you can afford)
### DEPRECATED
fakeDensity = 0.05,
# if true, convert to comoving space using LCDM cosmology
useComoving = True,
# cosmology assuming flat universe
omegaM = 0.3,
)
dataSampleList.append(newSample)
# repeat the above block for any other samples