The Image Math dialog box provides a range of image processing operations that can be applied to either a single FITS image or multiple FITS images. It is organized into following tabs: Standard, Advanced, Advanced - Folder and Binning, each of which is detailed in the following sections.


Standard



The Standard tab consists of two sections: Involving 1 image, Involving 2 images.



  1. Involving 1 image: use Add file to open the FITS file on which you want to perform an operation. Alternatively, if you already have one or more FITS images open and want to select one, use Add open image. Upon selecting a file or open image, the Image box will display the chosen entry. 

    Next, choose an operator from the drop down list:

    • Add scalar: adds the Scalar value to each pixel value in the selected image.

    • Subtract scalar: subtracts the Scalar value from each pixel in the selected image.


    • Multiply by scalar: multiplies each pixel value in the selected image by the Scalar value.


    • Divide by scalar: dividies each pixel value in the selected image by the Scalar value.

    • Remove hot pixels: removes hot pixels from the selected image. The Radius parameter specifies the area around each pixel to identify and remove hot pixels, with a recommended value of 1.


Click the Calculate button to execute the operation. The resulting image will open in a new FITS window.


  1. Involving 2 images: similar to above, open two FITS files or select two already open FITS images, then choose an operator from the drop down list:

    • +: creates a new FITS image by adding the pixel values of Image 1 and Image 2
       
    • -: creates a new FITS image by subtracting the pixel values of Image 2 from Image 1

    • *: creates a new FITS image by multiplying the pxiel values of Image 1 with Image 2

    • /: creates a new FITS image by dividing the pixel values of Image 1 by Image 2

Click the Calculate button to execute the operation and display the resulting new FITS image.



Advanced



The operations in this tab allow to combine multiple FITS images. One has to keep in mind that all FITS images recorded by a sensor include noise. When performing operations such as addition or subtraction of images, the noise accumulates. This observation is particularly significant in the image calibration process, elucidating why the standard practice involves utilizing multiple bias, dark and flat frames to calibrate a Science image, rather than relying on a single frame of each type. By first averaging multiple bias, dark and flat frames before applying them to a Science image, the introduction of noise is significantly curtailed.


The Advanced tab provides operators designed for large sets of FITS images, enabling actions such as averaging or median combining the set to produce a new image.



The Advanced tab necessitates a minimum of two FITS images, which can be acquired by either opening FITS files using the Add files option or by selecting already open FITS images through the Add open images option. Once the files or open images are selected, the Selected images box will display the chosen entries. 


Subsequently, choose an operator from the Math operator section. Utilize the drop down list to select the desired operator:

    • Sum: creates a new FITS image by summing the pixel values of all selected images.

    • Average: creates a new FITS image by averaging the pixel values of all selected images. This method yields optimal results when the noise in the selected images is random Gaussian noise. However, if one of the images contains pixels with exceptional values (outlier pixels resulting for instance from cosmic rays), these values will be incorporated in the new FITS image.

    • Median: creates a new FITS image by median combining the pixel values of all selected images. This method effectively suppresses outlier pixels but results in a 25% increase in the noise level compared to averaging. 


    • Sigma clipping: this method initially removes outlier pixels from the selected images before averaging them. It is a compromise between the Average and Median methods, combining the noise reduction advantages of the Average method with the outlier pixel rejection characteristics of the Median method. 

      The Sigma value determines the treshold for identifying outliers. Pixels with values beyond a certain number of sigma from the mean are considered outliers. A higher sigma value results in a more stringent criterion for identifying outliers, while a lower sigma value is more permissive. Adjusting the sigma value allows you to balance the removal of outliers with the preservation of genuine features in the image.



The Stack option is a feature compatible with all 4 previously mentioned methods. It is particularly useful in situations involving a series of images capturing the same target but exhibiting slight variations, i.e. shifts in the x-y plane caused by a minor movement of the field of view (e.g., resulting from imprecisions in the telescope mount tracking). The stack operation helps to improve the SNR ratio of your image: when enabled, each image undergoes x-y shifting relative to the first image, employing a cross-correlation technique, to ensure that all pixels align spatially. The first image remains unaltered, serving as a reference image to which all subsequent images are aligned. After stacking, the chosen operator (e.g., average or median combine) is then applied. 
Note that stacking only works for images exhibiting x-y shifts; it is not applicable to images with rotational differences.



The Normalize option is available when selecting the Average or Median methods. When enabled, each image undergoes a median-normalization before the selected operator (e.g., average or median combine) is employed. Median-normalization entails determining the median value of an image, and subsequently dividing each pixel value of the image by this median value. 

Normalization is commonly applied when working with flat field frames. Each flat field image is normalized (adjusted) to values approximating unity. This ensures that post flat field correction, the numerical intensities in the images resemble those prior to flat fielding. In simpler terms, the flat field correction for pixels with responses close to the median is adjusted to approximately 1. 



Use the Remove from list button to remove one or more entries from the Selected images list.



Advanced - Folder




The Advanced - Folder tab processes a Source folder of FITS images, combining them using the selected Math operator to produce new combined FITS images, which are saved in the designated Destination folder.


Example Use Case

Suppose you have a Source folder containing 100 FITS images of a very faint variable star. To improve photometric accuracy, you might want to group every 4 images and average them into a new single combined FITS image. This increases the signal-to-noise ratio, resulting in higher accuracy photometric measurements. Instead of 100 low-accuracy observations, you will have 25 higher-accuracy observations. The Advanced - Folder tab automates this process of creating combined FITS images.


First select the Source folder containing the images to combine. Then specify the Destination folder, where the combined images will be saved. Phoranso automatically generates filenames for the combined files, based on the selected options. Each file also includes a unique sequence number. 


In the above example, the first combined file will be named: FS CMi_StackedImage_Average_0001.fit:

    • FS CMi: derived from the Combined filename prefix setting
    • StackedImage_Average: indicates the selected Math operator (Average) and the use of the Stack option
    • 0001: a unique sequence number assigned by Phoranso


The Math operator section includes the following fields:


    • Operator field offering a choice between Sum, Average, Median and Sigma clipping. These operators function in the same way as described in the Advanced tab section above.


    • The Normalize and Stack options also operate identically to their counterparts in the Advanced tab section.


The Grouping section allows to specify the number of Source folder images to each time combine into a single, grouped image image.

 

To initiate the process, click the Calculate button. If needed, you can stop the process at any time by clicking Abort.



Binning



The operations in this tab allow to bin one or more FITS images. Binning is the process of combining adjacent pixels into a single (super) pixel, often in a square grid format (i.e., 2x2, 3x3, etc). Example: when you bin an image 2x2, Phoranso combines 4 pixels into a single pixel, halving the image resolution in each dimension.



First add one or more FITS images to the Selected images list using the Add files or Add open images buttons. Next, select the desired Binning operator from the drop down list (options are 2x2, 3x3 and 4x4 binning) and the Pixel combination to be applied. Press Calculate to start the binning operation, which results in the display of one new binned image for each image in the list of Selected images.


    • When Average is selected as Pixel combination method, each binned super pixel value will be the average of the adjacent pixels. Example: with 2x2 binning, the super pixel value will be the average of the 4 adjacent pixels.


    • When Sum is selected as Pixel combination method, each binned super pixel value will be the addition of the adjacent pixels. 



Use the Remove from list button to remove one or more entries from the Selected images list.