lenstronomy.PointSource.Types package

Submodules

lenstronomy.PointSource.Types.base_ps module

class PSBase(lens_model=None, fixed_magnification=False, additional_images=False, index_lens_model_list=None, point_source_frame_list=None, redshift=None)[source]

Bases: object

Base point source type class.

__init__(lens_model=None, fixed_magnification=False, additional_images=False, index_lens_model_list=None, point_source_frame_list=None, redshift=None)[source]
Parameters:
  • lens_model – instance of the LensModel() class

  • fixed_magnification – bool. If True, magnification ratio of point sources is fixed to the one given by the lens model

  • additional_images – bool. If True, search for additional images of the same source is conducted.

  • index_lens_model_list – list (length of different patches/bands) of integer lists, evaluating a subset of the lens models per individual bands. e.g., [[0], [2, 3], [1]] assigns the 0th lens model to the 0th band, the 2nd and 3rd lens models to the 1st band, and the 1st lens model to the 2nd band. If this keyword is set, the image positions need to have a specified band/frame assigned to it

  • point_source_frame_list – list of ints assigning each image to a specific band/frame. Only relevant in LENSED_POSITION. e.g. if LENSED_POSITION contains 4 images, we can assign them each to one of the bands with point_source_frame_list = [1, 2, 0, 1], where point_source_frame_list[i] = n means that the i-th image belongs to band n.

  • redshift (None or float) – redshift of the source, only required for multiple source redshifts

image_position(kwargs_ps, **kwargs)[source]

On-sky position.

Parameters:

kwargs_ps – keyword argument of point source model

Returns:

numpy array of x, y image positions

source_position(kwargs_ps, **kwargs)[source]

Original unlensed position.

Parameters:

kwargs_ps – keyword argument of point source model

Returns:

numpy array of x, y source positions

image_amplitude(kwargs_ps, *args, **kwargs)[source]

Amplitudes as observed on the sky.

Parameters:
  • kwargs_ps – keyword argument of point source model

  • kwargs – keyword arguments of function call

Returns:

numpy array of amplitudes

source_amplitude(kwargs_ps, **kwargs)[source]

Intrinsic source amplitudes (without lensing magnification, but still apparent)

