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.computeCenterMethod
computeCenter(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 (see Simulation).
    • :snap_data -> ::Snapshot (see Snapshot).
    • :gc_data -> ::GroupCatalog (see GroupCatalog).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • ...
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • ...
  • subhalo_abs_idx::Int: Absolute index of the target subhalo (subfind). Starts at 1.

Returns

  • The specified potential minimum.
source
GalaxyInspector.computeCenterMethod
computeCenter(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 (see Simulation).
    • :snap_data -> ::Snapshot (see Snapshot).
    • :gc_data -> ::GroupCatalog (see GroupCatalog).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • ...
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • ...
  • 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 of PARTICLE_INDEX.
    • :zero -> Origin.

Returns

  • The specified center of mass.
source
GalaxyInspector.computeCenterMethod
computeCenter(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 (see Simulation).
    • :snap_data -> ::Snapshot (see Snapshot).
    • :gc_data -> ::GroupCatalog (see GroupCatalog).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • ...
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • ...
  • 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.
source
GalaxyInspector.computeCenterOfMassMethod
computeCenterOfMass(
    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.
source
GalaxyInspector.computeDistanceMethod
computeDistance(
    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 to nothing, 0 is used.

Returns

  • The distance of every point to center.
source
GalaxyInspector.computeGlobalCenterOfMassMethod
computeGlobalCenterOfMass(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 (see Simulation).
    • :snap_data -> ::Snapshot (see Snapshot).
    • :gc_data -> ::GroupCatalog (see GroupCatalog).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • ...
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • ...

Returns

  • The center of mass.
source
GalaxyInspector.findHaloSubhaloMethod
findHaloSubhalo(
    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 (see Simulation).
    • :snap_data -> ::Snapshot (see Snapshot).
    • :gc_data -> ::GroupCatalog (see GroupCatalog).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • ...
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • ...
  • star_idxs::Vector{Int}: Indices of the target stars in data_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).
source
GalaxyInspector.locateStellarBirthPlaceMethod
locateStellarBirthPlace(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 (see Simulation).
    • :snap_data -> ::Snapshot (see Snapshot).
    • :gc_data -> ::GroupCatalog (see GroupCatalog).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • cell/particle type -> (block -> data of block, block -> data of block, ...).
    • ...
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • groupcat type -> (block -> data of block, block -> data of block, ...).
    • ...

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).
source