lenstronomy.LensModel.MultiPlane package

Submodules

lenstronomy.LensModel.MultiPlane.multi_plane module

class lenstronomy.LensModel.MultiPlane.multi_plane.LensedLocation(multiplane_instance, observed_convention_index)[source]

Bases: object

center_x and center_y kwargs correspond to observed (lensed) locations of deflectors given a model for the line of sight structure, compute the angular position of the deflector without lensing contribution along the LOS

class lenstronomy.LensModel.MultiPlane.multi_plane.MultiPlane(z_source, lens_model_list, lens_redshift_list, cosmo=None, numerical_alpha_class=None, observed_convention_index=None, ignore_observed_positions=False, z_source_convention=None, cosmo_interp=False, z_interp_stop=None, num_z_interp=100, kwargs_interp=None)[source]

Bases: object

Multi-plane lensing class with option to assign positions of a selected set of lens models in the observed plane.

The lens model deflection angles are in units of reduced deflections from the specified redshift of the lens to the source redshift of the class instance.

alpha(theta_x, theta_y, kwargs_lens, check_convention=True, k=None)[source]

reduced deflection angle

Parameters
  • theta_x – angle in x-direction

  • theta_y – angle in y-direction

  • kwargs_lens – lens model kwargs

  • check_convention – flag to check the image position convention (leave this alone)

Returns

deflection angles in x and y directions

arrival_time(theta_x, theta_y, kwargs_lens, check_convention=True)[source]

light travel time relative to a straight path through the coordinate (0,0) Negative sign means earlier arrival time

Parameters
  • theta_x – angle in x-direction on the image

  • theta_y – angle in y-direction on the image

  • kwargs_lens – lens model keyword argument list

Returns

travel time in unit of days

co_moving2angle_source(x, y)[source]

special case of the co_moving2angle definition at the source redshift

Parameters
  • x – co-moving distance

  • y – co-moving distance

Returns

angles on the sky at the nominal source plane

geo_shapiro_delay(theta_x, theta_y, kwargs_lens, check_convention=True)[source]

geometric and Shapiro (gravitational) light travel time relative to a straight path through the coordinate (0,0) Negative sign means earlier arrival time

Parameters
  • theta_x – angle in x-direction on the image

  • theta_y – angle in y-direction on the image

  • kwargs_lens – lens model keyword argument list

  • check_convention – boolean, if True goes through the lens model list and checks whether the positional conventions are satisfied.

Returns

geometric delay, gravitational delay [days]

hessian(theta_x, theta_y, kwargs_lens, k=None, diff=1e-08, check_convention=True)[source]

computes the hessian components f_xx, f_yy, f_xy from f_x and f_y with numerical differentiation

Parameters
  • theta_x (numpy array) – x-position (preferentially arcsec)

  • theta_y (numpy array) – y-position (preferentially arcsec)

  • kwargs_lens – list of keyword arguments of lens model parameters matching the lens model classes

  • diff – numerical differential step (float)

  • check_convention – boolean, if True goes through the lens model list and checks whether the positional conventions are satisfied.

Returns

f_xx, f_xy, f_yx, f_yy

observed2flat_convention(kwargs_lens)[source]
Parameters

kwargs_lens – keyword argument list of lens model parameters in the observed convention

Returns

kwargs_lens positions mapped into angular position without lensing along its LOS

ray_shooting(theta_x, theta_y, kwargs_lens, check_convention=True, k=None)[source]

ray-tracing (backwards light cone) to the default z_source redshift

Parameters
  • theta_x – angle in x-direction on the image (usually arc seconds, in the same convention as lensing deflection angles)

  • theta_y – angle in y-direction on the image (usually arc seconds, in the same convention as lensing deflection angles)

  • kwargs_lens – lens model keyword argument list

  • check_convention – flag to check the image position convention (leave this alone)

Returns

angles in the source plane

ray_shooting_partial(x, y, alpha_x, alpha_y, z_start, z_stop, kwargs_lens, include_z_start=False, check_convention=True, T_ij_start=None, T_ij_end=None)[source]

ray-tracing through parts of the coin, starting with (x,y) co-moving distances and angles (alpha_x, alpha_y) at redshift z_start and then backwards to redshift z_stop

