Comprehensive Cosmo Utils Reference/API

cosmo_utils.utils Package

cosmo_utils.utils.file_readers Module

Functions

IDL_read_file(idl_file) Reads an IDL file and converts it to a Python dictionary
fast_food_reader(key, nitems, filename) Reads in fastfood-type file and converts it to an array
read_pandas_hdf5(hdf5_file[, key, ret]) Reads a HDF5 file that contains one or many datasets.
read_hdf5_file_to_pandas_DF(hdf5_file[, key]) Reads content of HDF5 file and converts it to a Pandas DataFrame
pandas_file_to_hdf5_file(df_file, hdf5_file) Converts a HDF5 with pandas format and converts it to normal HDF5 file
pandas_df_to_hdf5_file(df, hdf5_file[, key, …]) Saves a pandas.DataFrame into a pandas HDF5 FILE.
concatenate_pd_df(directory[, filetype, …]) Concatenates pandas DataFrames into a single DataFrame

cosmo_utils.utils.file_utils Module

Functions

Program_Msg(filename) Program message for filename
Index(pathdir, datatype[, sort, basename]) Indexes the files in a directory pathdir with a specific data type datatype.
get_immediate_subdirectories(pathdir[, sort]) Immediate subdirectories to a given directory path
Path_Folder(pathdir[, time_sleep]) Creates a folder if it does not exist already
File_Exists(filename) Detrmines if file exists or not
File_Download_needed(localpath, remotepath) Determines if there exists a local copy of a file.

Classes

MarkParametrize(argname, argvalues) Parametrizes a set of values and changes the input variables of a function.

Class Inheritance Diagram

Inheritance diagram of cosmo_utils.utils.file_utils.MarkParametrize

cosmo_utils.utils.stats_funcs Module

Functions

myceil(x[, base]) Determines the upper-bound interger for a given number with a given base.
myfloor(x[, base]) Determines the lower-bound interger for a given number with a given base.
Bins_array_create(arr[, base]) Generates an evenly-spaced array between the minimum and maximum value of a given array,
sigma_calcs(data_arr[, type_sigma, …]) Calcualates the 1-, 2-, and 3-sigma ranges for data_arr
Stats_one_arr(x, y[, base, arr_len, …]) Calculates statists for 2 arrays

cosmo_utils.utils.work_paths Module

Functions

git_root_dir([path]) Determines the path to the main .git folder of the project.
cookiecutter_paths([path]) Paths to main folders in the Data Science cookiecutter template.
get_code_c() Path to the directory that holds scripts written in the C-language
get_sdss_catl_dir([path]) Extracts the path to the set of SDSS catalogues
get_output_path() Extracts path of SDSS catalogues within a directory

cosmo_utils.utils.geometry Module

Functions

flip_angles(ang[, unit]) Ensures that an angle is always between 0 and 360 degrees.
Ang_Distance(ra1, ra2, dec1, dec2[, unit, …]) Calculates angular separation between two sets of points with given right ascensions and declinations.
Coord_Transformation(ra, dec, dist, ra_cen, …) Transforms spherical coordinates (ra, dec, dist) into cartesian coordinates.

cosmo_utils.utils.gen_utils Module

Functions

reshape_arr_1d(arr) Transforms the array intoa 1-dimensional array, if necessary.

cosmo_utils.custom_exceptions Module

Classes for all LSS_Utils-specific exceptions

Classes

LSSUtils_Error(message) Base class of all LSS_Utils-specific exceptions

Class Inheritance Diagram

Inheritance diagram of cosmo_utils.custom_exceptions.LSSUtils_Error

cosmo_utils.mock_catalogues Package

cosmo_utils.mock_catalogues.mags_calculations Module

Functions

apparent_to_absolute_magnitude(app_mag, lum_dist) Calculates the absolute magnitude based on luminosity and apparent magnitude.
absolute_to_apparent_magnitude(abs_mag, lum_dist) Calculates the apparent magnitude using the luminosity and absolute magnitude.
get_sun_mag(filter_opt[, system]) Get solar absolaute magnitude for a filter in a system.
absolute_magnitude_to_luminosity(abs_mag, …) Calculates the luminosity of the object through filter_opt filter.
luminosity_to_absolute_mag(lum, filter_opt) Calculates the absolute magnitude of object through the filter_opt filter.
absolute_magnitude_lim(z, mag_lim[, cosmo, …]) Calculates the absolute magnitude limit as function of redshift z for a flux-limited survey.

cosmo_utils.mock_catalogues.spherematch Module

Functions

spherematch(ra1, dec1, ra2, dec2[, tol, …]) Determines the matches between two catalogues of sources with <ra, dec> coordinates.

cosmo_utils.mock_catalogues.abundance_matching Module

Functions

abundance_matching_f(dict1, dict2[, …]) Abundance matching based on 2 quantities.
reversed_arrays(x, y) Determines if arrays increase or decrease monotonically.

cosmo_utils.mock_catalogues.catls_utils Module

Functions

catl_keys(catl_kind[, perf_opt, return_type]) Dictionary keys for the different types of catalogues
catl_keys_prop(catl_kind[, catl_info, …]) Dictionary keys for the diffeent galaxy and group properties of catalogues.
catl_sdss_dir([catl_kind, catl_type, …]) Extracts the path to the synthetic catalogues.
extract_catls([catl_kind, catl_type, …]) Extracts a list of synthetic catalogues given input parameters
sdss_catl_clean(catl_pd, catl_kind[, …]) Cleans the catalogue by removing failed values.
sdss_catl_clean_nmin(catl_pd, catl_kind[, …]) Cleans the catalogue removing failed values, and only includes galaxies that are in groups/halos above a nmin threshold.
catl_sdss_merge(catl_pd_ii[, catl_kind, …]) Merges the member and group catalogues for a given set of input parameters, and returns a modified version of the galaxy group catalogues with added info about the galaxy groups.

cosmo_utils.mock_catalogues.pair_counters Package

Functions

pairwise_distance_rp Cython engine for returning pairs of points separated in projected radial bins with an observer at (0,0,0).

cosmo_utils.mock_catalogues.shmr_funcs Module

Functions

Behroozi_relation(log_mstar[, z, …]) Returns the halo mass of a central galaxy as a function of its stellar mass.

cosmo_utils.ml Package

cosmo_utils.ml.ml_utils Module

Functions

data_preprocessing(feat_arr[, pre_opt, reshape]) Preprocess the data used, in order to clean and make the data more suitable for the machine learning algorithms
train_test_dataset(pred_arr, feat_arr[, …]) Function to create the training and testing datasets for a given set of features array and predicted array.
scoring_methods(truth_arr[, feat_arr, …]) Determines the overall score for given arrays, i.e.