autolens.twins.transform.ReplaceTotalMassWithStellarPlusDark#

class ReplaceTotalMassWithStellarPlusDark[source]#

Bases: object

Replace the total-mass profile(s) of one galaxy by stellar mass following its MGE light plus a dark-matter halo, keeping the replaced galaxy’s projected mass inside theta_E,parent (the one deliberate preservation, recorded in preserved).

apply(twin) returns (tracer, setup, record) and mutates nothing:

  • every MassProfile attribute of the galaxy that is not light and not an ExternalShear (e.g. its Isothermal) is removed;

  • the light basis attribute light is replaced by the stellar Basis of lmp.Gaussian that ag.MassBudget solves. Its members copy the centre, ell_comps, sigma and intensity of the light Gaussians, so the galaxy’s light is unchanged and its stellar mass is Upsilon times that light. (Adding the stellar basis beside the light basis would count the light twice.)

  • the dark profile is added as the attribute dark_name, centred on the light;

  • external shear (galaxy attribute or tracer field), the source and all other galaxies are unchanged (keep_shear=False removes the replaced galaxy’s ExternalShear attributes and the tracer’s ExternalShear fields).

The aperture is einstein_radius_aperture_from(tracer, setup.grid, centre): the whole parent tracer’s Einstein radius, centred on the replaced mass centre.

Parameters:
  • galaxy (str) – The galaxy to transform: its name in the tracer (the key of the fit’s af.Collection, e.g. "lens", or "galaxy_<index>" for a tracer built from a list), or a role from the reference’s provenance roles.

  • light (str) – The name of the galaxy’s MGE light attribute: a Basis of solved-intensity lp.Gaussian profiles (linear, operated or non-Gaussian members raise ProfileException: they have no lmp.Gaussian counterpart).

  • scale_radius_kpc (float) – The fixed dark-profile scale radius, in kpc (ruling R4). It is converted to arc-seconds with cosmology.arcsec_per_kpc_from(redshift=galaxy.redshift), the cosmology being the setup’s, or the tracer’s when the setup has none.

  • f_dark (float) – The dark fraction of the replaced mass inside theta_E,parent (stellar fraction 1 - f_dark). Ignored when budget is given.

  • budget (Union[MassBudget, Dict[str, Dict[str, float]], None]) – Alternatively an ag.MassBudget or its fractions dictionary, {galaxy: {"stellar": f_*, "dark": f_dark}}; only its fractions are used (the aperture is always the Einstein-radius aperture). A budget naming more than one galaxy raises NotImplementedError (ruling R7).

  • dark_cls – The dark profile class; al.mp.NFWSph by default, or e.g. al.mp.gNFWSph with inner_slope passed in dark_fixed.

  • keep_shear (bool) – Keep the external shear (default). It never enters M_ref.

  • aperture_settings (Optional[Dict]) – sub_size_interior, sub_size_edge, sub_size_centre and centre_refine_pixels of the aperture integrator (defaults: those of ag.CircularAperture). A gNFW convergence does one quad per point, so pass coarse sub-sizes for it (e.g. 2, 4, 4).

  • einstein_radius_pixel_scale (float) – The resolution of the grid on which the critical curve, and so theta_E, is traced.

  • grid (Optional[Grid2D]) – The uniform grid on which aperture masses are integrated; defaults to the setup mask’s full (unmasked) geometry. The aperture must lie within it.

  • dark_name (str) – The galaxy attribute the dark profile is stored as.

  • dark_fixed – Further fixed constructor arguments of dark_cls, e.g. inner_slope.

Methods

apply

requested

The requested arguments, as plain data (grid as its geometry).

Attributes

property f_dark: float#
requested()[source]#

The requested arguments, as plain data (grid as its geometry).

apply(twin)[source]#