Jammy2211 / PyAutoGalaxy

PyAutoGalaxy: Open-Source Multiwavelength Galaxy Structure & Morphology
https://pyautogalaxy.readthedocs.io/
MIT License
27 stars 13 forks source link

Feature/multipoles #103

Closed Jammy2211 closed 1 year ago

Jammy2211 commented 1 year ago

Extends the PowerLawMultipoleM4 model previously implemented to support an input value of m (e.g. m=3, m=4, etc).

The following SLaM scripts show how to use the multipole, which must be paired to a separate PowerLaw model:

https://github.com/Jammy2211/autolens_workspace_test/blob/main/slam/integration/source_lp/mass_total/base.py https://github.com/Jammy2211/autolens_workspace_test/blob/main/slam/mass_total.py

Model composition is performed as follows:

analysis = al.AnalysisImaging(
    dataset=imaging, adapt_result=source_lp_results.last
)

multipole = af.Model(al.mp.PowerLawMultipole)
multipole.m = 4

mass_results = slam.mass_total.run(
    settings_autofit=settings_autofit,
    analysis=analysis,
    setup_adapt=setup_adapt,
    source_results=source_lp_results,
    light_results=light_results,
    mass=af.Model(al.mp.PowerLaw),
    multipole=multipole,
    reset_shear_prior=True
)

This is paired to the power-law in the SLaM pipeline:

    if multipole is not None:

        multipole.centre = mass.centre
        multipole.einstein_radius = mass.einstein_radius
        multipole.slope = mass.slope

I have also added a reset_shear_prior input:

    if not reset_shear_prior:
        shear = source_results[0].model.galaxies.lens.shear
    else:
        shear = al.mp.ExternalShear

I recommend we use this for multipole fits, because the external shear can absorb missing azimuthal structure in the lens (e.g. Amy's paper).

Jammy2211 commented 1 year ago

You may also need to pull PyAutoLens main