karabo.imaging package
Subpackages
- karabo.imaging.backends package
- Submodules
- karabo.imaging.backends.sdp_backend module
SdpImagerSdpImagerConfigSdpImagerConfig.clean_algorithmSdpImagerConfig.clean_fractional_thresholdSdpImagerConfig.clean_gainSdpImagerConfig.clean_niterSdpImagerConfig.clean_preserve_facetsSdpImagerConfig.clean_scalesSdpImagerConfig.clean_thresholdSdpImagerConfig.combine_across_frequenciesSdpImagerConfig.contextSdpImagerConfig.override_cellsizeSdpImagerConfig.save_model_and_residualSdpImagerConfig.weighting
- karabo.imaging.backends.wsclean_backend module
- Module contents
SdpImagerSdpImagerConfigSdpImagerConfig.clean_algorithmSdpImagerConfig.clean_fractional_thresholdSdpImagerConfig.clean_gainSdpImagerConfig.clean_niterSdpImagerConfig.clean_preserve_facetsSdpImagerConfig.clean_scalesSdpImagerConfig.clean_thresholdSdpImagerConfig.combine_across_frequenciesSdpImagerConfig.contextSdpImagerConfig.override_cellsizeSdpImagerConfig.save_model_and_residualSdpImagerConfig.weighting
WscleanBackendConfigWscleanBackendImager
Submodules
karabo.imaging.image module
- class Image(*, path: Path | str, data: Literal[None] = None, header: Literal[None] = None, **kwargs: Any)
- class Image(*, path: Literal[None] = None, data: ndarray[tuple[int, ...], dtype[float64]], header: Header, **kwargs: Any)
Bases:
object- circle() None
For each frequency channel and polarisation, cutout the pixel values, only keeping data for a circle of the computed radius, centered at the center of the image. This is an in-place transformation of the data.
- Returns:
None (data of current Image instance is transformed in-place)
- cutout(center_xy: Tuple[float, float], size_xy: Tuple[float, float]) Image
Cutout the image to the given size and center.
- Parameters:
center_xy – Center of the cutout in pixel coordinates
size_xy – Size of the cutout in pixel coordinates
- Returns:
Cutout of the image
- Return type:
- property data: ndarray[tuple[int, ...], dtype[float64]]
- get_2d_wcs(ra_dec_axis: Tuple[int, int] = (1, 2)) WCS
- get_beam_parameters() BeamType
Gets the beam-parameters fom the image-header.
“bmaj”: FWHM of the major axis of the elliptical Gaussian beam in degrees “bmin”: FWHM of the minor axis of the elliptical Gaussian beam in degrees “bpa”: position angle of the major axis of the elliptical Gaussian beam in
degrees, counter-clock from the North direction
- Returns:
“bmaj” (deg), “bmin” (deg), “bpa” (deg)
- get_cellsize() float64
- classmethod get_corners_in_world(header: Header) ndarray[tuple[int, ...], dtype[float64]]
Get the image corners RA,DEC of bl, br, tr & tl from header in deg.
Assumes that header has at least two axis RA & DEC.
- Parameters:
header – Header to extract image-infos.
- Returns:
Corners in world coordinates [deg] with shape 4x2.
- get_dimensions_of_image() List[int]
Get the dimensions of this Image as an array.
- Returns:
List with the dimensions.
- Return type:
List[int]
- get_phase_center() Tuple[float, float]
- get_power_spectrum(resolution: float = 0.0005, signal_channel: int | None = None) Tuple[ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]]]
Calculate the power spectrum of this image.
- Parameters:
resolution – Resolution in radians needed for conversion from Jy to Kelvin
signal_channel – channel containing both signal and noise (arr of same shape as nchan of Image), optional
- Returns:
profile: Brightness temperature for each angular scale in Kelvin
theta_axis: Angular scale data in degrees
- Return type:
(profile, theta_axis)
- get_quality_metric() Dict[str, Any]
Get image statistics. Statistics include :
Shape of Image –> ‘shape’
Max Value –> ‘max’
Min Value –> ‘min’
Max Value absolute –> ‘max-abs’
Root mean square (RMS) –> ‘rms’
Sum of values –> ‘sum’
Median absolute –> ‘median-abs’
Median absolute deviation median –> ‘median-abs-dev-median’
Median –> ‘median’
Mean –> ‘mean’
- Returns:
Dictionary holding all image statistics
- get_squeezed_data() ndarray[tuple[int, ...], dtype[float64]]
- get_wcs() WCS
- has_beam_parameters() bool
Check if the image has the beam parameters in the header.
- Parameters:
image – Image to check
- Returns:
True if the image has the beam parameters in the header
- header_has_parameters(parameters: List[str]) bool
- overplot_with_skymodel(sky: SkyModel, filename: Path | str | None = None, block: bool = False, channel_index: int = 0, stokes_index: int = 0, vmin_image: float | None = None, vmax_image: float | None = None) None
Create a plot with the current image data, as well as an overlay of sources from a given SkyModel instance.
- Parameters:
sky – a SkyModel instance, with sources to be plotted.
filename – path to the file where the final plot will be saved. If None, the plot is not saved.
block – whether plotting should block the remaining of the script.
channel_index – Which frequency channel to show in the plot. Defaults to 0.
stokes_index – Which polarisation to show in the plot. Defaults to 0 (stokesI).
vmin_image – Limits for colorbar of Image plot.
vmax_image – Limits for colorbar of Image plot.
- plot(title: str | None = None, xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, figsize: Tuple[float, float] | None = None, colorbar_label: str | None = None, xlabel: str | None = None, ylabel: str | None = None, cmap: str | None = 'jet', origin: Literal['upper', 'lower'] | None = 'lower', wcs_enabled: bool = True, invert_xaxis: bool = False, filename: str | None = None, block: bool = False, **kwargs: Any) None
Plots the image
- Parameters:
title – the title of the colormap
xlim – RA-limit of plot
ylim – DEC-limit of plot
figsize – figsize as tuple
title – plot title
xlabel – xlabel
ylabel – ylabel
cmap – matplotlib color map
origin – place the [0, 0] index of the array in the upper left or lower left corner of the Axes
wcs_enabled – Use wcs transformation? Default is True
invert_xaxis – Do you want to invert the xaxis? Default is False
filename – Set to path/fname to save figure (set extension to fname to overwrite .png default)
block – Whether plotting should block the remaining of the script
**kwargs – matplotlib kwargs for scatter & Collections, e.g. customize s, vmin or vmax
- plot_power_spectrum(resolution: float = 0.0005, signal_channel: int | None = None, path: Path | str | None = None, block: bool = False) None
Plot the power spectrum of this image.
- Parameters:
resolution – Resolution in radians needed for conversion from Jy to Kelvin
signal_channel – channel containing both signal and noise (arr of same shape as nchan of Image), optional
save_png – True if result should be saved, default = False
block – Whether plotting should block the remaining of the script
- plot_side_by_side_with_skymodel(sky: SkyModel, filename: Path | str | None = None, block: bool = False, channel_index: int = 0, stokes_index: int = 0, vmin_sky: float = 0, vmax_sky: float = inf, vmin_image: float = 0, vmax_image: float = inf) None
Create a plot with two panels:
the current image data, and
a scatter plot of sources from a given SkyModel instance.
- Parameters:
sky – a SkyModel instance, with sources to be plotted.
filename – path to the file where the final plot will be saved. If None, the plot is not saved.
block – whether plotting should block the remaining of the script.
channel_index – Which frequency channel to show in the plot. Defaults to 0.
stokes_index – Which polarisation to show in the plot. Defaults to 0 (stokesI).
vmin_sky – Limits for colorbar of SkyModel scatter plot.
vmax_sky – Limits for colorbar of SkyModel scatter plot.
vmin_image – Limits for colorbar of Image plot.
vmax_image – Limits for colorbar of Image plot.
- resample(shape: Tuple[int, ...], **kwargs: Any) None
Resamples the image to the given shape using SciPy’s RegularGridInterpolator for bilinear interpolation. See: https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.RegularGridInterpolator.html
- Parameters:
shape – The desired shape of the image
kwargs – Keyword arguments for the interpolation function
- split_image(N: int, overlap: int = 0) List[Image]
Split the image into N x N equal-sized sections with optional overlap.
- Parameters:
N (int) – The number of sections to split the image into along one axis. The total number of image sections will be N^2. It is assumed that the image can be divided into N equal parts along both axes. If this is not the case (e.g., image size is not a multiple of N), the sections on the edges will have fewer pixels.
overlap (int, optional) – The number of pixels by which adjacent image sections will overlap. Default is 0, meaning no overlap. Negative overlap means that there will be empty sections between the cutouts.
- Returns:
A list of cutout sections of the image. Each element in the list is a 2D array representing a section of the image.
- Return type:
List[Image]
Notes
The function calculates the step size for both the x and y dimensions by dividing the dimension size by N. It then iterates over N steps in both dimensions to generate starting and ending indices for each cutout section, taking the overlap into account.
The cutout function (not shown) is assumed to take the center (x, y) coordinates and the (width, height) of the desired cutout section and return the corresponding 2D array from the image.
The edge sections will be equal to or smaller than the sections in the center of the image if the image size is not an exact multiple of N.
Examples
>>> # Assuming `self.data` is a 4D array with shape (C, Z, X, Y) >>> # and `self.cutout` method is defined >>> image = Image() >>> cutouts = image.split_image(4, overlap=10) >>> len(cutouts) 16 # because 4x4 grid
- to_2dNNData() NDData
- to_NNData() NDData
- classmethod update_header_from_image_header(new_header: Header, old_header: Header, keys_to_copy: List[str] | None = None) Header
- write_to_file(path: Path | str, overwrite: bool = False) None
Write an Image to path as .fits
- Parameters:
path – Full path of the file
overwrite – Overwrite the file if it already exists? Defaults to False
- class ImageMosaicker(reproject_function: ~typing.Callable[[...], ~typing.Any] = <function reproject_interp>, combine_function: str = 'mean', match_background: bool = False, background_reference: int | None = None)
Bases:
objectA class to handle the combination of multiple images into a single mosaicked image. See: https://reproject.readthedocs.io/en/stable/mosaicking.html
More information on the parameters can be found in the documentation: https://reproject.readthedocs.io/en/stable/api/reproject.mosaicking.reproject_and_coadd.html However, here the most common to tune are explained.
- Parameters:
reproject_function (callable, optional) – The function to use for the reprojection.
combine_function ({'mean', 'sum'}) – The type of function to use for combining the values into the final image.
match_background (bool, optional) – Whether to match the backgrounds of the images.
background_reference (None or int, optional) – If None, the background matching will make it so that the average of the corrections for all images is zero. If an integer, this specifies the index of the image to use as a reference.
- get_optimal_wcs(images: List[Image], projection: str = 'SIN', **kwargs: Any) Tuple[WCS, tuple[int, int]]
Set the optimal WCS for the given images. See: https://reproject.readthedocs.io/en/stable/api/reproject.mosaicking.find_optimal_celestial_wcs.html # noqa: E501
- Parameters:
images (list) – A list of images to combine.
projection (str, optional) – Three-letter code for the WCS projection, such as ‘SIN’ or ‘TAN’.
**kwargs (dict, optional) – Additional keyword arguments to be passed to the reprojection function.
- Returns:
The optimal WCS for the given images and the size of this WCS
- Return type:
Tuple[WCS, tuple[int, int]]
- mosaic(images: List[Image], wcs: Tuple[WCS, Tuple[int, int]] | None = None, input_weights: List[str | fits.HDUList | fits.PrimaryHDU | NDArray[np.float64]] | None = None, hdu_in: int | str | None = None, hdu_weights: int | str | None = None, shape_out: Tuple[int] | None = None, image_for_header: Image | None = None, **kwargs: Any) Tuple[Image, NDArray[np.float64]]
Combine the provided images into a single mosaicked image.
- Parameters:
images (list) – A list of images to combine.
wcs (tuple, optional) – The WCS to use for the mosaicking. Will be calculated with get_optimal_wcs if not passed.
input_weights (list, optional) – If specified, an iterable with the same length as images, containing weights for each image.
shape_out (tuple, optional) – The shape of the output data. If None, it will be computed from the images.
hdu_in (int or str, optional) – If one or more items in input_data is a FITS file or an HDUList instance, specifies the HDU to use.
hdu_weights (int or str, optional) – If one or more items in input_weights is a FITS file or an HDUList instance, specifies the HDU to use.
image_for_header (Image, optional) – From which image the header should be used to readd the lost information by the mosaicking because some information is not propagated.
**kwargs (dict, optional) – Additional keyword arguments to be passed to the reprojection function.
- Returns:
The final mosaicked image as a FITS HDU and the footprint of the final mosaicked image.
- Return type:
Tuple[Image, NDArray[np.float64]]
- Raises:
ValueError – If less than two images are provided.
karabo.imaging.imager_base module
Base classes for dirty imagers and image cleaners.
- class DirtyImager
Bases:
ABCAbstract base class for a dirty imager.
A dirty imager creates dirty images from visibilities.
- config: DirtyImagerConfig
- abstractmethod create_dirty_image(visibility: Visibility, /, *, output_fits_path: Path | str | None = None) Image
Creates a dirty image from a visibility.
- Parameters:
visibility – Visibility object from which to create the dirty image. Contains the visibilities of an observation.
output_fits_path – Path to write the dirty image to. Example: /tmp/dirty.fits. If None, will be set to a temporary directory and a default file name. Defaults to None.
- Returns:
Dirty image
- Return type:
- class DirtyImagerConfig(imaging_npixel: int, imaging_cellsize: float, combine_across_frequencies: bool = True)
Bases:
objectBase class for the config / parameters of a dirty imager.
Contains basic parameters common across all dirty imagers. Inherit and add parameters specific to a dirty imager implementation.
- imaging_npixel
Image size
- Type:
int
- imaging_cellsize
Scale of a pixel in radians
- Type:
float
- combine_across_frequencies
Whether or not to combine images across all frequency channels into one image. Defaults to True.
- Type:
bool
- combine_across_frequencies: bool = True
- imaging_cellsize: float
- imaging_npixel: int
- class ImageCleaner
Bases:
ABCAbstract base class for an image cleaner.
An image cleaner creates clean images from dirty images or directly from visibilities, in that case including the dirty imaging process.
- abstractmethod create_cleaned_image(visibility: Visibility, /, *, dirty_fits_path: Path | str | None = None, output_fits_path: Path | str | None = None) Image
Creates a clean image from a dirty image or from visibilities.
- Parameters:
visibility – Visibility from which a clean image should be created.
dirty_fits_path – Path to dirty image FITS file that should be reused to create a clean image. If None, dirty image will be created first from the visibilities. Defaults to None.
output_fits_path – Path to write the clean image to. Example: /tmp/restored.fits. If None, will be set to a temporary directory and a default file name. Defaults to None.
- Returns:
Clean image
- Return type:
- class ImageCleanerConfig(imaging_npixel: int, imaging_cellsize: float)
Bases:
objectBase class for the config / parameters of an image cleaner.
Contains basic parameters common across all image cleaners. Inherit and add parameters specific to an image cleaner implementation.
- imaging_npixel
Image size
- Type:
int
- imaging_cellsize
Scale of a pixel in radians
- Type:
float
- imaging_cellsize: float
- imaging_npixel: int
karabo.imaging.imager_factory module
- class ImagingBackend(*values)
Bases:
str,EnumSupported imaging backends.
- SDP = 'sdp'
- WSCLEAN = 'wsclean'
- get_imager(backend: str | ImagingBackend | None = None, *, config: SdpImagerConfig | WscleanBackendConfig | None = None) Imager
- parse_imaging_backend(backend: str | ImagingBackend | None = None) ImagingBackend
karabo.imaging.imager_interface module
- class ImageSpec(npix: int, cellsize_arcsec: float, phase_centre_deg: Tuple[float, float], polarisation: str = 'I', nchan: int = 1)
Bases:
objectMinimal imaging parameters shared across backends.
- cellsize_arcsec: float
- property cellsize_radians: float
Return the pixel scale in radians.
- nchan: int = 1
- npix: int
- phase_centre_deg: Tuple[float, float]
- polarisation: str = 'I'
karabo.imaging.imager_oskar module
- class OskarDirtyImager(config: OskarDirtyImagerConfig)
Bases:
DirtyImagerDirty imager based on the OSKAR library.
- config
Config containing parameters for OSKAR dirty imaging.
- Type:
- create_dirty_image(visibility: Visibility, /, *, output_fits_path: Path | str | None = None) Image
Creates a dirty image from a visibility.
- Parameters:
visibility – Visibility object from which to create the dirty image. Contains the visibilities of an observation.
output_fits_path – Path to write the dirty image to. Example: /tmp/dirty.fits. If None, will be set to a temporary directory and a default file name. Defaults to None.
- Returns:
Dirty image
- Return type:
- class OskarDirtyImagerConfig(imaging_npixel: int, imaging_cellsize: float, combine_across_frequencies: bool = True, imaging_phase_centre: str | None = None)
Bases:
DirtyImagerConfigConfig / parameters of an OskarDirtyImager.
Adds parameters specific to OskarDirtyImager.
- imaging_npixel
see DirtyImagerConfig
- Type:
int
- imaging_cellsize
see DirtyImagerConfig
- Type:
float
- combine_across_frequencies
see DirtyImagerConfig
- Type:
bool
- imaging_phase_centre
Phase centre (in SkyCoord string format). Defaults to None.
- Type:
Optional[str]
- imaging_phase_centre: str | None = None
karabo.imaging.imager_sdp module
Backward-compatible shim for the SDP imaging backend.
- class SdpImager(config: SdpImagerConfig | None = None)
Bases:
Imager- invert(vis: Visibility, image_spec: ImageSpec) tuple[Image, Image]
Grid visibilities into dirty image and PSF images.
karabo.imaging.imager_wsclean module
- class WscleanDirtyImager(config: DirtyImagerConfig, *, weighting: Literal['natural', 'uniform'] | None = None, warn_direct_use: bool = True)
Bases:
DirtyImagerDirty imager based on the WSClean library.
WSClean is integrated by calling the wsclean command line tool. The parameters in the config (DirtyImagerConfig) attribute are passed to wsclean. Use the create_image_custom_command function if you need to set params not available in DirtyImagerConfig.
- config
Config containing parameters for dirty imaging
- Type:
- OUTPUT_FITS_DIRTY = 'wsclean-dirty.fits'
- TMP_PREFIX_DIRTY = 'WSClean-dirty-'
- TMP_PURPOSE_DIRTY = 'Disk cache for WSClean dirty images'
- create_dirty_image(visibility: Visibility, /, *, output_fits_path: Path | str | None = None) Image
Creates a dirty image from a visibility.
- Parameters:
visibility – Visibility object from which to create the dirty image. Contains the visibilities of an observation.
output_fits_path – Path to write the dirty image to. Example: /tmp/dirty.fits. If None, will be set to a temporary directory and a default file name. Defaults to None.
- Returns:
Dirty image
- Return type:
- class WscleanImageCleaner(config: WscleanImageCleanerConfig, *, weighting: Literal['natural', 'uniform'] | None = None, warn_direct_use: bool = True)
Bases:
ImageCleanerImage cleaner based on the WSClean library.
WSClean is integrated by calling the wsclean command line tool. The parameters in the config (WscleanImageCleanerConfig) attribute are passed to wsclean. Use the create_image_custom_command function if you need to set params not available in WscleanImageCleanerConfig. Parameters in the config that are explicitly set to None will not be passed to the command line tool, which will then resort to its own default values.
- config
Config containing parameters for WSClean image cleaning.
- OUTPUT_FITS_CLEANED = 'wsclean-image.fits'
- TMP_PREFIX_CLEANED = 'WSClean-cleaned-'
- TMP_PURPOSE_CLEANED = 'Disk cache for WSClean cleaned images'
- create_cleaned_image(visibility: Visibility, /, *, dirty_fits_path: Path | str | None = None, output_fits_path: Path | str | None = None) Image
Creates a clean image from a dirty image or from visibilities.
- Parameters:
visibility – Visibility from which a clean image should be created.
dirty_fits_path – Path to dirty image FITS file that should be reused to create a clean image. If None, dirty image will be created first from the visibilities. Defaults to None.
output_fits_path – Path to write the clean image to. Example: /tmp/restored.fits. If None, will be set to a temporary directory and a default file name. Defaults to None.
- Returns:
Clean image
- Return type:
- class WscleanImageCleanerConfig(imaging_npixel: int, imaging_cellsize: float, niter: int | None = 50000, mgain: float | None = 0.8, auto_threshold: int | None = 3)
Bases:
ImageCleanerConfigConfig / parameters of a WscleanImageCleaner.
Adds parameters specific to WscleanImageCleaner.
- niter
Maximum number of clean iterations to perform. Defaults to 50000.
- Type:
Optional[int]
- mgain
Cleaning gain for major iterations: Ratio of peak that will be subtracted in each major iteration. To use major iterations, 0.85 is a good value. Defaults to 0.8.
- Type:
Optional[float]
- auto_threshold
Relative clean threshold. Estimate noise level using a robust estimator and stop at sigma x stddev. Defaults to 3.
- Type:
Optional[int]
- auto_threshold: int | None = 3
- mgain: float | None = 0.8
- niter: int | None = 50000
- create_image_custom_command(command: str, output_filenames: str | List[str] = 'wsclean-image.fits', *, warn_direct_use: bool = True) Image | List[Image]
Create a dirty or cleaned image using your own command.
Allows the use of the full WSClean functionality with all parameters. Command has to start with ‘wsclean ‘. The working directory the command runs in will be a temporary directory. Use absolute paths to reference files or directories like the measurement set.
- Parameters:
command – Command to execute. Example: wsclean -size 2048 2048 -scale 0.00222222deg -niter 50000 -mgain 0.8 -abs-threshold 100µJy /tmp/measurements.MS
output_filenames – WSClean output filename(s) (relative to the working directory) that should be returned as Image objects. Can be a string for one file or a list of strings for multiple files. Example 1: “wsclean-image.fits” Example 2: [‘wsclean-image.fits’, ‘wsclean-residual.fits’]
- Returns:
If output_filenames is a string, returns an Image object of the file output_filenames.
If output_filenames is a list of strings, returns a list of Image objects, one object per filename in output_filenames.
karabo.imaging.sdp_io module
- import_sdp_image_from_fits(fits_path: str | Path, *, fix_polarisation_order: bool = True) Image
Read a FITS image into the pinned SKA-SDP image data model.
This is the small FITS-I/O boundary missing from ska-sdp-datamodels 0.1.3. It accepts 2D images and canonical 3D/4D FITS cubes and preserves clean-beam metadata when present.
karabo.imaging.util module
- get_MGCLS_images(regex_pattern: str, verbose: bool = False) List[Image]
MeerKAT Galaxy Cluster Legacy Survey Data Release 1 (MGCLS DR1) https://doi.org/10.48479/7epd-w356 The first data release of the MeerKAT Galaxy Cluster Legacy Survey (MGCLS) consists of the uncalibrated visibilities, a set of continuum imaging products, and several source catalogues. All clusters have Stokes-I products, and approximately 40% have Stokes-Q and U products as well. For full details, including caveats for usage, see the survey overview and DR1 paper (Knowles et al., 2021).
When using any of the below products, please cite Knowles et al. (2021) and include the following Observatory acknowledgement: “MGCLS data products were provided by the South African Radio Astronomy Observatory and the MGCLS team and were derived from observations with the MeerKAT radio telescope. The MeerKAT telescope is operated by the South African Radio Astronomy Observatory, which is a facility of the National Research Foundation, an agency of the Department of Science and Innovation.”
The final enhanced image data products are five-plane cubes (referred to as the 5pln cubes in the following) in which the first plane is the brightness at the reference frequency, and the second is the spectral index, a**1656/908 , both determined by a least-squares fit to log(I) vs. log(v) at each pixel. The third plane is the brightness uncertainty estimate, fourth is the spectral index uncertainty, and fifth is the χ2 of the least-squares fit. Uncertainty estimates are only the statistical noise component and do not include calibration or other systematic effects. The five planes are accessible in the Xarray.Image in the frequency dimension (first dimension).
Data will be accessed from the karabo_public folder. The data was downloaded from https://archive-gw-1.kat.ac.za/public/repository/10.48479/7epd-w356/ data/enhanced_products/bucket_contents.html
Parameters:
- regex_patternstr
Regex pattern to match the files to download. Best is to check in the bucket and paper which data is available and then use the regex pattern to match the files you want to download.
- verbosebool, optional
If True, prints out the files being downloaded. Defaults to False.
Returns:
- List[SkaSdpImage]
List of images from the MGCLS Enhanced Products bucket.
- guess_beam_parameters(img: Image) BeamType
Fit a two-dimensional Gaussian to img using astropy.modeling.
This function is usually applied on a PSF-image. Therefore, just images who don’t have beam-params in the header (e.g. dirty image) may need a beam-guess.
Source: https://gitlab.com/ska-telescope/sdp/ska-sdp-func-python/-/blob/main/src/ska_sdp_func_python/image/deconvolution.py # noqa: E501
- Parameters:
img – Image to guess the beam
- Returns:
major-axis (degree), minor-axis (degree), position-angle (degree)
- project_sky_to_image(sky: SkyModel, phase_center: List[int] | List[float], imaging_cellsize: float, imaging_npixel: int, filter_outlier: bool = True, invert_ra: bool = True) Tuple[ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[int64]]]
Calculates the pixel coordinates sky sources as floats. If you want to have integer indices, just round them.
- Parameters:
sky – SkyModel with the sources
phase_center – [RA,DEC]
imaging_cellsize – Image cellsize in radian (pixel coverage)
imaging_npixel – Number of pixels of the image
filter_outlier – Exclude source outside of image?
invert_ra – Invert RA axis?
- Returns:
image-coordinates as np.ndarray[px,py] and
SkyModel sources indices as np.ndarray[idxs]