Coordinate transformation functions

These functions are used internally and none are exported.

These functions depend on the particulars of the simulation code (e.g. units).


GalaxyInspector.computeAMRotationMatrixMethod
computeAMRotationMatrix(
    positions::Matrix{<:Unitful.Length},
    velocities::Matrix{<:Unitful.Velocity},
    masses::Vector{<:Unitful.Mass},
)::Union{Matrix{Float64},UniformScaling{Bool}}

Compute the rotation matrix that will turn the total angular momentum into the z axis; when view as an active (alibi) transformation.

Arguments

  • positions::Matrix{<:Unitful.Length}: Positions of the cells/particles. Each column is a cell/particle and each row a dimension.
  • velocities::Matrix{<:Unitful.Velocity}: Velocities of the cells/particles. Each column is a cell/particle and each row a dimension.
  • masses::Vector{<:Unitful.Mass}: Mass of every cell/particle.

Returns

  • The rotation matrix.
source
GalaxyInspector.computeGlobalAMRotationMatrixMethod
computeGlobalAMRotationMatrix(data_dict::Dict)::Union{Matrix{Float64},UniformScaling{Bool}}

Compute the rotation matrix that will turn the total angular momentum of the whole system, into the z axis; when view as an active (alibi) transformation.

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 rotation matrix.
source
GalaxyInspector.computePARotationMatrixMethod
computePARotationMatrix(
    positions::Matrix{<:Unitful.Length},
    velocities::Matrix{<:Unitful.Velocity},
    masses::Vector{<:Unitful.Mass},
)::Union{Matrix{Float64},UniformScaling{Bool}}

Compute the rotation matrix that will turn the principal axis into the new coordinate system; when view as an passive (alias) transformation.

Arguments

  • positions::Matrix{<:Unitful.Length}: Positions of the cells/particles. Each column is a cell/particle and each row a dimension.
  • velocities::Matrix{<:Unitful.Velocity}: Velocities of the cells/particles. Each column is a cell/particle and each row a dimension.
  • masses::Vector{<:Unitful.Mass}: Mass of every cell/particle.

Returns

  • The rotation matrix.
source
GalaxyInspector.rotateData!Method
rotateData!(data_dict::Dict, rotation::Int)::Nothing

Rotate the positions and velocities of the cells/particles in data_dict.

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, ...).
    • ...
  • rotation::Int: Target subhalo absolute index, starting at 1. Sets the principal axis of the stars in the subhalo as the new coordinate system.

source
GalaxyInspector.rotateData!Method
rotateData!(data_dict::Dict, axis_type::Symbol)::Nothing

Rotate the positions and velocities of the cells/particles in data_dict.

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, ...).
    • ...
  • rotation::Symbol: Type of rotation. The options are:

    • :zero -> No rotation is applied.
    • :global_am -> Sets the angular momentum of the whole system as the new z axis.
    • :stellar_am -> Sets the stellar angular momentum as the new z axis.
    • :stellar_pa -> Sets the stellar principal axis as the new coordinate system.
    • :stellar_subhalo_pa -> Sets the principal axis of the stars in the main subhalo as the new coordinate system.
source
GalaxyInspector.rotateData!Method
rotateData!(data_dict::Dict, rotation::NTuple{2,Int})::Nothing

Rotate the positions and velocities of the cells/particles in data_dict.

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, ...).
    • ...
  • rotation::NTuple{2,Int}: Type of rotation. The options are:

    • (halo_idx, subhalo_rel_idx) -> Sets the principal axis of the stars in subhalo_rel_idx::Int subhalo (of the halo_idx::Int halo) as the new coordinate system.
    • (halo_idx, 0) -> Sets the principal axis of the stars in the halo_idx::Int halo as the new coordinate system.
source
GalaxyInspector.translateData!Method
translateData!(data_dict::Dict, translation::Union{Symbol,NTuple{2,Int},Int})::Nothing

Translate the positions and velocities of the cells/particles in data_dict.

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, ...).
    • ...
  • translation::Union{Symbol,NTuple{2,Int},Int}=:zero: Type of translation. The options are:

    • :zero -> No translation is applied.
    • :global_cm -> Sets the center of mass of the whole system as the new origin.
    • :{component} -> Sets the center of mass of the given component (e.g. :stars, :gas, :halo, etc) as the new origin. It can be any of the keys of PARTICLE_INDEX.
    • (halo_idx, subhalo_rel_idx) -> Sets the position of the potential minimum for the subhalo_rel_idx::Int subhalo (of the halo_idx::Int halo) as the new origin.
    • (halo_idx, 0) -> Sets the center of mass of the halo_idx::Int halo as the new origin.
    • subhalo_abs_idx -> Sets the center of mass of the subhalo_abs_idx::Int as the new origin.
source
GalaxyInspector.translatePoints!Method
function translatePoints!(positions::Matrix{<:Number}, new_origin::Vector{<:Number})::Nothing

Translate a system of points, moving new_origin to the origin.

Arguments

  • positions::Matrix{<:Number}: Points to be translated. Each column is a point and each row a dimension.
  • new_origin::Vector{<:Number}: Target origin.

Returns

  • Matrix with the translated points.
source