sage_analysis.sage_binary¶
This module defines the SageBinaryData
class. This class interfaces with the
Model
class to read in binary data written by SAGE.
The value of sage_output_format
is generally
sage_binary
if it is to be read with this class.
We refer to Ingesting Custom Data for more information about adding your own Data Class to ingest data.
Author: Jacob Seiler.
-
class
sage_analysis.sage_binary.
SageBinaryData
(model: sage_analysis.model.Model, sage_file_to_read: str)[source]¶ Class intended to inteface with the
Model
class to ingest the data written by SAGE. It includes methods for reading the output galaxies, setting cosmology etc. It is specifically written for whensage_output_format
issage_binary
.-
_read_sage_params
(sage_file_path: str) → Dict[str, Any][source]¶ Read the SAGE parameter file.
Parameters: sage_file_path (string) – Path to the SAGE parameter file. Returns: model_dict – Dictionary containing the parameter names and their values. Return type: dict [str, var]
-
determine_num_gals
(model: sage_analysis.model.Model, *args)[source]¶ Determines the number of galaxies in all files for this
Model
.Parameters:
-
determine_volume_analyzed
(model: sage_analysis.model.Model) → float[source]¶ Determines the volume analyzed. This can be smaller than the total simulation box.
Parameters: model ( Model
instance) – The model that this data class is associated with.Returns: volume – The numeric volume being processed during this run of the code in (Mpc/h)^3. Return type: float
-
read_gals
(model, file_num, pbar=None, plot_galaxies=False, debug=False)[source]¶ Reads the galaxies of a model file at snapshot specified by
snapshot
.Parameters: - model (
Model
class) – TheModel
we’re reading data for. - file_num (int) – Suffix number of the file we’re reading.
- pbar (
tqdm
class instance, optional) – Bar showing the progress of galaxy reading. IfNone
, progress bar will not show. - plot_galaxies (bool, optional) – If set, plots and saves the 3D distribution of galaxies for this file.
- debug (bool, optional) – If set, prints out extra useful debug information.
Returns: gals – The galaxies for this file.
Return type: numpy
structured array with format given byget_galaxy_struct()
Notes
tqdm
does not play nicely with printing to stdout. Hence we disable thetqdm
progress bar ifdebug=True
.- model (
-