Parameters
  • x – co-moving position [Mpc] / angle definition

  • y – co-moving position [Mpc] / angle definition

  • alpha_x – ray angle at z_start [arcsec]

  • alpha_y – ray angle at z_start [arcsec]

  • z_start – redshift of start of computation

  • z_stop – redshift where output is computed

  • kwargs_lens – lens model keyword argument list

  • include_z_start – bool, if True, includes the computation of the deflection angle at the same redshift as the start of the ray-tracing. ATTENTION: deflection angles at the same redshift as z_stop will be computed! This can lead to duplications in the computation of deflection angles.

  • check_convention – flag to check the image position convention (leave this alone)

  • T_ij_start – transverse angular distance between the starting redshift to the first lens plane to follow. If not set, will compute the distance each time this function gets executed.

  • T_ij_end – transverse angular distance between the last lens plane being computed and z_end. If not set, will compute the distance each time this function gets executed.

Returns

co-moving position (modulo angle definition) and angles at redshift z_stop

set_dynamic()[source]
Returns

set_static(kwargs)[source]
Parameters

kwargs – lens model keyword argument list

Returns

lens model keyword argument list with positional parameters all in flat sky coordinates

transverse_distance_start_stop(z_start, z_stop, include_z_start=False)[source]

computes the transverse distance (T_ij) that is required by the ray-tracing between the starting redshift and the first deflector afterwards and the last deflector before the end of the ray-tracing.

Parameters
  • z_start – redshift of the start of the ray-tracing

  • z_stop – stop of ray-tracing

  • include_z_start – bool, i

Returns

T_ij_start, T_ij_end

update_source_redshift(z_source)[source]

update instance of this class to compute reduced lensing quantities and time delays to a specific source redshift

Parameters

z_source – float; source redshift

Returns

self variables update to new redshift

class lenstronomy.LensModel.MultiPlane.multi_plane.PhysicalLocation[source]

Bases: object

center_x and center_y kwargs correspond to angular location of deflectors without lensing along the LOS

lenstronomy.LensModel.MultiPlane.multi_plane_base module

class lenstronomy.LensModel.MultiPlane.multi_plane_base.MultiPlaneBase(lens_model_list, lens_redshift_list, z_source_convention, cosmo=None, numerical_alpha_class=None, cosmo_interp=False, z_interp_stop=None, num_z_interp=100, kwargs_interp=None)[source]

Bases: lenstronomy.LensModel.profile_list_base.ProfileListBase

Multi-plane lensing class

The lens model deflection angles are in units of reduced deflections from the specified redshift of the lens to the source redshift of the class instance.

geo_shapiro_delay(theta_x, theta_y, kwargs_lens, z_stop, T_z_stop=None, T_ij_end=None)[source]

geometric and Shapiro (gravitational) light travel time relative to a straight path through the coordinate (0,0) Negative sign means earlier arrival time

Parameters
  • theta_x – angle in x-direction on the image

  • theta_y – angle in y-direction on the image

  • kwargs_lens – lens model keyword argument list

  • z_stop – redshift of the source to stop the backwards ray-tracing

  • T_z_stop – optional, transversal angular distance from z=0 to z_stop

  • T_ij_end – optional, transversal angular distance between the last lensing plane and the source plane

Returns

dt_geo, dt_shapiro, [days]

ray_shooting_partial(x, y, alpha_x, alpha_y, z_start, z_stop, kwargs_lens, include_z_start=False, T_ij_start=None, T_ij_end=None)[source]

ray-tracing through parts of the coin, starting with (x,y) co-moving distances and angles (alpha_x, alpha_y) at redshift z_start and then backwards to redshift z_stop

Parameters
  • x – co-moving position [Mpc]

  • y – co-moving position [Mpc]

  • alpha_x – ray angle at z_start [arcsec]

  • alpha_y – ray angle at z_start [arcsec]

  • z_start – redshift of start of computation

  • z_stop – redshift where output is computed

  • kwargs_lens – lens model keyword argument list

  • include_z_start – bool, if True, includes the computation of the deflection angle at the same redshift as the start of the ray-tracing. ATTENTION: deflection angles at the same redshift as z_stop will be computed always! This can lead to duplications in the computation of deflection angles.

  • T_ij_start – transverse angular distance between the starting redshift to the first lens plane to follow. If not set, will compute the distance each time this function gets executed.

  • T_ij_end – transverse angular distance between the last lens plane being computed and z_end. If not set, will compute the distance each time this function gets executed.

Returns

co-moving position and angles at redshift z_stop

transverse_distance_start_stop(z_start, z_stop, include_z_start=False)[source]

computes the transverse distance (T_ij) that is required by the ray-tracing between the starting redshift and the first deflector afterwards and the last deflector before the end of the ray-tracing.

Parameters
  • z_start – redshift of the start of the ray-tracing

  • z_stop – stop of ray-tracing

  • include_z_start – boolean, if True includes the computation of the starting position if the first deflector is at z_start

Returns

T_ij_start, T_ij_end

Module contents