Skip to content

Aggregator for fits files #1104

@Jammy2211

Description

@Jammy2211

This basically mirrors the AggregatorImages object, but is specific to .fits files.

The following example shows how its used, which is largely a mirror of the image splicer:

https://github.com/Jammy2211/autogalaxy_workspace/blob/main/scripts/results/examples/fits_splice.py

The only real difference is that whereas for images we have to specify the tuple parts of the subplot to extract, for .fits files the .fits file has an EXTNAME header we use to read the names of the headers we extract:

"""
__Extract Images__

We now extract 2 images from the `fit.fits` file and combine them together into a single .fits file.

We will extract the `model_image` and `residual_map` images, which are images you are used to
plotting and inspecting in the `output` folder of a model-fit and can load and inspect in DS9 from the file
`fit.fits`.

By inspecting `fit.fits` you will see it contains four images which each have a an `ext_name`: `model_image`,
`residual_map`, `normalized_residual_map`, `chi_squared_map`.

We do this by simply passing the `agg_fits.extract_image` method the name of the fits file we load from `fits.fit`
and the `ext_name` of what we extract.

This runs on all results the `Aggregator` object has loaded from the `output` folder, meaning that for this example
where two model-fits are loaded, the `image` object contains two images.
"""
image = agg_fits.extract_image(
    name="fits.fit",
    ext_name_list=["model_image", "residual_map"]
)

After running the example you should get an output folder with a file fit.fits which has all the necessary quantities.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions