Jammy2211 / PyAutoGalaxy

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

Feature/image mesh refactor #138

Closed Jammy2211 closed 7 months ago

Jammy2211 commented 7 months ago

Refactor pixelizations to support separate inputs for the mesh (e.g. Voronoi) and the image-mesh which defines how the image-plane grid of mesh centres are computed.

This means the following API:

pixelization = al.Pixelization(
    mesh=al.mesh.VoronoiMagnification(shape=(25, 25)),
    regularization=al.reg.Constant(coefficient=1.0),
)

Is now the following API (noting that Magnification has been replaced with the nameOverlay`):

pixelization = al.Pixelization(
    image_mesh=al.image_mesh.Overlay(shape=(25, 25)),
    mesh=al.mesh.Voronoi(),
    regularization=al.reg.Constant(coefficient=1.0),
)

For model composition the following API is used:

image_mesh = af.Model(al.image_mesh.Overlay)
image_mesh.shape = (30, 30)

mesh = af.Model(al.mesh.Delaunay)

regularization = af.Model(al.reg.ConstantSplit)

pixelization = af.Model(
    al.Pixelization, 
    image_mesh=image_mesh, 
    mesh=mesh, 
    regularization=regularization
)

Shortly following PR will be a new image_mesh which adapts the pixels via the Hilbert curve.