galsbi.ucat package

Subpackages

Submodules

galsbi.ucat.filters_util module

Created Sept 2021 author: Tomasz Kacprzak

This script manipulates filter information. It can create the filters_collection.h5 file, which contains all listed filters we use.

class galsbi.ucat.filters_util.UseShortFilterNames(func, filters_full_names)[source]

Bases: object

Interface between short and long filter names

galsbi.ucat.filters_util.create_filter_collection(dirpath_res)[source]

Create a filter collection file Currently supported instruments: DECam, VISTA, GenericBessel

galsbi.ucat.filters_util.get_default_full_filter_names(filters)[source]
galsbi.ucat.filters_util.load_filters(filepath_filters, filter_names=None, lam_scale=1)[source]
galsbi.ucat.filters_util.store_filter_collection(filepath_collection, filters_collect)[source]

galsbi.ucat.galaxy_sampling_util module

Created on Mar 6, 2018 author: Joerg Herbel

class galsbi.ucat.galaxy_sampling_util.Catalog[source]

Bases: object

exception galsbi.ucat.galaxy_sampling_util.UCatMZInterpError[source]

Bases: ValueError

Raised when lum_fct_m_max is too low for the given redshift range

exception galsbi.ucat.galaxy_sampling_util.UCatNumGalError[source]

Bases: ValueError

Raised when more galaxies than allowed by the input parameters are sampled

galsbi.ucat.galaxy_sampling_util.apply_pycosmo_distfun(dist_fun, z)[source]
galsbi.ucat.galaxy_sampling_util.intp_z_m_cut(cosmo, mag_calc, par)[source]

This function returns an interpolator which predicts the maximum absolute magnitude for a given redshift such that a galaxy will still fall below the limiting apparent magnitude in the reference band (par.gals_mag_max). To do this, we do a check for a number of grid points in redshift. The check consists of finding the template with the smallest ratio of flux in the ref-band at that redshift (apparent flux) and flux in the luminosity function band at redshift zero (absolute flux). We then compute the absolute magnitude a galaxy would need to have to still pass the cut assuming that its spectrum is given by only that one template which we found. This works because the mixing-in of other templates will only make the object brighter in the r-band at this redshift. See also docs/jupyter_notebooks/z_m_cut.ipynb.

galsbi.ucat.lensing_util module

Created on Jul 2, 2021 @author: Tomasz Kacprzak

galsbi.ucat.lensing_util.apply_reduced_shear_to_ellipticities(int_e1, int_e2, g1, g2, ellipticity_unit='distortion')[source]

Applies reduced shear to the intrinsic ellipticities, if unit==’distortion’, then following Bartelmann & Schneider 2001, https://arxiv.org/pdf/astro-ph/9912508.pdf. We use the ellipticity defined in eq. (4.4), which is sheared according to eq. (4.6), “by interchanging χ and χ(s) and replacing g by −g”. if unit==’shear’, then following … :param int_e1: intrinsic ellipticity 1-component :param int_e2: intrinsic ellipticity 2-component :param kappa: kappa :param g1: reduced shear 1-component :param g2: reduced shear 2-component :return e1: sheared ellipticity 1-component :return e2: sheared ellipticity 2-component

galsbi.ucat.lensing_util.apply_shear_to_ellipticities(int_e1, int_e2, kappa, gamma1, gamma2, ellipticity_unit='distortion')[source]

Applies shear to the intrinsic ellipticities, following Bartelmann & Schneider 2001, https://arxiv.org/pdf/astro-ph/9912508.pdf. We use the ellipticity defined in eq. (4.4), which is sheared according to eq. (4.6), “by interchanging χ and χ(s) and replacing g by −g”. :param int_e1: intrinsic ellipticity 1-component :param int_e2: intrinsic ellipticity 2-component :param kappa: kappa :param gamma1: shear 1-component :param gamma2: shear 2-component :return e1: sheared ellipticity 1-component :return e2: sheared ellipticity 2-component

galsbi.ucat.lensing_util.calculate_flux_magnification(kappa, gamma1, gamma2)[source]
galsbi.ucat.lensing_util.calculate_size_magnification(r, kappa)[source]
galsbi.ucat.lensing_util.distortion_to_moments(fwhm, e1, e2, xx_out=None, yy_out=None, xy_out=None)[source]
galsbi.ucat.lensing_util.distortion_to_shear(e1, e2)[source]

Convert shape in distortion units to shear units https://arxiv.org/abs/astro-ph/0107431 eq 2-7, 2-8

galsbi.ucat.lensing_util.fwhm_to_sigma(fwhm)[source]
galsbi.ucat.lensing_util.moments_to_distortion(xx, yy, xy, e1_out=None, e2_out=None, fwhm_out=None)[source]
galsbi.ucat.lensing_util.moments_to_shear(xx, yy, xy, e1_out=None, e2_out=None, fwhm_out=None)[source]
galsbi.ucat.lensing_util.shear_to_distortion(g1, g2)[source]

Convert shape in shear units to distortion units # https://arxiv.org/abs/astro-ph/0107431 # eq 2-7, 2-8

galsbi.ucat.lensing_util.shear_to_moments(g1, g2, fwhm, xx_out=None, yy_out=None, xy_out=None)[source]

Convert shape in shear unit to moments PhD Thesis Tomasz Kacprzak Eqn 2.13

