imProc.stack - EranOfek/AstroPack GitHub Wiki

Description

High-level functions for manipulation of astronomical images

Functions

  • imProc.stack.allFunList - functions list for the imProc.stack package
  • imProc.stack.addImageRedistributePixels - Add Image1 to Image according to the pixel redistribution defined by the coordinate arrays X, Y with the signal distributed amoung 4 neighbouring pixels so that the total "flux" is conserved
  • imProc.stack.applyUnaryFun - Apply scalar-unary function (e.g., function that returns a scalar) on AstroImage
  • imProc.stack.coadd - Coadd images in AstroImage object including pre/post normalization
  • imProc.stack.coaddProperCore - Proper coaddition of images in AstroImage object
  • imProc.stack.divideFactor - Divide factor (constant) from AstroImage
  • imProc.stack.functionalResponse - Fit the pixel response to light as a function of intensity in a cube of images
  • imProc.stack.funCube - Apply function/s on a single cube
  • imProc.stack.makeMovie - Display and create a movie file from images in AstroImage or cube
  • imProc.stack.stitch - Make a mosaic sky image from a set of input image files or AstroImages
  • imProc.stack.subtractOffset - Remove offset (constant) from AstroImage
  • imProc.stack.unitTest - unitTest for imProc.stack

Selected examples

Image coaddition

First, if the images have an astrometric solution in the headers, but their WCS property is not populated:

% populate the WCS
AI.populateWCS;

Given an AstroImage object containing several images of the same field, where the images are astrometrically solved, and containing a WCS:

% Register the images against a reference image in the first element of AI(1):
RegisteredAI = imProc.transIm.imwarp(AI, AI(1));
[Result] = imProc.stack.coadd(RegisteredAI);

In many cases, you may be interested in removing the background from the images prior to coaddition: If the Back property is empty in the AstroImage, start by populating it (see also imProc.background):

AI = imProc.background.background(AI);

To subtract the background prior to coaddition (and calculate if Back property is empty):

RegisteredAI.subtractBackground;
[Result] = imProc.stack.coadd(RegisteredAI);

Mosaicing

To make a mosaic sky image from a set of input image files.

% Make a mosaic image from coadd images of LAST residing in LastDir:
LastDir = '/home/sasha/Obs1/';
[Mosaic, AH, RemappedXY] = imProc.stack.stitch('LAST*coadd_Image*.fits','DataDir','/home/sasha/Obs1/');

The output file name will look like LAST.01.02.01_20221204.161938.037_369-08_stitched_image.fits (the beginning of the name comes from the name of the first of the input images). The Mosaic variable will contain the stitched AstroImage with Mosaic.Header containing the WCS data. The AH variable will contain the corresponding AstroHeader object, and the RemappedXY variable is a 4D-matrix containing the remapped X, Y pixel coordinates from each of the input images: [Image number, Xremapped, Yremapped, 1 -> X or 2 -> Y].