How to use the autoarray.array.from_fits function in autoarray

To help you get started, we’ve selected a few autoarray examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Jammy2211 / PyAutoLens / autolens / data / imaging.py View on Github external
background_sky_map_path, background_sky_map_hdu, pixel_scales
):
    """Factory for loading the background sky from a .fits file.

    Parameters
    ----------
    background_sky_map_path : str
        The path to the background_sky_map .fits file containing the background sky map \
        (e.g. '/path/to/background_sky_map.fits').
    background_sky_map_hdu : int
        The hdu the background_sky_map is contained in the .fits file specified by *background_sky_map_path*.
    pixel_scales : float
        The size of each pixel in arc seconds.
    """
    if background_sky_map_path is not None:
        return aa.array.from_fits(
            file_path=background_sky_map_path,
            hdu=background_sky_map_hdu,
            pixel_scales=pixel_scales,
        )
    else:
        return None
github Jammy2211 / PyAutoLens / autolens / data / abstract_data.py View on Github external
def load_image(image_path, image_hdu, pixel_scales):
    """Factory for loading the image from a .fits file

    Parameters
    ----------
    image_path : str
        The path to the image .fits file containing the image (e.g. '/path/to/image.fits')
    image_hdu : int
        The hdu the image is contained in the .fits file specified by *image_path*.
    pixel_scales : float
        The size of each pixel in arc seconds..
    """
    return aa.array.from_fits(
        file_path=image_path, hdu=image_hdu, pixel_scales=pixel_scales
    )
github Jammy2211 / PyAutoLens / autolens / data / imaging.py View on Github external
convert_background_noise_map_from_weight_map,
            convert_background_noise_map_from_inverse_noise_map,
        ]
    )

    if background_noise_map_options == 0 and background_noise_map_path is not None:
        return NoiseMap.from_fits_and_pixel_scale(
            file_path=background_noise_map_path,
            hdu=background_noise_map_hdu,
            pixel_scales=pixel_scales,
        )
    elif (
        convert_background_noise_map_from_weight_map
        and background_noise_map_path is not None
    ):
        weight_map = aa.array.from_fits(
            file_path=background_noise_map_path,
            hdu=background_noise_map_hdu,
            pixel_scales=pixel_scales,
        )
        return NoiseMap.from_weight_map(weight_map=weight_map)
    elif (
        convert_background_noise_map_from_inverse_noise_map
        and background_noise_map_path is not None
    ):
        inverse_noise_map = aa.array.from_fits(
            file_path=background_noise_map_path,
            hdu=background_noise_map_hdu,
            pixel_scales=pixel_scales,
        )
        return NoiseMap.from_inverse_noise_map(
            inverse_noise_map=inverse_noise_map,
github Jammy2211 / PyAutoLens / autolens / data / imaging.py View on Github external
)
    elif (
        convert_background_noise_map_from_weight_map
        and background_noise_map_path is not None
    ):
        weight_map = aa.array.from_fits(
            file_path=background_noise_map_path,
            hdu=background_noise_map_hdu,
            pixel_scales=pixel_scales,
        )
        return NoiseMap.from_weight_map(weight_map=weight_map)
    elif (
        convert_background_noise_map_from_inverse_noise_map
        and background_noise_map_path is not None
    ):
        inverse_noise_map = aa.array.from_fits(
            file_path=background_noise_map_path,
            hdu=background_noise_map_hdu,
            pixel_scales=pixel_scales,
        )
        return NoiseMap.from_inverse_noise_map(
            inverse_noise_map=inverse_noise_map,
        )
    else:
        return None
github Jammy2211 / PyAutoLens / autolens / data / imaging.py View on Github external
)

    if noise_map_options > 1:
        raise exc.DataException(
            "You have specified more than one method to load the noise_map map, e.g.:"
            "convert_noise_map_from_weight_map | "
            "convert_noise_map_from_inverse_noise_map |"
            "noise_map_from_image_and_background_noise_map"
        )

    if noise_map_options == 0 and noise_map_path is not None:
        return NoiseMap.from_fits_and_pixel_scale(
            file_path=noise_map_path, hdu=noise_map_hdu, pixel_scales=pixel_scales
        )
    elif convert_noise_map_from_weight_map and noise_map_path is not None:
        weight_map = aa.array.from_fits(
            file_path=noise_map_path, hdu=noise_map_hdu, pixel_scales=pixel_scales
        )
        return NoiseMap.from_weight_map(weight_map=weight_map)
    elif convert_noise_map_from_inverse_noise_map and noise_map_path is not None:
        inverse_noise_map = aa.array.from_fits(
            file_path=noise_map_path, hdu=noise_map_hdu, pixel_scales=pixel_scales
        )
        return NoiseMap.from_inverse_noise_map(
            inverse_noise_map=inverse_noise_map,
        )
    elif noise_map_from_image_and_background_noise_map:

        if background_noise_map is None:
            raise exc.DataException(
                "Cannot compute the noise-map from the image and background noise_map map if a "
                "background noise_map map is not supplied."