Computation of characteristic positions
These functions are used internally and none are exported.
These functions depend on the particulars of the simulation code (e.g. units).
GalaxyInspector.computeCenter
— MethodcomputeCenter(data_dict::Dict, subhalo_abs_idx::Int)::Vector{<:Unitful.Length}
Read the position of the potential minimum of a given subhalo.
Arguments
data_dict::Dict
: A dictionary with the following shape::sim_data
-> ::Simulation (seeSimulation
).:snap_data
-> ::Snapshot (seeSnapshot
).:gc_data
-> ::GroupCatalog (seeGroupCatalog
).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
subhalo_abs_idx::Int
: Absolute index of the target subhalo (subfind). Starts at 1.
Returns
- The specified potential minimum.
GalaxyInspector.computeCenter
— MethodcomputeCenter(data_dict::Dict, cm_type::Symbol)::Vector{<:Unitful.Length}
Compute a characteristic center for the system.
Arguments
data_dict::Dict
: A dictionary with the following shape::sim_data
-> ::Simulation (seeSimulation
).:snap_data
-> ::Snapshot (seeSnapshot
).:gc_data
-> ::GroupCatalog (seeGroupCatalog
).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
cm_type::Symbol
: It can be::global_cm
-> Center of mass of the whole system.:{component}
-> Center of mass of the given component (e.g. :stars, :gas, :halo, etc). It can be any of the keys ofPARTICLE_INDEX
.:zero
-> Origin.
Returns
- The specified center of mass.
GalaxyInspector.computeCenter
— MethodcomputeCenter(data_dict::Dict, subfind_idx::NTuple{2,Int})::Vector{<:Unitful.Length}
Read the position of the particle/cell at the potential minimum of a given halo or subhalo.
Arguments
data_dict::Dict
: A dictionary with the following shape::sim_data
-> ::Simulation (seeSimulation
).:snap_data
-> ::Snapshot (seeSnapshot
).:gc_data
-> ::GroupCatalog (seeGroupCatalog
).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
subfind_idx::NTuple{2,Int}
: Tuple with two elements:- Index of the target halo (FoF group). Starts at 1.
- Index of the target subhalo (subfind), relative to the target halo. Starts at 1. If it is set to 0, the potential minimum of the halo with index
halo_idx
is returned.
Returns
- The position of the potential minimum.
GalaxyInspector.computeCenterOfMass
— MethodcomputeCenterOfMass(
positions::Matrix{<:Unitful.Length},
mass::Vector{<:Unitful.Mass},
)::Vector{<:Unitful.Length}
Compute the center of mass of a group of cells/particles.
Arguments
positions::Matrix{<:Unitful.Length}
: Positions of the cells/particles. Each column is a cell/particle and each row a dimension.masses::Vector{<:Unitful.Mass}
: Masses of the cells/particles.
Returns
- The center of mass.
GalaxyInspector.computeDistance
— MethodcomputeDistance(
positions::Matrix{<:Number};
<keyword arguments>
)::Vector{<:Number}
Compute the distance of a group of points to center
.
Arguments
positions::Matrix{<:Number}
: Positions of the points. Each column is a point and each row a dimension.center::Union{Vector{<:Number},Nothing}=nothing
: Origin used to compute the distances. If set tonothing
, 0 is used.
Returns
- The distance of every point to
center
.
GalaxyInspector.computeGlobalCenterOfMass
— MethodcomputeGlobalCenterOfMass(data_dict::Dict)::Vector{<:Unitful.Length}
Compute the center of mass of the whole system.
Arguments
data_dict::Dict
: A dictionary with the following shape::sim_data
-> ::Simulation (seeSimulation
).:snap_data
-> ::Snapshot (seeSnapshot
).:gc_data
-> ::GroupCatalog (seeGroupCatalog
).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
Returns
- The center of mass.
GalaxyInspector.findHaloSubhalo
— MethodfindHaloSubhalo(
data_dict::Dict,
star_idxs::Vector{Int},
real_stars_idxs::Vector{Bool},
)::NTuple{2,Vector{Int}}
Find in which halo and subhalo of data_dict
each star in star_idxs
was born.
For stars with no halo or subhalo, an index of -1 is given. The subhalo index is relative to the corresponding halo.
Arguments
data_dict::Dict
: A dictionary with the following shape::sim_data
-> ::Simulation (seeSimulation
).:snap_data
-> ::Snapshot (seeSnapshot
).:gc_data
-> ::GroupCatalog (seeGroupCatalog
).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
star_idxs::Vector{Int}
: Indices of the target stars indata_dict
.real_stars_idxs::Vector{Bool}
: Boolean list of stellar particles. True for a real star and false for a wind particle.
Returns
A tuple with two elements:
- A vector with the birth halo (index starting at 1) of each star (in the order of
star_idxs
). - A vector with the birth subhalo (index starting at 1) of each star (in the order of
star_idxs
).
- A vector with the birth halo (index starting at 1) of each star (in the order of
GalaxyInspector.locateStellarBirthPlace
— MethodlocateStellarBirthPlace(data_dict::Dict)::NTuple{2,Vector{Int}}
Find in which halo and subhalo each star in data_dict
was born.
For stars with no halo or subhalo, an index of -1 is given. The subhalo index is relative to the corresponding halo.
Arguments
data_dict::Dict
: A dictionary with the following shape::sim_data
-> ::Simulation (seeSimulation
).:snap_data
-> ::Snapshot (seeSnapshot
).:gc_data
-> ::GroupCatalog (seeGroupCatalog
).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
Returns
A tuple with two elements:
- A vector with the birth halo (index starting at 1) of each star (in the order of
data_dict
). - A vector with the birth subhalo (index starting at 1) of each star (in the order of
data_dict
).
- A vector with the birth halo (index starting at 1) of each star (in the order of