Skip to main content

Open Source Galaxy Model-Fitting

Project description

PyAutoGalaxy

The study of a galaxy's light, structure and dynamics is at the heart of modern day Astrophysical research. PyAutoGalaxy makes it simple to model galaxies, like this one:

Missing for now :(

Example

With PyAutoGalaxy, you can begin modeling a galaxy in just a couple of minutes. The example below demonstrates a simple analysis which fits a galaxy's light.

.. code-block:: python

import autofit as af
import autogalaxy as ag

import os

"""
Load Imaging data of the strong lens from the dataset folder of the workspace.
"""
imaging = ag.Imaging.from_fits(
    image_path="/path/to/dataset/image.fits",
    noise_map_path="/path/to/dataset/noise_map.fits",
    psf_path="/path/to/dataset/psf.fits",
    pixel_scales=0.1,
)

"""
Create a mask for the data, which we setup as a 3.0" circle.
"""
mask = ag.Mask2D.circular(
    shape_native=imaging.shape_native, pixel_scales=imaging.pixel_scales, radius=3.0
)

"""
We model the galaxy using an EllSersic LightProfile.
"""
light_profile = ag.lp.EllSersic

"""
We next setup this profile as model components whose parameters are free & fitted for
by setting up a Galaxy as a Model.
"""
galaxy_model = af.Model(ag.Galaxy, redshift=1.0, light=light_profile)
model = af.Collection(galaxy=_galaxy_model)

"""
We define the non-linear search used to fit the model to the data (in this case, Dynesty).
"""
search = af.DynestyStatic(name="search[example]", nlive=50)

"""
We next set up the `Analysis`, which contains the `log likelihood function` that the
non-linear search calls to fit the lens model to the data.
"""
analysis = ag.AnalysisImaging(dataset=masked_imaging)

"""
To perform the model-fit we pass the model and analysis to the search's fit method. This will
output results (e.g., dynesty samples, model parameters, visualization) to hard-disk.
"""
result = search.fit(model=model, analysis=analysis)

"""
The results contain information on the fit, for example the maximum likelihood
model from the Dynesty parameter space search.
"""
print(result.samples.max_log_likelihood_instance)

Getting Started

Please contact us via email or on our SLACK channel if you are interested in using PyAutoGalaxy, as project is still a work in progress whilst we focus n PyAutoFit and PyAutoLens.

Slack

We're building a PyAutoGalaxy community on Slack, so you should contact us on our Slack channel <https://pyautogalaxy.slack.com/>_ before getting started. Here, I will give you the latest updates on the software & discuss how best to use PyAutoGalaxy for your science case.

Unfortunately, Slack is invitation-only, so first send me an email <https://github.com/Jammy2211>_ requesting an invite.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autogalaxy-2022.3.30.1.tar.gz (252.5 kB view details)

Uploaded Source

Built Distribution

autogalaxy-2022.3.30.1-py3-none-any.whl (306.3 kB view details)

Uploaded Python 3

File details

Details for the file autogalaxy-2022.3.30.1.tar.gz.

File metadata

  • Download URL: autogalaxy-2022.3.30.1.tar.gz
  • Upload date:
  • Size: 252.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5

File hashes

Hashes for autogalaxy-2022.3.30.1.tar.gz
Algorithm Hash digest
SHA256 de6bf8a41746120366c4e9470363e40298f18e3ca601dccd8477f714bf149a56
MD5 bf0aa700aac9a5540c2d7bbfe3326873
BLAKE2b-256 eb3bc3c1a8ca9651f8fcf097cb077c72d0e4c380645f19464fce4bbc644c3766

See more details on using hashes here.

File details

Details for the file autogalaxy-2022.3.30.1-py3-none-any.whl.

File metadata

  • Download URL: autogalaxy-2022.3.30.1-py3-none-any.whl
  • Upload date:
  • Size: 306.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5

File hashes

Hashes for autogalaxy-2022.3.30.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d3f05cacd5e491c3a40a0eb4fc0fd97e489da4ab8b6b8ffe95a7b34b209a7c1
MD5 0c6f3a1db3a282d15d7bcd9553619988
BLAKE2b-256 01b95db0b8841220778ffd3ac08a80046a5798b79646b3b505ca478c3b67b7ef

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page