Reference
PhaseSpaceDTFE.PhaseSpaceDTFEPhaseSpaceDTFE.BVHPhaseSpaceDTFE.BVHPhaseSpaceDTFE.PS_DTFEPhaseSpaceDTFE.PS_DTFE_subboxPhaseSpaceDTFE.SimBoxPhaseSpaceDTFE.DTFE_periodicPhaseSpaceDTFE.DTFE_periodicPhaseSpaceDTFE.PS_DTFE_periodicPhaseSpaceDTFE.PS_DTFE_periodicPhaseSpaceDTFE.densityPhaseSpaceDTFE.density_subboxPhaseSpaceDTFE.findBoxPhaseSpaceDTFE.findCandidateSimplicesPhaseSpaceDTFE.findIntersectionsPhaseSpaceDTFE.framePhaseSpaceDTFE.frame_velocitiesPhaseSpaceDTFE.get_coords_in_subboxPhaseSpaceDTFE.get_subbox_estimatorPhaseSpaceDTFE.get_subbox_estimatorPhaseSpaceDTFE.get_subboxesPhaseSpaceDTFE.inSimplicesPhaseSpaceDTFE.intersectionPhaseSpaceDTFE.numberOfStreamsPhaseSpaceDTFE.numberOfStreams_subboxPhaseSpaceDTFE.ps_dtfe_subboxPhaseSpaceDTFE.ps_dtfe_subboxPhaseSpaceDTFE.translatePhaseSpaceDTFE.unwrap_sPhaseSpaceDTFE.unwrap_x_PhaseSpaceDTFE.velocityPhaseSpaceDTFE.velocitySumPhaseSpaceDTFE.velocitySum_subboxPhaseSpaceDTFE.velocity_subboxPhaseSpaceDTFE.volume
PhaseSpaceDTFE.PhaseSpaceDTFE — Module
The density and velocity fields of an N-body simulation are estimated with the Phase-Space Delaunay Tessellation Field Estimator implemented in Julia. This code accompanies the publication "Phase-Space Delaunay Tesselation Field Estimator", by Job Feldbrugge, 2024. (https://academic.oup.com/mnras/article/536/1/807/7915986).PhaseSpaceDTFE.BVH — Type
BVH(data, box, depth, left, right)A Bounding Volume Hierarchy (BVH) tree structure on a set of geometric objects.
PhaseSpaceDTFE.BVH — Method
BVH(data, box::Matrix{Float64}, points::Matrix{Float64}, simplices, depth::Int)Generates a Bounding Volume Hierarchy (BVH) tree structure.
PhaseSpaceDTFE.PS_DTFE — Type
PS_DTFE(positions_initial, positions, velocities, m, depth, box)Generates an Phase-Space DTFE object given the initial positions, final positions and velocities of an N-body simulation. The Boundary Volume Hirarchy goes depth levels deep. The PS_DTFE-object contains:
rho::Vector{Float64}
Drho::Matrix{Float64}
Dv::Array{Float64}
tree::BVH
simplices::Matrix{Int}
positions::Matrix{Float64}
velocities::Matrix{Float64}
positions_initial::Matrix{Float64}PhaseSpaceDTFE.PS_DTFE_subbox — Type
PS_DTFE_subboxPhase-Space DTFE subbox object containing
N_sub::Int64
N_target::Int64
m::Float64
depth::Int64
dir::String
L::Float64
Ni::Int64PhaseSpaceDTFE.SimBox — Type
SimBox(L, Ni)Holds the size L of the simulation box and the particle number Ni per side length.
Examples
julia> SimBox(100, 64)
SimBox(100.0, 64)PhaseSpaceDTFE.DTFE_periodic — Method
DTFE_periodic(coords_q, coords_x, m, depth, sim_box; pad=0.05)Constructs the DTFE-object from the final positions coords_x assuming periodic boundary conditions. These are Float64 matrices of size (N,3). m is the particle mass, a single Float64 or a matching matrix (N, 3). pad specifies the framing width in units of L.
PhaseSpaceDTFE.DTFE_periodic — Method
DTFE_periodic(coords_q, coords_x, velocities, m, depth, sim_box; pad=0.05)Constructs the DTFE-object from the final positions coords_x and velocities velocities assuming periodic boundary conditions. These are Float64 matrices of size (N,3). m is the particle mass, a single Float64 or a matching matrix (N, 3). pad specifies the framing width in units of L.
PhaseSpaceDTFE.PS_DTFE_periodic — Method
PS_DTFE_periodic(coords_q, coords_x, m, depth, sim_box; pad=0.05)Constructs the PS-DTFE-object from the initial positions coords_q and final positions coords_x assuming periodic boundary conditions. These are Float64 matrices of size (N,3). m is the particle mass, a single Float64 or a matching matrix (N, 3). pad specifies the framing width in units of L.
PhaseSpaceDTFE.PS_DTFE_periodic — Method
PS_DTFE_periodic(coords_q, coords_x, velocities, m, depth, sim_box; pad=0.05)Constructs the PS-DTFE-object from the initial positions coords_q, final positions coords_x and velocities velocities assuming periodic boundary conditions. These are Float64 matrices of size (N,3). m is the particle mass, a single Float64 or a matching matrix (N, 3). pad specifies the framing width in units of L.
PhaseSpaceDTFE.density — Method
density(p::Vector{Float64}, estimator::PS_DTFE)Evaluate the Phase-Space DTFE density estimate in the point p.
PhaseSpaceDTFE.density_subbox — Method
density_subbox(coords_arr, ps_dtfe_sb)Evaluate the Phase-Space DTFE density estimates in given coordinates coords_arr from the PS_DTFE_subbox object ps_dtfe_sb. coords_arr can be of any shape (..., 3).
PhaseSpaceDTFE.findBox — Method
findBox(p::Vector{Float64}, BVH_tree::BVH)Find the box in the Bounding Volume Hierarchy containing the point p.
PhaseSpaceDTFE.findCandidateSimplices — Method
findCandidateSimplices(p::Vector{Float64}, BVH_tree::BVH)Given a Bounding Volume Hierarchy, find a set candidate simplices that may contain the point p. The function outputs the indices of the candidate simplices.
PhaseSpaceDTFE.findIntersections — Method
findIntersections(p::Vector{Float64}, BVH_tree::BVH, points, simplices)Find the indices of the simplices that intersect the point p.
PhaseSpaceDTFE.frame — Function
frame(coords_q, coords_x, L, pad=0.05)Cosmological N-body simulations normally work with periodic boundary conditions. This function adds a frame of periodic particle positions around the simulation box to implement periodicity in the Delaunay tesselation. pad specifies the width of the frame in units of the simulation box size L.
PhaseSpaceDTFE.frame_velocities — Function
frame_velocities(coords_x, velocities, L, pad=0.05)Cosmological N-body simulations normally work with periodic boundary conditions. This function adds a frame of velocities (corresponding to the periodic particle positions) around the simulation box to implement periodicity in the Delaunay tesselation. pad specifies the width of the frame in units of the simulation box size L.
PhaseSpaceDTFE.get_coords_in_subbox — Method
get_coords_in_subbox(coords, idx, N_sub, L)From a given coordinates array coords, get those coordinates contained in subbox number idx.
PhaseSpaceDTFE.get_subbox_estimator — Method
get_subbox_estimator(coords_q, coords_x, velocities, idx, N_sub, m, depth, sim_box::SimBox; pad=0.05, dir="./ps_dtfe")Construct the Phase-Space DTFE object for given coordinates and velocities. Called for each subbox estimator construction.
PhaseSpaceDTFE.get_subbox_estimator — Method
get_subbox_estimator(coords_q, coords_x, idx, N_sub, m, depth, sim_box::SimBox; pad=0.05, dir="./ps_dtfe")Obtain the subbox estimator associated to a given position.
PhaseSpaceDTFE.get_subboxes — Method
get_subboxes(ps_dtfe_sub::PS_DTFE_subbox)Get all subbox indices.
PhaseSpaceDTFE.inSimplices — Method
inSimplices(p::Vector{Float64}, estimator::PS_DTFE)Find the simplices in the Eulerian-evolved tesselation that contain the point p.
PhaseSpaceDTFE.intersection — Method
intersection(p::Vector{Float64}, simplex)Check whether the point p is contained in the simplex.
PhaseSpaceDTFE.numberOfStreams — Method
numberOfStreams(p::Vector{Float64}, estimator::PS_DTFE)Evaluates the number of incoming streams in point in the point p.
PhaseSpaceDTFE.numberOfStreams_subbox — Method
numberOfStreams_subbox(coords_arr, ps_dtfe_sb)Evaluate the number of streams field in given coordinates coords_arr from the PS_DTFE_subbox object ps_dtfe_sb. coords_arr can be of any shape (..., 3).
PhaseSpaceDTFE.ps_dtfe_subbox — Method
ps_dtfe_subbox(coords_q, coords_x, velocities, m, depth, sim_box::SimBox; N_target=128, pad=0.05, dir="./ps_dtfe")Construct the Phase-Space DTFE subbox estimator given the initial positions coords_q, final positions coords_x and velocities velocities of an N-body simulation, assuming periodic boundary positions. The Boundary Volume Hirarchy goes depth levels deep. For data types, see documentation of PS_DTFE_periodic(). The keyword argument N_target=128 specifies the number of particles (N_target^3) per subbox. pad is the framing width in units of L. dir is the data storage directory.
PhaseSpaceDTFE.ps_dtfe_subbox — Method
ps_dtfe_subbox(coords_q, coords_x, m, depth, sim_box::SimBox; N_target=128, pad=0.05, dir="./ps_dtfe")Construct the Phase-Space DTFE subbox estimator given the initial positions coords_q and final positions coords_x of an N-body simulation, assuming periodic boundary positions. The Boundary Volume Hirarchy goes depth levels deep. For data types, see documentation of PS_DTFE_periodic(). The keyword argument N_target=128 specifies the number of particles (N_target^3) per subbox. pad is the framing width in units of L. dir is the data storage directory.
PhaseSpaceDTFE.translate — Method
translate(coords_q, coords_x, L)Cosmological N-body simulations normally work with periodic boundary conditions. This function shifts both the initial and final positions of the particles such that they are located in the simulation box in Eulerian space.
PhaseSpaceDTFE.unwrap_s — Method
unwrap_s(s, L)Cosmological N-body simulations normally work with periodic boundary conditions. This function undoes the wrapping of particles around the box in the displacement field, assuming the particles did not travel more than half the size of the box.
PhaseSpaceDTFE.unwrap_x_ — Method
unwrap_x_(q, x, L)Cosmological N-body simulations normally work with periodic boundary conditions. This function undoes the wrapping of particles around the box, assuming the particles did not travel more than half the size of the box.
PhaseSpaceDTFE.velocity — Function
velocity(p::Vector{Float64}, estimator::PS_DTFE, single_stream=false)Evaluate the Phase-Space DTFE velocity estimate in the point p. Returns a matrix of size (n, 3) for n stream velocities ((1,3) in single-stream regions, (n, 3) otherwise). If single_stream=true, returns [NaN NaN NaN] in multistream regions.
PhaseSpaceDTFE.velocitySum — Method
velocitySum(p::Vector{Float64}, estimator::PS_DTFE)Evaluate the stream-mass weighted sum of the Phase-Space DTFE velocities estimates for the individual streams in the point p.
PhaseSpaceDTFE.velocitySum_subbox — Method
velocitySum_subbox(coords_arr, ps_dtfe_sb)Evaluate the stream-mass weighted sum of the Phase-Space DTFE stream velocity estimates in given coordinates coords_arr from the PS_DTFE_subbox object ps_dtfe_sb. coords_arr can be of any shape (..., 3).
PhaseSpaceDTFE.velocity_subbox — Method
velocity_subbox(coords_arr, ps_dtfe_sb)Evaluate the Phase-Space DTFE velocity estimates in given coordinates coords_arr from the PS_DTFE_subbox object ps_dtfe_sb. coords_arr can be of any shape (..., 3). In the current code release, [NaN NaN NaN] is returned in multistream regions, i.e. individual stream velocities are not supported.
PhaseSpaceDTFE.volume — Method
volume(sim, points)Evaluate the volume of the simplex sim.