CatlUtils¶
-
class
sdss_catl_utils.models.catl_models.CatlUtils(**kwargs)[source] [edit on github]¶ Bases:
sdss_catl_utils.models.catl_models_template.CatlClassTemplateClass used to handle the galaxy/group galaxy/group catalogues, after the catalogues have been downloaded. This class has functions to read, modify, and analyze the galaxy/group catalogues.
For a list of available pre-processed galaxy- and group-galaxy catalogues provided by
sdss_catl_utils, see …Parameters: - catl_kind : {
data,mocks}str Kind of catalogues to download. This variable is set to
mocksby default.- Options:
data: Downloads the SDSS DR7 real catalogues.mocks: Downloads the synthetic catalogues of SDSS DR7.
- hod_n :
int, optional Number of the HOD model to use. This value is set to
0by default.- halotype : {‘so’, ‘fof’},
str, optional Type of dark matter definition to use. This value is set to
soby default.- Options:
so: Spherical Overdensity halo definition.fof: Friends-of-Friends halo definition.
- clf_method : {1, 2, 3},
int, optional Method for assigning galaxy properties to mock galaxies. This variable dictates how galaxies are assigned luminosities or stellar masses based on their galaxy type and host halo’s mass. This variable is set to
1by default.- Options:
1: Independent assignment of (g-r) colour, sersic, and specific star formation rate (logssfr)2: (g-r) colour dictates active/passive designation and draws values independently.3: (g-r) colour dictates active/passive designation, and assigns other galaxy properties for that given galaxy.
- clf_seed :
int, optional Value of the random seed used for the conditional luminosity function. This variable is set to
1235default.- dv :
float, optional Value for the
velocity biasparameter. It is the difference between the galaxy and matter velocity profiles.\[\begin{split}dv = \\frac{v_{g} - v_{c}}{v_{m} - v_{c}}\end{split}\]where \(v_g\) is the galaxy’s velocity; \(v_m\), the matter velocity.
- sigma_clf_c :
float, optional Value of the scatter in log(L) for central galaxies, when being assigned during the
conditional luminosity function(CLF). This variable is set to0.1417by default.- sample : {‘18’, ‘19’, ‘20’, ‘21’},
str, optional Luminosity of the SDSS volume-limited sample to analyze. This variable is set to
'19'by default.- Options:
'18': \(M_r = 18\) volume-limited sample'19': \(M_r = 19\) volume-limited sample'20': \(M_r = 20\) volume-limited sample'21': \(M_r = 21\) volume-limited sample
- type_am : {‘mr’, ‘mstar’},
str, optional Type of Abundance matching used in the catalogue. This variable is set to
'mr'by default.- Options:
'mr': Luminosity-based abundance matching used'mstar': Stellar-mass-based abundance matching used.
- cosmo_choice : {
'LasDamas','Planck'}str, optional Choice of cosmology to use. This variable is set to
LasDamasby default.- Options:
LasDamas: Uses the cosmological parameters from the- LasDamas simulations.
Planck: Uses the Planck 2015 cosmology.
- perf_opt :
bool, optional If
True, it chooses to analyze theperfectversion of the synthetic galaxy/group galaxy catalogues. Otherwise, it downloads the catalogues with group-finding errors included. This variable is set toFalseby default.- environ_name :
str Name of the environment variable to assign to
outdir. This variable is set to the defaultenviron_namefrommocks_default
Notes
There are many combinations of parameters that could be performed.
However, note that not all variations exist and would not be available for download/analysis!Examples
>>> from sdss_catl_utils.models.catl_models import CatlUtils
If one wants to initialize an
catalogueobject with the default input parameters, one could write:>>> catl_obj = CatlUtils() # Initialzing catalogue object
However, if one wants to have a
modifiedversion ofcatl_obj, one can pass a dictionary with the proper set of input parameters:>>> params_d = {'catl_kind': 'mocks', 'clf_method': 3, 'clf_seed': 123} >>> catl_obj = CatlUtils(**params_d)
This will create an
catalogue objectthat corresponds tomockscatalogues withclf_method = 3andclf_seed = 123.Methods Summary
catl_arr_extract([catl_type, catl_kind, …])Extracts the list of galaxy/group catalogues. catl_merge([catl_idx, return_memb_group, …])Merges the memberandgroupcatalogues for a given set of input parameters, and returns amodifiedversion of the galaxy group catalogues with added info about the galaxy groups.catls_dir([catl_type, catl_kind, print_filedir])Location of the group and group galaxy catalogues with the specified parameters. get_params_dict()Gets the dictionary of input parameters for the given model. main_dir()Path to the main directory, in which all catalogues are stored. Methods Documentation
-
catl_arr_extract(catl_type='memb', catl_kind='mocks', ext='hdf5', print_filedir=False, return_len=False)[source] [edit on github]¶ Extracts the list of galaxy/group catalogues.
Parameters: - catl_type : {
gal,memb,group},str Option for which kind of catalogue is being analyzed. This variable is set to
membby default.- Options:
'gal': Galaxy catalogue'memb': Group Member galaxy catalogue'group': Group galaxy catalogue
- catl_kind : {
data,mocks}str Kind of catalogues to download. This variable is set to
mocksby default.- Options:
data: Downloads the SDSS DR7 real catalogues.mocks: Downloads the synthetic catalogues of SDSS DR7.
- ext : {‘hdf5’}
str File extension used for the catalogues. This variable is set to
hdf5by default.- print_filedir :
bool, optional If
True, the path of the catalogue directory is printed onto the screen. This variable is set toFalseby default.
Returns: - catls_arr :
numpy.ndarray, shape (N,) Array of the paths of the galaxy/group catalogues with specified parameters. The shape of the variable is (
N,), whereN, is the number of catalogues in the directory.
Notes
If no files are present or exist in the given directory, it will return an
emptyarray of files.Examples
This function is able to return the path to individual kinds of galaxy and group catalogues that meet some criteria based on the different combinations of input parameters.
For example, if one wants to get the paths to the
mocksmembergalaxy catalogues with ahalotype = 'fof'prescription, and following aclf_method = 2methodology, one could retrieve them by:>>> params_dict = {'catl_kind': 'mocks', 'halotype': 'fof', 'clf_method': 2} >>> catl_obj = CatlUtils(**params_dict) # doctest: +SKIP >>> catl_paths = catl_arr_extract(catl_type='memb', catl_kind='mocks', halotype='fof') # doctest: +SKIP
This will return the paths to the
membergalaxy catalogues that meet those prescribed parameters.- catl_type : {
-
catl_merge(catl_idx=0, return_memb_group=False, print_filedir=False)[source] [edit on github]¶ Merges the
memberandgroupcatalogues for a given set of input parameters, and returns amodifiedversion of the galaxy group catalogues with added info about the galaxy groups.Parameters: - catl_idx :
int, optional Index of the catalogue to match. The index must be smaller than the number of files returned by function
catl_arr_extractfor the given combination of parameters. This variable is set to0by default.- return_memb_group :
bool, optional If
True, the function returns thememberandgroupcatalogues along with themergedcatalogue. This variable is set toFalseby default.- print_filedir :
bool, optional If
True, the output directory is printed onto the screen. This variable is set toFalseby default.
Returns: - merged_pd :
pandas.DataFrame Combined DataFrame containing both
galaxyandgroupinformation for the given combination of parameters and thecatl_idx-th catalogue(s).- memb_pd :
pandas.DataFrame Member galaxy catalogue of the
catl_idx-th catalogue. This catalogue contains the information about themembergalaxies. This object is only returned ifreturn_memb_group == True,- group_pd :
pandas.DataFrame Group galaxy catalogue of the
catl_idx-th catalogue. This catalogue contains the information about thegalaxy groupsThis object is only returned ifreturn_memb_group == True,
Raises: - SDSSCatlUtils_Error : Exception from
SDSSCatlUtils_Error Program exception if input parameters are
notaccepted.
Examples
This function will merge the
memberandgroupcatalogues into a singlepandas.DataFrameobject, and it can be used to merge two existing catalogues. For example, to merge thememberandgroupcatalogues using the default parameters, one can easily write:>>> merged_pd = catl_merge() # doctest: +SKIP
The resulting object will consist of a merge between the member and group catalogues, with the columns pertaining to group properties having a
GG_attached to their names.However, if one wants to merge two mock catalogues with a
clf_method = 2andhalotype = 'fof'prescription, one could easily write this:>>> params_dict = {'catl_kind': 'mocks', 'halotype': 'fof', 'clf_method': 2} >>> catl_obj = CatlUtils(**params_dict) # doctest: +SKIP >>> merged_pd = catl_obj.catl_merge() # doctest: +SKIP
Additionally, one could recover the
memberandgroupcatalogues as well:>>> merged_pd, memb_pd, group_pd = catl_obj.catl_merge(return_memb_group=True) # doctest: +SKIP
For more information and examples, please refer to Getting started with SDSS_Catl_Utils.
- catl_idx :
-
catls_dir(catl_type='memb', catl_kind='mocks', print_filedir=False)[source] [edit on github]¶ Location of the group and group galaxy catalogues with the specified parameters.
Parameters: - catl_type : {‘gal’, ‘memb’, ‘group’},
str Option for which kind of catalogue is being analyzed. This variable is set to
membby default.- Options:
'gal': Galaxy catalogue'memb': Group Member galaxy catalogue'group': Group galaxy catalogue
- catl_kind : {
data,mocks}str Kind of catalogues to download. This variable is set to
mocksby default.- Options:
data: Downloads the SDSS DR7 real catalogues.mocks: Downloads the synthetic catalogues of SDSS DR7.
- print_filedir :
bool, optional If
True, the path of the catalogue directory is printed onto the screen. This variable is set toFalseby default.
Returns: - catls_dirpath :
str Path to the location of the group and galaxy catalogues with the specified parameters.
Notes
This method can be used to access the different
kindsof catalogues, i.e. galaxy-, member-, and group-catalogues for different combinations of input parameters.Examples
catls_dircan be used to explore the directories that host differentkindsof catalogues, i.e. galaxy-, member-, and group-catalogues for various combinations of input parameters.For example, if one wants to read the
membergalaxy catalogue, i.e. a catalogue with bothgalaxyandgroupinformation, formockscatalogues, one could easily write:>>> memb_dir = catls_dir(catl_type='memb', catl_kind='mocks') # doctest: +SKIP
This will return the path to the
membergalaxy catalogues directory with the synthetic catalogues in it. This method only returns the path of the directory, and not the path to the actual files in the directory. To accomplish this, one would need to use the functioncatl_arr_extract.- catl_type : {‘gal’, ‘memb’, ‘group’},
-
get_params_dict()[source] [edit on github]¶ Gets the dictionary of input parameters for the given model.
Returns: - param_dict :
dict Dictionary of input parameters for the chosen combination of parameters.
Examples
After having initializing an
CatlUtilsobject, one can easily recover the set of input parameters used.>>> from sdss_catl_utils.models.catl_models import CatlUtils >>> catl_params_dict = {'catl_kind': 'mocks', 'clf_seed': 3} # Catalogue parameters >>> catl_obj = CatlUtils(**catl_params_dict) # Initialing object
The dictionary of parameters is saved as
self.param_dictfor the class object. It can be easily accessed by:>>> catl_obj.param_dict # doctest: +SKIP
Or, it can also be accessed as:
>>> catl_obj.get_params_dict() # doctest: +SKIP
For example, in order to print out the list of input parameters, one can do the following:
>>> param_dict = catl_obj.param_dict # doctest: +SKIP >>> param_dict # doctest: +SKIP {'catl_kind': 'mocks', 'hod_n': 0, 'halotype': 'fof', 'clf_method': 1, 'clf_seed': 3, 'dv': 1.0, 'sigma_clf_c': 0.1417, 'sample': '19', 'type_am': 'mr', 'cosmo_choice': 'LasDamas', 'perf_opt': False, 'remove_files': False, 'environ_name': 'sdss_catl_path', 'sample_Mr': 'Mr19', 'sample_s': '19'}
This dictionary can now be used in other parts of one’s analysis, or as a reference of the parameters used.
- param_dict :
-
main_dir()[source] [edit on github]¶ Path to the main directory, in which all catalogues are stored. This directory depends on your installation of
SDSS_Catl_Utilsand on your current working space.Returns: - main_dirpath :
str Path to the main directory, in which all catalogues are stored. It uses the environment variable
environ_namefrom the class.
Examples
The main directory of the catalogues can be easily accessed after having created an object for the combination of input parameters for the catalogues.
>>> from sdss_catl_utils.models.catl_models import CatlUtils >>> catl_params_dict = {'catl_kind': 'mocks', 'clf_seed': 3} # Catalogue parameters >>> catl_obj = CatlUtils(**catl_params_dict) # Initialing object
One can access the directory, under which the galaxy- and group-catalogues are saved, by typing:
>>> catl_obj.main_dir() # doctest: +SKIP
This will return the path of the directory.
- main_dirpath :
- catl_kind : {