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.computeAMRotationMatrix
— MethodcomputeAMRotationMatrix(
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.
GalaxyInspector.computeGlobalAMRotationMatrix
— MethodcomputeGlobalAMRotationMatrix(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 (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 rotation matrix.
GalaxyInspector.computePARotationMatrix
— MethodcomputePARotationMatrix(
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.
GalaxyInspector.rotateData!
— MethodrotateData!(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 (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
, ...).- ...
rotation::Int
: Target subhalo absolute index, starting at 1. Sets the principal axis of the stars in the subhalo as the new coordinate system.
GalaxyInspector.rotateData!
— MethodrotateData!(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 (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
, ...).- ...
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.
GalaxyInspector.rotateData!
— MethodrotateData!(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 (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
, ...).- ...
rotation::NTuple{2,Int}
: Type of rotation. The options are:(halo_idx, subhalo_rel_idx)
-> Sets the principal axis of the stars insubhalo_rel_idx::Int
subhalo (of thehalo_idx::Int
halo) as the new coordinate system.(halo_idx, 0)
-> Sets the principal axis of the stars in thehalo_idx::Int
halo as the new coordinate system.
GalaxyInspector.translateData!
— MethodtranslateData!(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 (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
, ...).- ...
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 ofPARTICLE_INDEX
.(halo_idx, subhalo_rel_idx)
-> Sets the position of the potential minimum for thesubhalo_rel_idx::Int
subhalo (of thehalo_idx::Int
halo) as the new origin.(halo_idx, 0)
-> Sets the center of mass of thehalo_idx::Int
halo as the new origin.subhalo_abs_idx
-> Sets the center of mass of thesubhalo_abs_idx::Int
as the new origin.
GalaxyInspector.translatePoints!
— Methodfunction 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.