sage_analysis.example_calcs¶
Here we show a myriad of functions that can be used to calculate properties from the
SAGE output. By setting the correct plot toggles and calling
generate_func_dict()
, a dictionary containing these
functions can be generated and passed to
calc_properties_all_files()
to calculate the
properties.
The properties are stored (and updated) in the
properties
attribute.
We refer to Analysing SAGE Output for more information on how the calculations are handled.
Author: Jacob Seiler
-
sage_analysis.example_calcs.
calc_BMF
(model, gals, snapshot: int)[source]¶ Calculates the baryon mass function of the given galaxies. That is, the number of galaxies at a given baryon (stellar + cold gas) mass.
The
Model.properties["snapshot_<snapshot>"]["BMF"]
array will be updated.
-
sage_analysis.example_calcs.
calc_BTF
(model, gals, snapshot: int)[source]¶ Calculates the baryonic Tully-Fisher relation for spiral galaxies in the given set of galaxies.
The number of galaxies added to
Model.properties["snapshot_<snapshot>"]["BTF_mass"]
andModel.properties["snapshot_<snapshot>"]["BTF_vel"]
arrays is given bysample_size
weighted bynumber_spirals_passed /
_num_gals_all_files
. If this value is greater thannumber_spirals_passed
, then all spiral galaxies will be used.
-
sage_analysis.example_calcs.
calc_GMF
(model, gals, snapshot: int)[source]¶ Calculates the gas mass function of the given galaxies. That is, the number of galaxies at a given cold gas mass.
The
Model.properties["snapshot_<snapshot>"]["GMF"]
array will be updated.
-
sage_analysis.example_calcs.
calc_SFRD_history
(model, gals, snapshot: int)[source]¶ Calculates the sum of the star formation across all galaxies. This will be normalized by the simulation volume to determine the density. See
plot_SFRD()
for full implementation.The
Model.properties["snapshot_<snapshot>"]["SFRD"]
value is updated.
-
sage_analysis.example_calcs.
calc_SMD_history
(model, gals, snapshot: int)[source]¶ Calculates the sum of the stellar mass across all galaxies. This will be normalized by the simulation volume to determine the density. See
plot_SMD()
for full implementation.The
Model.properties["snapshot_<snapshot>"]["SMD"]
value is updated.
-
sage_analysis.example_calcs.
calc_SMF
(model: sage_analysis.model.Model, gals, snapshot: int, calc_sub_populations: bool = False, smf_property_name: str = 'SMF')[source]¶ Calculates the stellar mass function of the given galaxies. That is, the number of galaxies at a given stellar mass.
The
Model.properties["snapshot_<snapshot>"]"SMF"]
array will be updated. We also split the galaxy population into “red” and “blue” based on the value ofsSFRcut
and update theModel.properties["snapshot_<snapshot>"]["red_SMF"]
andModel.properties["snapshot_<snapshot>"]["blue_SMF"]
arrays.Parameters: - snapshot (int) – The snapshot the SMF is being calculated at.
- plot_sub_populations (boolean, optional) – If
True
, calculates the stellar mass function for red and blue sub-populations. - smf_property_name (string, optional) – The name of the property used to store the stellar mass function. Useful if different calculations are computing the stellar mass function but saving it as a different property.
-
sage_analysis.example_calcs.
calc_SMF_history
(model, gals, snapshot: int)[source]¶ Calculates the stellar mass function of the given galaxies. That is, the number of galaxies at a given stellar mass.
The
Model.properties["SMF"_history]
array will be updated.
-
sage_analysis.example_calcs.
calc_baryon_fraction
(model, gals, snapshot: int)[source]¶ Calculates the
mass_baryons / halo_virial_mass
as a function of halo virial mass for each baryon reseroivr (stellar, cold, hot, ejected, intra-cluster stars and black hole). Also calculates the ratio for the total baryonic mass.The
Model.properties["snapshot_<snapshot>"]["halo_<reservoir_name>_fraction_sum"]
arrays are updated for each reservoir. In addition,Model.properties["snapshot_<snapshot>"]["halo_baryon_fraction_sum"]
is updated.Notes
The halo virial mass we use is the background FoF halo, not the immediate host halo of each galaxy.
We only sum the baryon mass in each stellar mass bin. When converting this to the mass fraction, one must divide by the number of halos in each halo mass bin,
Model.properties["snapshot_<snapshot>"]["fof_HMF"]
. Seeplot_baryon_fraction()
for full implementation.If the
Model.properties["snapshot_<snapshot>"]["fof_HMF"]
property, with associated binsModel.bins["halo_mass"bin"]
have not been initialized, aValueError
is thrown.
-
sage_analysis.example_calcs.
calc_bh_bulge
(model, gals, snapshot: int)[source]¶ Calculates the black hole mass as a function of bulge mass.
The number of galaxies added to
Model.properties["snapshot_<snapshot>"]["BlackHoleMass"]
andModel.propertiesp["snapshot_<snapshot>"]["BulgeMass"]
arrays is given bysample_size
weighted bynumber_galaxies_passed /
_num_gals_all_files
. If this value is greater thannumber_galaxies_passed
, then all galaxies will be used.Notes
We only consider galaxies with bulge mass greater than 10^8 Msun/h and a black hole mass greater than 10^5 Msun/h.
-
sage_analysis.example_calcs.
calc_bulge_fraction
(model, gals, snapshot: int)[source]¶ Calculates the
bulge_mass / stellar_mass
anddisk_mass / stellar_mass
ratios as a function of stellar mass.The
Model.properties["snapshot_<snapshot>"]["fraction_bulge_sum"]
,Model.properties["snapshot_<snapshot>"]["fraction_disk_sum"]
,Model.properties["snapshot_<snapshot>"]["fraction_bulge_var"]
,Model.properties["snapshot_<snapshot>"]["fraction_disk_var"]
arrays will be updated.Notes
We only sum the bulge/disk mass in each stellar mass bin. When converting this to the mass fraction, one must divide by the number of galaxies in each stellar mass bin, the stellar mass function
Model.properties["snapshot_<snapshot>"]["SMF"]
. Seeplot_bulge_fraction()
for full implementation.
-
sage_analysis.example_calcs.
calc_gas_fraction
(model, gals, snapshot: int)[source]¶ Calculates the fraction of baryons that are in the cold gas reservoir as a function of stellar mass.
The number of galaxies added to
Model.properties["snapshot_<snapshot>"]["gas_frac_mass"]
andModel.properties["snapshot_<snapshot>"]["gas_frac"]
arrays is given bysample_size
weighted bynumber_spirals_passed /
_num_gals_all_files
. If this value is greater thannumber_spirals_passed
, then all spiral galaxies will be used.
-
sage_analysis.example_calcs.
calc_metallicity
(model, gals, snapshot: int)[source]¶ Calculates the metallicity as a function of stellar mass.
The number of galaxies added to
Model.properties["snapshot_<snapshot>"]["metallicity_mass"]
andModel.properties["snapshot_<snapshot>"]["metallicity"]
arrays is given bysample_size
weighted bynumber_centrals_passed /
_num_gals_all_files
. If this value is greater thannumber_centrals_passed
, then all central galaxies will be used.
-
sage_analysis.example_calcs.
calc_quiescent
(model, gals, snapshot: int)[source]¶ Calculates the quiescent galaxy fraction as a function of stellar mass. The galaxy population is also split into central and satellites and the quiescent fraction of these are calculated.
The
Model.properties["snapshot_<snapshot>"]["centrals_MF"]
,Model.properties["snapshot_<snapshot>"]["satellites_MF"]
,Model.properties["snapshot_<snapshot>"]["quiescent_galaxy_counts"]
,Model.properties["snapshot_<snapshot>"]["quiescent_centrals_counts"]
, andModel.properties["snapshot_<snapshot>"]["quiescent_satellites_counts"]
arrays will be updated.Notes
We only count the number of quiescent galaxies in each stellar mass bin. When converting this to the quiescent fraction, one must divide by the number of galaxies in each stellar mass bin, the stellar mass function
Model.properties["snapshot_<snapshot>"]["SMF"]
. Seeplot_quiescent()
for an example implementation.
-
sage_analysis.example_calcs.
calc_reservoirs
(model, gals, snapshot: int)[source]¶ Calculates the mass in each reservoir as a function of halo virial mass.
The number of galaxies added to
Model.properties["snapshot_<snapshot>"]["reservoir_mvir"]
andModel.properties["snapshot_<snapshot>"]["reservoir_<reservoir_name>"]
arrays is given bysample_size
weighted bynumber_centrals_passed /
_num_gals_all_files
. If this value is greater thannumber_centrals_passed
, then all central galaxies will be used.
-
sage_analysis.example_calcs.
calc_sSFR
(model, gals, snapshot: int)[source]¶ Calculates the specific star formation rate (star formation divided by the stellar mass of the galaxy) as a function of stellar mass.
The number of galaxies added to
Model.properties["snapshot_<snapshot>"]["sSFR_mass"]
andModel.properties["snapshot_<snapshot>"]["sSFR_sSFR"]
arrays is given bysample_size
weighted bynumber_gals_passed /
_num_gals_all_files
. If this value is greater thannumber_gals_passed
, then all galaxies with non-zero stellar mass will be used.
-
sage_analysis.example_calcs.
calc_spatial
(model, gals, snapshot: int)[source]¶ Calculates the spatial position of the galaxies.
The number of galaxies added to
Model.properties["snapshot_<snapshot>"]["<x/y/z>_pos"]
arrays is given bysample_size
weighted bynumber_galaxies_passed /
_num_gals_all_files
. If this value is greater thannumber_galaxies_passed
, then all galaxies will be used.