Filter functions
These functions are used internally and none are exported.
These functions depend on the particulars of the simulation code (e.g. units).
GalaxyInspector.filterByBirthPlace
— MethodfilterByBirthPlace(
data_dict::Dict,
exclude::Symbol;
<keyword arguments>
)::Dict{Symbol,IndexType}
Filter out stars that were born either outside the given halo and subhalo (exclude
= :exsitu), or inside (exclude
= :insitu).
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
, ...).- ...
exclude::Symbol
: Which stars will be filtered out, either the ones born outside the given halo and subhalo (:exsitu), or inside (:insitu).halo_idx::Int=1
: Index of the target halo (FoF group). Starts at 1.subhalo_rel_idx::Int=1
: Index of the target subhalo (subfind), relative to the target halo. Starts at 1. If it is set to 0, all subhalos of the target halo are considered in-situ.
Returns
A dictionary with the following shape:
cell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexType- ...
GalaxyInspector.filterByELSFR
— MethodfilterByELSFR(data_dict::Dict)::Dict{Symbol,IndexType}
Filter out gas cells that have not entered our star formation routine.
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 dictionary with the following shape:
cell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexType- ...
GalaxyInspector.filterByQuantity
— MethodfilterByQuantity(
data_dict::Dict,
quantity::Symbol,
component::Symbol,
minimum::Number,
maximum::Number,
)::Dict{Symbol,IndexType}
Filter out particles/cells with quantity
outside the range [minimum
, maximum
].
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
, ...).- ...
quantity::Symbol
: Target quantity. For the possibilities see the documentation ofscatterQty
.component::Symbol
: Type of particle/cell. The possibilities are the keys ofPARTICLE_INDEX
.minimum::Number
: Minimum value ofquantity
.maximum::Number
: Maximum value ofquantity
.
Returns
A dictionary with the following shape:
cell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexType- ...
GalaxyInspector.filterByStellarAge
— MethodfilterByStellarAge(
data_dict::Dict;
<keyword arguments>
)::Dict{Symbol,IndexType}
Filter out stars with an age outside the range [min_age
, max_age
].
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
, ...).- ...
min_age::Unitful.Time=0.0u"Gyr"
: Minimum age.max_age::Unitful.Time=AGE_RESOLUTION
: Maximum age.
Returns
A dictionary with the following shape:
cell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexType- ...
GalaxyInspector.filterBySubhalo
— MethodfilterBySubhalo(data_dict::Dict, subhalo_abs_idx::Int)::Dict{Symbol,IndexType}
Filter out cells/particles that do not belong to 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
: Index of the target subhalo (subfind). Starts at 1.
Returns
A dictionary with the following shape:
cell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexType- ...
GalaxyInspector.filterBySubhalo
— MethodfilterBySubhalo(
data_dict::Dict;
<keyword arguments>
)::Dict{Symbol,IndexType}
Filter out cells/particles that do not belong to a given halo and 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
, ...).- ...
halo_idx::Int
: Index of the target halo (FoF group). Starts at 1.subhalo_rel_idx::Int
: Index of the target subhalo (subfind), relative to the target halo. Starts at 1. If it is set to 0, all subhalos of the target halo are included.
Returns
A dictionary with the following shape:
cell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexType- ...
GalaxyInspector.filterData!
— MethodfilterData!(data_dict::Dict; <keyword arguments>)::Nothing
Filter data_dict
using the indices provided by filter_function
.
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
, ...).- ...
filter_function::Function=filterNothing
: A function with the signature:filter_function(data_dict) -> indices
where
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
, ...).- ...
indices::Dict
: A dictionary with the following shape:cell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexType- ...
GalaxyInspector.filterData
— MethodfilterData(data_dict::Dict; <keyword arguments>)::Dict
Return a filtered copy of data_dict
using the indices provided by filter_function
.
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
, ...).- ...
filter_function::Function=filterNothing
: A function with the signature:filter_function(data_dict) -> indices
where
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
, ...).- ...
indices::Dict
: A dictionary with the following shape:cell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexType- ...
Returns
- The filtered data.
GalaxyInspector.filterNothing
— MethodDefault filter function that does not filter any cells/particles.
GalaxyInspector.filterOldStars
— MethodfilterOldStars(data_dict::Dict)::Dict{Symbol,IndexType}
Filter out stars that were born one or more snapshots ago.
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 dictionary with the following shape:
cell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexType- ...
GalaxyInspector.filterWithinCylinder
— MethodfilterWithinCylinder(
data_dict::Dict,
max_r::Unitful.Length,
max_z::Unitful.Length,
origin...,
)::Dict{Symbol,IndexType}
Filter out the cells/particles outside a given cylinder.
Arguments
data::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
, ...).- ...
max_r::Unitful.Length
: Radius of the cylinder.max_z::Unitful.Length
: Half height of the cylinder.origin
: It can be any number and type of argument compatible with the second to last arguments of acomputeCenter
method.
Returns
A dictionary with the following shape:
cell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexType- ...
GalaxyInspector.filterWithinSphere
— MethodfilterWithinSphere(
data_dict::Dict,
range::NTuple{2,<:Unitful.Length},
origin...,
)::Dict{Symbol,IndexType}
Filter out the cells/particles outside a given spherical shell.
Arguments
data::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
, ...).- ...
range::NTuple{2,<:Unitful.Length}
: Internal and external radius of the spherical shell.origin
: It can be any number and type of argument compatible with the second to last arguments of acomputeCenter
method.
Returns
A dictionary with the following shape:
cell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexType- ...
GalaxyInspector.intersectFilters
— MethodintersectFilters(filters::Dict{Symbol,IndexType}...)::Dict{Symbol,IndexType}
Generate the filter resulting from intersecting filters
(AND in boolean logic) .
Arguments
filters::Dict{Symbol,IndexType}
: Filter, as a dictionary with the following shape:cell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexType- ...
Returns
A dictionary with the following shape:
cell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexTypecell/particle type
-> idxs::IndexType- ...
GalaxyInspector.selectFilter
— MethodselectFilter(
filter_mode::Dict{Symbol,Any},
request::Dict{Symbol,Vector{String}},
)::Tuple{
Function,
Union{Symbol,NTuple{2,Int},Int},
Union{Symbol,NTuple{2,Int},Int},
Dict{Symbol,Vector{String}},
}
Select the filter function, translation, and rotation from filter_mode
.
Creates a request dictionary, using request
as a base, adding what is necessary for the filter function and corresponding transformations.
Arguments
filter_mode::Dict{Symbol,Any}
: A dictionary with three entries::filter_function
-> The filter function.:translation
-> Translation for the simulation box. The possibilities are::zero
-> No translation is applied.:global_cm
-> Selects 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.
:rotation
-> Rotation for the simulation box. The possibilities 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.(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.subhalo_abs_idx
-> Sets the principal axis of the stars in thesubhalo_abs_idx::Int
subhalo as the new coordinate system.
request::Dict{Symbol,Vector{String}}
: Base request dictionary, nothing will be deleted from it.
Returns
A Tuple with four elements:
The filter function.
Translation for the simulation box. The possibilities are:
:global_cm
-> Selects 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.
Rotation for the simulation box. The possibilities 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.(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.subhalo_abs_idx
-> Sets the principal axis of the stars in thesubhalo_abs_idx::Int
subhalo as the new coordinate system.
New request dictionary.
GalaxyInspector.selectFilter
— MethodselectFilter(
filter_mode::Symbol,
request::Dict{Symbol,Vector{String}},
)::Tuple{Function,Union{Symbol,NTuple{2,Int}},Symbol,Dict{Symbol,Vector{String}}}
Select a filter function, and the corresponding translation and rotation for the simulation box, from a list of premade ones.
Creates a request dictionary, using request
as a base, adding what is necessary for the filter function and corresponding transformations.
Arguments
filter_mode::Symbol
: Which cells/particles will be plotted, the options are::all
-> Plot every cell/particle within the simulation box.:halo
-> Plot only the cells/particles that belong to the main halo.:subhalo
-> Plot only the cells/particles that belong to the main subhalo.:sphere
-> Plot only the cells/particles inside a sphere with radiusDISK_R
(see./src/constants/globals.jl
).:stellar_subhalo
-> Plot only the cells/particles that belong to the main subhalo.:all_subhalo
-> Plot every cell/particle centered around the main subhalo.
request::Dict{Symbol,Vector{String}}
: Base request dictionary, nothing will be deleted from it.
Returns
A Tuple with four elements:
The filter function.
Translation for the simulation box. The possibilities are:
:global_cm
-> Selects 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)
-> Selects the center of mass of thehalo_idx::Int
halo, as the new origin.
Rotation for the simulation box. The possibilities are:
: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.
New request dictionary.