slsim.Deflectors package

Subpackages

Submodules

slsim.Deflectors.deflector module

class slsim.Deflectors.deflector.Deflector(deflector_type, **kwargs)[source]

Bases: object

Class of a single deflector with quantities only related to the deflector (independent of the source)

property angular_size_light

Angular size of the light component.

Returns:

angular size [arcsec]

property deflector_center

Center of the deflector position.

Returns:

[x_pox, y_pos] in arc seconds

property halo_properties

Properties of the NFW halo.

Returns:

halo mass M200 [physical M_sol], concentration r200/rs

property light_ellipticity

Light ellipticity. Defined as:

\[e1 = \frac{1-q}{1+q} * cos(2 \phi) e2 = \frac{1-q}{1+q} * sin(2 \phi)\]

with q being the minor-to-major axis ratio.

Returns:

e1_light, e2_light

light_model_lenstronomy(band=None)[source]

Returns lens model instance and parameters in lenstronomy conventions.

Parameters:

band (str) – imaging band

Returns:

lens_light_model_list, kwargs_lens_light

magnitude(band)[source]

Apparent magnitude of the deflector for a given band.

Parameters:

band (string) – imaging band

Returns:

magnitude of deflector in given band

property mass_ellipticity

Mass ellipticity Defined as:

\[e1 = \frac{1-q}{1+q} * cos(2 \phi) e2 = \frac{1-q}{1+q} * sin(2 \phi)\]

with q being the minor-to-major axis ratio.

Returns:

e1_mass, e2_mass

mass_model_lenstronomy(lens_cosmo)[source]

Returns lens model instance and parameters in lenstronomy conventions.

Parameters:

lens_cosmo (LensCosmo instance) – lens cosmology model

Returns:

lens_mass_model_list, kwargs_lens_mass

property name

Meaningful name string of the deflector.

Returns:

name string

property redshift

Deflector redshift.

Returns:

redshift

property stellar_mass
Returns:

stellar mass of deflector [M_sol]

surface_brightness(ra, dec, band=None)[source]

Surface brightness at position ra/dec.

Parameters:
  • ra – position RA

  • dec – position DEC

  • band (str) – imaging band

Returns:

surface brightness at postion ra/dec [mag / arcsec^2]

theta_e_infinity(cosmo, multi_plane=None, use_jax=True)[source]