galsbi.ucat.lensing_util.shear_to_reduced_shear(gamma1, gamma2, kappa)[source]

Calculate reduced shear https://arxiv.org/pdf/astro-ph/9407032.pdf1 Eq 2.14

galsbi.ucat.lensing_util.sigma_to_fwhm(sigma)[source]

galsbi.ucat.magnitude_calculator module

Created on Sept 2021 author: Tomasz Kacprzak Code author: Joerg Herbel

galsbi.ucat.magnitude_calculator.AB_mag_to_flux(mag)[source]
class galsbi.ucat.magnitude_calculator.MagCalculatorDirect(filters, sed_templates)[source]

Bases: object

Computes galaxy magnitudes by integrating redshifted and reddened galaxy spectra which are given by a sum of five template spectra. See also docs/jupyter_notebooks/spectra_to_magnitudes.ipynb and docs/jupyter_notebooks/extinction.ipynb.

class galsbi.ucat.magnitude_calculator.MagCalculatorTable(filter_names, filepath_sed_integrals, reload_cache=False, copy_to_cwd=False)[source]

Bases: object

Computes galaxy magnitudes by looking up pre-computed values of the integrals of our template spectra as a function of redshift and extinction E(B-V). The integrals need to be pre-computed for every filter band separately, such that for every filter band, we have five (number of template spectra) 2-dim. tables of integrals with redshift on the one and E(B-V) on the other axis. See also docs/jupyter_notebooks/tabulate_template_integrals.ipynb and docs/jupyter_notebooks/extinction.ipynb.

galsbi.ucat.magnitude_calculator.flux_to_AB_mag(flux)[source]

galsbi.ucat.sed_templates_util module

Created Aug 2021 author: Tomasz Kacprzak code from: Joerg Herbel # ucat/docs/jupyter_notebooks/tabulate_template_integrals.ipynb

galsbi.ucat.sed_templates_util.get_redshift_extinction_grid(z_max, z_stepsize, excess_b_v_max, excess_b_v_stepsize)[source]
galsbi.ucat.sed_templates_util.get_template_integrals(sed_templates, filters, filter_names=None, ids_templates=None, test=False)[source]
galsbi.ucat.sed_templates_util.load_sed_integrals(filepath_sed_integ, filter_names=None, crop_negative=False, sed_templates=None, copy_to_cwd=False)[source]

Loads SED integrals, uses cache. :param filepath_sed_integ: name of the file containing SED template integrals :param filter_names: list of filter name, should be in format Camera_band, but just band is also accepted to ensure backwards compatibility :param crop_negative: if to set all negative elements in the filter to zero :param sed_templates: OrderedDict containing a buffer for templates :param copy_to_cwd: copy the file to the current working directory

galsbi.ucat.sed_templates_util.load_template_spectra(filepath_sed_templates, lam_scale=1, amp_scale=1)[source]
galsbi.ucat.sed_templates_util.store_sed_integrals(filename, integrals, excess_b_v_grid, z_grid)[source]

galsbi.ucat.spectrum_util module

Created on Mar 6, 2018 author: Joerg Herbel

galsbi.ucat.spectrum_util.apply_extinction(spectrum, lam_obs, excess_b_v, extinction_spline)[source]
Parameters:
  • spectrum – (n_gal, n_lambda)

  • lam_obs – (n_lambda,)

  • excess_b_v – (n_gal,)

  • extinction_spline

galsbi.ucat.spectrum_util.construct_intrinsic_spectrum(coeff, templates_amp)[source]
Parameters:
  • templates_amp – (n_templates, n_lambda)

  • coeff – (n_gal, n_templates)

Returns:

(n_gal, n_lambda)

galsbi.ucat.spectrum_util.construct_reddened_spectrum(lam_obs, templates_amp, coeff, excess_b_v, extinction_spline)[source]
Parameters:
  • lam_obs – (n_lambda, )

  • templates_amp – (n_templates, n_lambda)

  • coeff – (n_gal, n_templates)

  • excess_b_v – (n_gal,)

  • extinction_spline

Returns:

(n_gal, n_lambda)

galsbi.ucat.spectrum_util.extinction_coefficient(lam, excess_b_v, spline)[source]

Calculate the extinction coefficient as described in Schlafly et. al. (2011, DOI: 10.1088/0004-637X/737/2/103). The extinction law is the one given by Fitzpatrick (1999, DOI: 10.1086/316293), the extinction map is the one presented in Schlegel et. al. (1998, DOI: 10.1086/305772). :param lam: Wavelength in micrometre :param excess_b_v: Excess E(B-V) in B-V color from the map provided by Schlegel et.

al. (1998, DOI: 10.1086/305772)

Parameters:

spline – Cubic spline for the optical and IR-region according to Fitzpatrick (1999, DOI: 10.1086/316293)

Returns:

Extinction coefficient A_lambda evaluated at the input wavelengths.

galsbi.ucat.spectrum_util.spline_ext_coeff()[source]

Perform the cubic spline interpolation described by Fitzpatrick (1999, DOI: 10.1086/316293) to obtain the extinction law in the optical and IR region (for wavelengths > 2700 Angstrom) :return: spline object than can be evaluated at arbitrary inverse wavelengths

galsbi.ucat.utils module

Created on Jan 03, 2020 author: Joerg Herbel

galsbi.ucat.utils.memory_usage_psutil()[source]

Module contents