orca.transform.imaging

Image generation transforms using WSClean.

Provides functions for creating dirty images, movies from FITS sequences, integrated images, and Stokes I/V imaging from measurement sets. Uses WSClean for imaging and supports multi-frequency synthesis.

Attributes

logger

CLEAN_MGAIN

SUN_CHANNELS_OUT

IMSIZE

IM_SCALE_DEGREE

Functions

make_movie_from_fits(→ str)

Create an MP4 movie from a sequence of FITS images.

integrated_image(msl)

Create an integrated image from multiple measurement sets.

make_dirty_image(→ Union[str, Tuple[str, str]])

Make dirty image from a list of measurement sets using WSClean.

reproject_fits(→ Union[str, numpy.ndarray])

Reproject one fits image to wcs of another.

stack_images(fits_list, output_path)

Stacks images in fits_list and writes to output_path.

stokes_IV_imaging(spw_list, start_time, end_time, ...)

Generate Stokes I and V images from calibrated measurement sets.

coadd_fits(→ Optional[str])

Co-add multiple FITS images by averaging.

Module Contents

orca.transform.imaging.logger[source]
orca.transform.imaging.CLEAN_MGAIN = 0.8[source]
orca.transform.imaging.SUN_CHANNELS_OUT = 2[source]
orca.transform.imaging.IMSIZE = 4096[source]
orca.transform.imaging.IM_SCALE_DEGREE = 0.03125[source]
orca.transform.imaging.make_movie_from_fits(fits_tuple: Tuple[str], output_dir: str, scale: float, output_filename: str | None = None) str[source]

Create an MP4 movie from a sequence of FITS images.

Uses matplotlib to render each frame and ffmpeg to encode the movie.

Parameters:
  • fits_tuple – Ordered sequence of paths to FITS image files.

  • output_dir – Directory to save the output movie.

  • scale – Symmetric color scale for image display (-scale to +scale).

  • output_filename – Optional output filename. Defaults to input basename + .mp4.

Returns:

Path to the generated movie file.

orca.transform.imaging.integrated_image(msl: List[str])[source]

Create an integrated image from multiple measurement sets.

Parameters:

msl – List of measurement set paths.

Note

Not yet implemented.

orca.transform.imaging.make_dirty_image(ms_list: List[str], output_dir: str, output_prefix: str, make_psf: bool = False, briggs: float = 0, inner_tukey: int | None = None, n_thread: int = 10, more_args: List[str] | None = None) str | Tuple[str, str][source]

Make dirty image from a list of measurement sets using WSClean.

Creates a dirty (non-deconvolved) image with specified weighting scheme. Optionally generates the PSF image as well.

Parameters:
  • ms_list – List of measurement set paths to image.

  • output_dir – Directory for output images.

  • output_prefix – Prefix for output filenames.

  • make_psf – If True, also generate the PSF image at 2x size.

  • briggs – Briggs robust weighting parameter (-2 to 2).

  • inner_tukey – Inner Tukey taper width in wavelengths.

  • n_thread – Number of threads for WSClean.

  • more_args – Additional WSClean arguments.

Returns:

If make_psf is True, tuple of (image_path, psf_path). Otherwise, just the image path.

orca.transform.imaging.reproject_fits(fits_path1: str, fits_path2: str, output_path: str | None = None) str | numpy.ndarray[source]

Reproject one fits image to wcs of another.

Parameters:
  • fits_path1 – fits file of reference image

  • fits_path2 – fits file to be reprojected

  • output_path – output for reprojected fits image (optional)

Returns:

path to reprojected fits image if output_path is not None, else the numpy array of the reprojected image.

orca.transform.imaging.stack_images(fits_list: List[str], output_path: str)[source]

Stacks images in fits_list and writes to output_path.

Parameters:
  • fits_list – list of fits files to be stacked

  • output_path – output path (including name)

orca.transform.imaging.stokes_IV_imaging(spw_list: List[str], start_time: datetime.datetime, end_time: datetime.datetime, source_dir: str, work_dir: str, scratch_dir: str, phase_center: astropy.coordinates.SkyCoord | None = None, taper_inner_tukey: int = 30, make_snapshots: bool = False, keep_scratch_dir: bool = False, partitioned_by_hour: bool = True)[source]

Generate Stokes I and V images from calibrated measurement sets.

Celery task that applies calibration, flags, integrates across spectral windows, and produces Stokes I/V images. Can optionally generate snapshot images for each timestep.

Parameters:
  • spw_list – List of spectral window identifiers.

  • start_time – Start of the observation time range.

  • end_time – End of the observation time range.

  • source_dir – Directory containing source measurement sets.

  • work_dir – Working directory for intermediate products.

  • scratch_dir – Scratch directory for temporary files.

  • phase_center – Optional phase center for imaging. Defaults to zenith.

  • taper_inner_tukey – Inner Tukey taper width in wavelengths.

  • make_snapshots – If True, produce per-timestep snapshot images.

  • keep_scratch_dir – If True, don’t delete temporary directory.

  • partitioned_by_hour – Whether data is partitioned by hour.

Returns:

None. Writes output images to work_dir.

orca.transform.imaging.coadd_fits(fits_list: List[str], output_path: str) str | None[source]

Co-add multiple FITS images by averaging.

Computes the mean of all input images pixel-by-pixel. Header is taken from the first image.

Parameters:
  • fits_list – List of paths to FITS images to co-add.

  • output_path – Output path for the averaged image.

Returns:

Output path on success, None if fewer than 2 images provided.