Parameters:
  • kwargs_ps – keyword argument of point source model

  • kwargs – keyword arguments of function call (which are not used for this object

Returns:

numpy array of amplitudes

update_lens_model(lens_model_class)[source]

Update LensModel() and LensEquationSolver() instance.

Parameters:

lens_model_class – LensModel() class instance

Returns:

internal LensModel class updated

lenstronomy.PointSource.Types.lensed_position module

class LensedPositions(lens_model=None, fixed_magnification=False, additional_images=False, index_lens_model_list=None, point_source_frame_list=None, redshift=None)[source]

Bases: PSBase

class of a lensed point source parameterized as the (multiple) observed image positions Name within the PointSource module: ‘LENSED_POSITION’ parameters: :param ra_image: list or array of floats :param dec_image: list or array of floats :param point_amp: list or array of floats

If fixed_magnification=True, then ‘source_amp’ is a parameter instead of ‘point_amp’

source_amp: float

image_position(kwargs_ps, kwargs_lens=None, magnification_limit=None, kwargs_lens_eqn_solver=None, additional_images=False)[source]

On-sky image positions.

Parameters:
  • kwargs_ps – keyword arguments of the point source model

  • kwargs_lens – keyword argument list of the lens model(s), only used when requiring the lens equation solver

  • magnification_limit – float >0 or None, if float is set and additional images are computed, only those images will be computed that exceed the lensing magnification (absolute value) limit

  • kwargs_lens_eqn_solver – keyword arguments specifying the numerical settings for the lens equation solver see LensEquationSolver() class for details

  • additional_images (bool) – if True, solves the lens equation for additional images

Returns:

image positions in x, y as arrays

source_position(kwargs_ps, kwargs_lens=None)[source]

Original source position (prior to lensing)

Parameters:
  • kwargs_ps – point source keyword arguments

  • kwargs_lens – lens model keyword argument list (required to ray-trace back in the source plane)

Returns:

x, y position (as numpy arrays)

image_amplitude(kwargs_ps, kwargs_lens=None, x_pos=None, y_pos=None, magnification_limit=None, kwargs_lens_eqn_solver=None)[source]

Image brightness amplitudes.

Parameters:
  • kwargs_ps – keyword arguments of the point source model

  • kwargs_lens – keyword argument list of the lens model(s), only used when requiring the lens equation solver

  • x_pos – pre-computed image position (no lens equation solver applied)

  • y_pos – pre-computed image position (no lens equation solver applied)

  • magnification_limit – float >0 or None, if float is set and additional images are computed, only those images will be computed that exceed the lensing magnification (absolute value) limit

  • kwargs_lens_eqn_solver – keyword arguments specifying the numerical settings for the lens equation solver see LensEquationSolver() class for details

Returns:

array of image amplitudes

source_amplitude(kwargs_ps, kwargs_lens=None)[source]

Intrinsic brightness amplitude of point source When brightnesses are defined in magnified on-sky positions, the intrinsic brightness is computed as the mean in the magnification corrected image position brightnesses.

Parameters:
  • kwargs_ps – keyword arguments of the point source model

  • kwargs_lens – keyword argument list of the lens model(s), used when brightness are defined in magnified on-sky positions

Returns:

brightness amplitude (as numpy array)

lenstronomy.PointSource.Types.source_position module

class SourcePositions(lens_model=None, fixed_magnification=False, additional_images=False, index_lens_model_list=None, point_source_frame_list=None, redshift=None)[source]

Bases: PSBase

Class of a single point source defined in the original source coordinate position that is lensed. The lens equation is solved to compute the image positions for the specified source position.

Name within the PointSource module: ‘SOURCE_POSITION’ parameters: :param ra_source: float :param dec_source: float :param source_amp: float :param mag_pert: optional list of fractional magnification pertubations applied to point source images

image_position(kwargs_ps, kwargs_lens=None, magnification_limit=None, kwargs_lens_eqn_solver=None, **kwargs)[source]

On-sky image positions.

Parameters:
  • kwargs_ps – keyword arguments of the point source model

  • kwargs_lens – keyword argument list of the lens model(s), only used when requiring the lens equation solver

  • magnification_limit – float >0 or None, if float is set, only those images will be computed that exceed the lensing magnification (absolute value) limit

  • kwargs_lens_eqn_solver – keyword arguments specifying the numerical settings for the lens equation solver see LensEquationSolver() class for details

Returns:

image positions in x, y as arrays

source_position(kwargs_ps, **kwargs)[source]

Original source position (prior to lensing)

Parameters:

kwargs_ps – point source keyword arguments

Returns:

x, y position (as numpy arrays)

image_amplitude(kwargs_ps, kwargs_lens=None, x_pos=None, y_pos=None, magnification_limit=None, kwargs_lens_eqn_solver=None)[source]

Image brightness amplitudes.

Parameters:
  • kwargs_ps – keyword arguments of the point source model

  • kwargs_lens – keyword argument list of the lens model(s), only ignored when providing image positions directly

  • x_pos – pre-computed image position (no lens equation solver applied)

  • y_pos – pre-computed image position (no lens equation solver applied)

  • magnification_limit – float >0 or None, if float is set, only those images will be computed that exceed the lensing magnification (absolute value) limit

  • kwargs_lens_eqn_solver – keyword arguments specifying the numerical settings for the lens equation solver see LensEquationSolver() class for details

Returns:

array of image amplitudes

source_amplitude(kwargs_ps, kwargs_lens=None)[source]

Intrinsic brightness amplitude of point source When brightnesses are defined in magnified on-sky positions, the intrinsic brightness is computed as the mean in the magnification corrected image position brightnesses.

Parameters:
  • kwargs_ps – keyword arguments of the point source model

  • kwargs_lens – keyword argument list of the lens model(s), used when brightness are defined in magnified on-sky positions

Returns:

brightness amplitude (as numpy array)

lenstronomy.PointSource.Types.unlensed module

class Unlensed(lens_model=None, fixed_magnification=False, additional_images=False, index_lens_model_list=None, point_source_frame_list=None, redshift=None)[source]

Bases: PSBase

class of a single point source in the image plane, aka star Name within the PointSource module: ‘UNLENSED’ This model can deal with arrays of point sources. parameters: :param ra_image: list or array of floats :param dec_image: list or array of floats :param point_amp: list or array of floats

image_position(kwargs_ps, **kwargs)[source]

On-sky position.

Parameters:

kwargs_ps – keyword argument of point source model

Returns:

numpy array of x, y image positions

source_position(kwargs_ps, **kwargs)[source]

Original physical position (identical for this object)

Parameters:

kwargs_ps – keyword argument of point source model

Returns:

numpy array of x, y source positions

image_amplitude(kwargs_ps, **kwargs)[source]

Amplitudes as observed on the sky.

Parameters:
  • kwargs_ps – keyword argument of point source model

  • kwargs – keyword arguments of function call (which are not used for this object

Returns:

numpy array of amplitudes

source_amplitude(kwargs_ps, **kwargs)[source]

Intrinsic source amplitudes.

Parameters:
  • kwargs_ps – keyword argument of point source model

  • kwargs – keyword arguments of function call (which are not used for this object

Returns:

numpy array of amplitudes

Module contents