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.filterByBirthPlaceMethod
filterByBirthPlace(
    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 (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, ...).
    • ...
  • 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::IndexType
    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • ...
source
GalaxyInspector.filterByELSFRMethod
filterByELSFR(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 (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 dictionary with the following shape:

    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • ...
source
GalaxyInspector.filterByQuantityMethod
filterByQuantity(
    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 (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, ...).
    • ...
  • quantity::Symbol: Target quantity. For the possibilities see the documentation of scatterQty.

  • component::Symbol: Type of particle/cell. The possibilities are the keys of PARTICLE_INDEX.

  • minimum::Number: Minimum value of quantity.

  • maximum::Number: Maximum value of quantity.

Returns

  • A dictionary with the following shape:

    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • ...
source
GalaxyInspector.filterByStellarAgeMethod
filterByStellarAge(
    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 (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, ...).
    • ...
  • 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::IndexType
    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • ...
source
GalaxyInspector.filterBySubhaloMethod
filterBySubhalo(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 (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: Index of the target subhalo (subfind). Starts at 1.

Returns

  • A dictionary with the following shape:

    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • ...
source
GalaxyInspector.filterBySubhaloMethod
filterBySubhalo(
    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 (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, ...).
    • ...
  • 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::IndexType
    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • ...
source
GalaxyInspector.filterData!Method
filterData!(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 (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, ...).
    • ...
  • 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 (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, ...).
      • ...
    • indices::Dict: A dictionary with the following shape:

      • cell/particle type -> idxs::IndexType
      • cell/particle type -> idxs::IndexType
      • cell/particle type -> idxs::IndexType
      • ...
source
GalaxyInspector.filterDataMethod
filterData(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 (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, ...).
    • ...
  • 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 (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, ...).
      • ...
    • indices::Dict: A dictionary with the following shape:

      • cell/particle type -> idxs::IndexType
      • cell/particle type -> idxs::IndexType
      • cell/particle type -> idxs::IndexType
      • ...

Returns

  • The filtered data.
source
GalaxyInspector.filterOldStarsMethod
filterOldStars(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 (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 dictionary with the following shape:

    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • ...
source
GalaxyInspector.filterWithinCylinderMethod
filterWithinCylinder(
    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 (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, ...).
    • ...
  • 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 a computeCenter method.

Returns

  • A dictionary with the following shape:

    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • ...
source
GalaxyInspector.filterWithinSphereMethod
filterWithinSphere(
    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 (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, ...).
    • ...
  • 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 a computeCenter method.

Returns

  • A dictionary with the following shape:

    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • ...
source
GalaxyInspector.intersectFiltersMethod
intersectFilters(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::IndexType
    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • ...

Returns

  • A dictionary with the following shape:

    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • cell/particle type -> idxs::IndexType
    • ...
source
GalaxyInspector.selectFilterMethod
selectFilter(
    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 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.
    • :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 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.
      • subhalo_abs_idx -> Sets the principal axis of the stars in the subhalo_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 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.
    • 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 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.
      • subhalo_abs_idx -> Sets the principal axis of the stars in the subhalo_abs_idx::Int subhalo as the new coordinate system.
    • New request dictionary.

source
GalaxyInspector.selectFilterMethod
selectFilter(
    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 radius DISK_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 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) -> Selects the center of mass of the halo_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.

source