DownloadManager¶
-
class
sdss_catl_utils.models.catl_models.
DownloadManager
(**kwargs)[source] [edit on github]¶ Bases:
sdss_catl_utils.models.catl_models_template.CatlClassTemplate
Class used to scrape the web for galaxy and group galaxy catalogue data and cache the downloaded catalogues.
For list of available pre-processed galaxy- and group-galaxy catalogues provided by
sdss_catl_utils
, seeParameters: - catl_kind : {
data
,mocks
}str
Kind of catalogues to download. This variable is set to
mocks
by 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
0
by default.- halotype : {‘so’, ‘fof’},
str
, optional Type of dark matter definition to use. This value is set to
so
by 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
1
by 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
1235
default.- dv :
float
, optional Value for the
velocity bias
parameter. It is the difference between the galaxy and matter velocity profiles.\[dv = \frac{v_{g} - v_{c}}{v_{m} - v_{c}}\]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.1417
by 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
- catl_type : {‘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
LasDamas
by 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 the
perfect
version of the synthetic galaxy/group galaxy catalogues. Otherwise, it downloads the catalogues with group-finding errors included. This variable is set toFalse
by default.- environ_name :
str
Name of the environment variable to assign to
outdir
. This variable is set to the defaultenviron_name
frommocks_default
Examples
>>> from sdss_catl_utils.models.catl_models import DownloadManager
Methods Summary
catl_download
([outdir, download_type, ext, …])Downloads the corresponding catalogues to the designated folder. catl_web_params_check
([catl_kind, …])Checks that the combination of parameters is valid and that there are catalogues available to download. directory_tree_check
([loc])Checks the file structure of the current directory, and determines if it is a git
repository or not.local_outdir_path
([loc, catl_type, …])Output directory for local
copies of the catalogues.Methods Documentation
-
catl_download
(outdir='./', download_type='all', ext='hdf5', print_outdir=False)[source] [edit on github]¶ Downloads the corresponding catalogues to the designated folder.
Parameters: - outdir :
str
, optional Output directory, to which catalogues will be saved. This variable is set to the default location of
directory_tree_check
. This variable is set to./
by default.- download_type : {
all
,data
,mocks
}str
, optional Type of catalogues to download. This variable is set to
all
by default.- Options:
'data'
: Downloads the SDSSdata
catalogues.'mocks'
: Downloads the SDSS synthetic catalogues.'all'
: Downloads bothdata
andmocks
catalogues.
- ext : {‘hdf5’}
str
File extension used for the catalogues. This variable is set to
hdf5
by default.- print_outdir :
bool
, optional If
True
, it prints out the path to the output directories of the catalogues.
Examples
>>> # To download the synthetic catalogues >>> from sdss_catl_utils.models.catl_models import DownloadManager >>> >>> # Downloading catalogues >>> A = DownloadManager() >>> A.catl_download(outdir='./', download_type='all') # doctest: +SKIP >>>
- outdir :
-
catl_web_params_check
(catl_kind='mocks', catl_type='memb', ext='hdf5', return_files_url=False, perf_opt=False)[source] [edit on github]¶ Checks that the combination of parameters is valid and that there are catalogues available to download.
Parameters: - catl_kind : {
data
,mocks
}str
Kind of catalogues to download. This variable is set to
mocks
by default.- Options:
data
: Downloads the SDSS DR7 real catalogues.mocks
: Downloads the synthetic catalogues of SDSS DR7.
- catl_type : {‘gal’, ‘memb’, ‘group’},
str
Option for which kind of catalogue is being analyzed. This variable is set to
memb
by default.- Options:
'gal'
: Galaxy catalogue'memb'
: Group Member galaxy catalogue'group'
: Group galaxy catalogue
- ext : {‘hdf5’}
str
File extension used for the catalogues. This variable is set to
hdf5
by default.- return_files_url :
bool
, optional If True, it returns an array of files from the desired combination of parameters, and with a file extension
ext
. This variable is set toFalse
by default.- perf_opt :
bool
, optional If True, it chooses to analyze the
perfect
version of the synthetic galaxy/group galaxy catalogues. Otherwise, it downloads the catalogues with group-finding errors included. This variable is set toFalse
by default.
Returns: - catl_url :
str
URL of the files being downloaded.
- catl_files_url :
numpy.ndarray
, optional
- catl_kind : {
-
directory_tree_check
(loc='./')[source] [edit on github]¶ Checks the file structure of the current directory, and determines if it is a
git
repository or not. If not, it will save the catalogues to a location in the user’s home directory, under~/user/.sdss_catls
. It also adds the location of the output directory as an environment variable.Parameters: - loc :
str
Path to the directory being analyzed for possible git initialization directory. This variable is set to
./
by default.
Returns: - outdir :
str
Path to the output directory, to which catalogues can be saved and stored.
- loc :
-
local_outdir_path
(loc='./', catl_type='memb', catl_kind='data', check_exist=False, create_dir=False, perf_opt=False)[source] [edit on github]¶ Output directory for
local
copies of the catalogues.Parameters: - loc :
str
Path to the directory being analyzed for possible git initialization directory.
- catl_type : {‘gal’, ‘memb’, ‘group’},
str
Option for which kind of catalogue is being analyzed. This variable is set to
memb
by 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
mocks
by default.- Options:
data
: Downloads the SDSS DR7 real catalogues.mocks
: Downloads the synthetic catalogues of SDSS DR7.
- check_exist :
bool
, optional If
True
, it checks for whether or not the file exists. This variable is set toFalse
by default.- create_dir :
bool
, optional If
True
, it creates the directory if it does not exist. This variable is set toFalse
by default.- perf_opt :
bool
, optional If True, it chooses to analyze the
perfect
version of the synthetic galaxy/group galaxy catalogues. Otherwise, it downloads the catalogues with group-finding errors included. This variable is set toFalse
by default.
Returns: - outdir_local :
str
Path to the local output directory, based on the type of catalogues and input parameters.
- loc :
- catl_kind : {