Einstein radius for a source at infinity (or well passed where galaxies exist.

Parameters:
  • cosmo (cosmology class) – astropy.cosmology instance

  • use_jax (bool) – use JAX-accelerated lens models for lensing calculations, if available

  • multi_plane (None or str) – None for single-plane, ‘Source’ for multi- source plane, ‘Deflector’ for multi-deflector plane, or ‘Both’ for both multi-deflector and multi-source plane

Returns:

Einstein radius for source at infinite [arcsec]

Returns:

Einstein radius [arcsec]

update_center(deflector_area)[source]

Overwrites the deflector center position.

Parameters:

deflector_area – area (in solid angle arcseconds^2) to dither the center of the deflector

Returns:

velocity_dispersion(cosmo=None)[source]

Velocity dispersion of deflector.

Parameters:

cosmo (cosmology class) – cosmology

Returns:

velocity dispersion [km/s]

Module contents

class slsim.Deflectors.AllLensGalaxies(red_galaxy_list, blue_galaxy_list, kwargs_cut, kwargs_mass2light, cosmo, sky_area, gamma_pl=None, catalog_type='skypy')[source]

Bases: DeflectorsBase

Class describing all-type galaxies.

deflector_number()[source]
Returns:

number of deflectors after applied cuts

draw_deflector()[source]
Returns:

dictionary of complete parameterization of a deflector

class slsim.Deflectors.ClusterDeflectors(cluster_list, members_list, galaxy_list, kwargs_cut, kwargs_mass2light, cosmo, sky_area, catalog_type='skypy', richness_fn='Abdullah2022', kwargs_draw_members=None, assign_galaxy_redshift=False, cored_profile=False)[source]

Bases: DeflectorsBase

Class describing cluster lens model with a NFW profile for the dark matter halo and EPL profile for the subhalos (cluster members). It makes use of a group/cluster catalog and a group/cluster member catalog (e.g. redMaPPer).

This class is called by setting deflector_type == “cluster-catalog” in LensPop.

static assign_similar_galaxy(members_list, galaxy_list, cosmo=None, bands=('g', 'r', 'i', 'z', 'Y'), max_gals=10000, assign_galaxy_redshift=False)[source]

Assigns a similar galaxy to each member of a group/cluster member catalog by comparing their magnitudes and redshifts.

Parameters:
  • members_list (astropy.table.Table) – astropy table with columns ‘mag_{band}’, ‘z’

  • galaxy_list (astropy.table.Table) – astropy table with columns ‘mag_{band}’, ‘z’

  • cosmo (astropy.cosmology) – astropy.cosmology instance

  • bands (list) – list of bands to compare

  • max_gals (int) – maximum number of galaxies to compare to

  • assign_galaxy_redshift (bool) – if True, assign the redshift of the galaxy to the member galaxy instead of the cluster redshift

Returns:

astropy table with the same number of rows as members_list and columns from both members_list and galaxy_list

Return type:

astropy.table.Table

deflector_number()[source]
Returns:

number of deflectors

draw_cluster(index)[source]
Parameters:

index (int) – index of cluster in catalog

Returns:

dictionary of NFW parameters for the cluster halo

draw_deflector(index=None)[source]
Parameters:
  • index (int or None) – index of deflector, if not provided, draw randomly from all deflectors

  • cored (True for cored, False for cuspy profile) – Boolean flag for cored density profile

Returns:

dictionary of complete parameterization of deflector

draw_members(cluster_id, center_scatter=0.2, max_dist=80, bcg_band='r')[source]
Parameters:
  • cluster_id (int) – identifier of the cluster

  • center_scatter (float) – scatter in center of the BCG in arcsec

  • max_dist (float) – maximum distance from the BCG in arcsec

bcg_band: band to use to identify the BCG :type bcg_band: str :return: astropy table with EPL+Sersic parameters of each member

get_deflector(cluster_id, cored=False)[source]
Parameters:
  • cluster_id (int) – identifier of the cluster

  • cored (True for cored, False for cuspy profile) – Boolean flag for cored density profile

Returns:

dictionary of complete parameterization of deflector for the given cluster_id

static preprocess_clusters(cluster_list)[source]
preprocess_members(cluster_list, members_list, galaxy_list, assign_galaxy_redshift=False)[source]
set_cosmo()[source]

Set the cosmology in colossus to match the astropy.cosmology instance.

class slsim.Deflectors.CompoundLensHalosGalaxies(halo_galaxy_list, kwargs_cut, kwargs_mass2light, cosmo, sky_area)[source]

Bases: DeflectorsBase

Class describing compound lens model in which the mass distribution of individual lens objects is described by a superposition of dark matter and stellar components.

This class is called by setting deflector_type == “halo-models” in LensPop.

deflector_number()[source]
Returns:

number of deflectors

draw_deflector()[source]
Returns:

dictionary of complete parameterization of deflector

class slsim.Deflectors.Deflector(deflector_type, **kwargs)[source]

Bases: object

Class of a single deflector with quantities only related to the deflector (independent of the source)

property angular_size_light

Angular size of the light component.

Returns:

angular size [arcsec]

property deflector_center

Center of the deflector position.

Returns:

[x_pox, y_pos] in arc seconds

property halo_properties

Properties of the NFW halo.

Returns:

halo mass M200 [physical M_sol], concentration r200/rs

property light_ellipticity

Light ellipticity. Defined as:

\[e1 = \frac{1-q}{1+q} * cos(2 \phi) e2 = \frac{1-q}{1+q} * sin(2 \phi)\]

with q being the minor-to-major axis ratio.

Returns:

e1_light, e2_light

light_model_lenstronomy(band=None)[source]

Returns lens model instance and parameters in lenstronomy conventions.

Parameters:

band (str) – imaging band

Returns:

lens_light_model_list, kwargs_lens_light

magnitude(band)[source]

Apparent magnitude of the deflector for a given band.

Parameters:

band (string) – imaging band

Returns:

magnitude of deflector in given band

property mass_ellipticity

Mass ellipticity Defined as:

\[e1 = \frac{1-q}{1+q} * cos(2 \phi) e2 = \frac{1-q}{1+q} * sin(2 \phi)\]

with q being the minor-to-major axis ratio.

Returns:

e1_mass, e2_mass

mass_model_lenstronomy(lens_cosmo)[source]

Returns lens model instance and parameters in lenstronomy conventions.

Parameters:

lens_cosmo (LensCosmo instance) – lens cosmology model

Returns:

lens_mass_model_list, kwargs_lens_mass

property name

Meaningful name string of the deflector.

Returns:

name string

property redshift

Deflector redshift.

Returns:

redshift

property stellar_mass
Returns:

stellar mass of deflector [M_sol]

surface_brightness(ra, dec, band=None)[source]

Surface brightness at position ra/dec.

Parameters:
  • ra – position RA

  • dec – position DEC

  • band (str) – imaging band

Returns:

surface brightness at postion ra/dec [mag / arcsec^2]

theta_e_infinity(cosmo, multi_plane=None, use_jax=True)[source]

Einstein radius for a source at infinity (or well passed where galaxies exist.

Parameters:
  • cosmo (cosmology class) – astropy.cosmology instance

  • use_jax (bool) – use JAX-accelerated lens models for lensing calculations, if available

  • multi_plane (None or str) – None for single-plane, ‘Source’ for multi- source plane, ‘Deflector’ for multi-deflector plane, or ‘Both’ for both multi-deflector and multi-source plane

Returns:

Einstein radius for source at infinite [arcsec]

Returns:

Einstein radius [arcsec]

update_center(deflector_area)[source]

Overwrites the deflector center position.

Parameters:

deflector_area – area (in solid angle arcseconds^2) to dither the center of the deflector

Returns:

velocity_dispersion(cosmo=None)[source]

Velocity dispersion of deflector.

Parameters:

cosmo (cosmology class) – cosmology

Returns:

velocity dispersion [km/s]

class slsim.Deflectors.DeflectorsBase(deflector_table, kwargs_cut, cosmo, sky_area, gamma_pl=None, deflector_type='EPL_SERSIC')[source]

Bases: ABC

Abstract Base Class to create a class that accesses a set of deflectors.

All object that inherit from Lensed System must contain the methods it contains.

abstractmethod deflector_number()[source]
Returns:

number of deflectors after applied cuts

abstractmethod draw_deflector()[source]
Returns:

dictionary of complete parameterization of deflector

class slsim.Deflectors.EllipticalLensGalaxies(galaxy_list, kwargs_cut, kwargs_mass2light, cosmo, sky_area, gamma_pl=None, catalog_type='skypy')[source]

Bases: DeflectorsBase

Class describing elliptical galaxies.

deflector_number()[source]
Returns:

number of deflectors

draw_deflector()[source]
Returns:

dictionary of complete parameterization of deflector