autolens.MassField#

class MassField[source]#

Bases: ModelObject, MassProfileAggregate

Class representing the external mass field at a given redshift.

Parameters:
  • redshift (float) – The redshift of the external field.

  • kwargs – The named mass components of the field (e.g. shear, mass_sheet, potential), each of which must be a MassProfile.

Methods

cls_list_from

Returns a list of objects in the galaxy which are an instance of the input cls.

convergence_2d_from

Returns the summed 2D convergence of the galaxy's mass profiles from a 2D grid of Cartesian (y,x) coordinates.

deflections_yx_2d_from

Returns the summed 2D deflection angles of the galaxy's mass profiles from a 2D grid of Cartesian (y,x) coordinates.

dict

A dictionary representation of this object

extract_attribute

Returns an attribute of a class and its children profiles in the galaxy as a ValueIrregular or Grid2DIrregular object.

from_dict

Recursively parse a dictionary returning the model, collection or instance that is represents.

has

Does this instance have an attribute which is of type cls?

image_2d_from

Returns a 2D image of zeros, because a MassField has no light.

image_2d_list_from

Returns an empty list, because a MassField holds no light profiles.

image_2d_list_unbinned_from

Returns an empty list: a MassField holds no light profiles to evaluate before binning.

image_2d_unbinned_from

Returns zeros on the over-sampled grid, mirroring the light-less path of Galaxy.

next_id

potential_2d_from

Returns the summed 2D potential of the galaxy's mass profiles from a 2D grid of Cartesian (y,x) coordinates.

replacing_for_path

Create a new model replacing the value for a given path with a new value

Attributes

component_number

identifier

label

profile_dict

property profile_dict: Dict#
dict()[source]#

A dictionary representation of this object

image_2d_list_from(grid, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautolens/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>, operated_only=None)[source]#

Returns an empty list, because a MassField holds no light profiles.

The Galaxies class builds its list of images by calling this on each member, so the field simply contributes nothing to it.

image_2d_list_unbinned_from(grid, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautolens/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>, operated_only=None)[source]#

Returns an empty list: a MassField holds no light profiles to evaluate before binning.

image_2d_from(grid, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautolens/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>, operated_only=None)[source]#

Returns a 2D image of zeros, because a MassField has no light.

This mirrors the zeros returned by Galaxy.image_2d_from for a galaxy with no light profiles, so the sum performed by Galaxies.image_2d_from is unaffected by the presence of a field.

image_2d_unbinned_from(grid, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautolens/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>, operated_only=None)[source]#

Returns zeros on the over-sampled grid, mirroring the light-less path of Galaxy.