Jammy2211 / PyAutoGalaxy

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

Feature/basis #36

Closed Jammy2211 closed 2 years ago

Jammy2211 commented 2 years ago

A Basis is a list of light profiles used to model a Galaxy light profile, for example 10 Gaussian's:

gaussian_m = af.UniformPrior(lower_limit=0.0, upper_limit=1.0)
gaussian_c = af.UniformPrior(lower_limit=0.0, upper_limit=10.0)

gaussians = af.Collection([af.Model(ag.lp_linear.EllGaussian) for i in range(10)])

for i, gaussian in enumerate(gaussians):

    gaussian.centre = gaussians[0].centre
    gaussian.elliptical_comps = gaussians[0].elliptical_comps
    gaussian.sigma = (gaussian_m * i) + gaussian_c

bulge = af.Model(ag.lp_basis.Basis, light_profile_list=gaussians, regularization=ag.reg.Constant)

galaxy = af.Model(ag.Galaxy, redshift=0.5, bulge=bulge)

model = af.Collection(galaxies=af.Collection(galaxy=galaxy))

This PR implements the Basis class in the source code.

A Basis can be regularized based on the light profiles it contains. This required the Inversion module to be extended to support lists of light profiles being linear solved for (with regularization), which makes up most the work in this PR.

There is a lot of docs missing, which I will add in a future PR. There is another bigish refactor coming after this PR in the same parts of the code -- but this branch has had a lot of work done to it so I figure its best to get a review done now.