Skip to content

Model, residual and prepared images

Besides the profile, elliprof can write three images:

Option Image Definition
-m FILE model the galaxy rebuilt from the fitted isophotes
--residual FILE residual mask × (science − sky − model)
--prepared FILE prepared mask × (science − sky): exactly what ELLIPROF fits
elliprof n1234j.fits --mask n1234_mask.fits --sky 1234.5 \
    X0=514 Y0=514 R0=10 R1=450 NR=25 \
    -o n1234.dat \
    -m n1234.prf \
    --residual n1234_residual.fits \
    --prepared n1234_prepared.fits

-m FILE alone computes the model and writes it; no MODEL keyword is needed (since 0.1.4). The traditional ELLIPROF name for the model image is n1234.prf (and n1234.dat for the text profile), but any name works: the file is FITS whatever it is called. --residual uses the same model as -m, and -m is only needed if you also want the model itself.

The model

Left: the sky-subtracted image of UGC 12517 with stars and background
  galaxies. Right: the model, a smooth elliptical light distribution with
  no stars, shown with the same brightness scale.
UGC 12517 and its ELLIPROF model, on the same brightness scale (real products).
  • The model follows the fitted intensity, centre, ellipticity and position angle with radius, plus the chosen harmonic terms.
  • It is relative to the subtracted sky: add the sky back to compare with the raw image.
  • It covers the whole image, masked pixels included. It is never masked.
  • Inside R0 and beyond R1 it is extrapolated, not fitted.

The residual

\[ \text{residual} = \text{mask}\times(\text{science} - \text{sky} - \text{model}) \]

On good pixels it is science − sky − model. On masked pixels it is exactly 0.

Left: the residual of UGC 12517 over the whole image, in red (positive)
  and blue (negative), with masked areas in grey and a box around the
  centre. Right: the central 320 by 320 pixels enlarged, showing
  fine-grained noise and a small structured pattern at the very
  centre.
The UGC 12517 residual (real product; grey = masked). Away from the centre it is dominated by pixel-to-pixel noise and by faint sources that the mask did not cover. The pattern at the centre is where the smooth model fits worst.

The residual shows the light that the smooth isophotal model does not describe:

  • dust lanes and patches (negative, absorbing light);
  • embedded disks, bars and rings;
  • shells, ripples and tidal features;
  • globular clusters and background galaxies (positive point-like sources);
  • fitting problems: a wrong sky, a poor centre, an isophote that did not converge, a region inside R0 or beyond R1.

Interpret with care

The residual depends on the fit, the mask and the model settings. A feature that changes when you change the model harmonics, the radial sampling or the mask is not a property of the galaxy. Compare the residuals from --model-harmonics none and the default before interpreting 4-fold patterns.

The residual is also the starting point of a surface brightness fluctuation analysis. See ELLIPROF's role in SBF.

The prepared image

--prepared writes mask × (science − sky), the image exactly as ELLIPROF fits it. Masked pixels are 0. It is the quickest way to check the sky and the mask. See Sky and masks.

Headers and WCS

All three images are floating-point FITS: 32-bit from the single backend, 64-bit from the double one (see Precision). They carry the header of the science image, including its WCS (CTYPE, CRPIX, CRVAL, CD/PC/CDELT, distortion terms), BUNIT and the other keywords. Only the cards that describe how the science data were stored are left out, such as BITPIX, BSCALE, BZERO and BLANK.

Three panels, the science image, the model and the residual, each
  drawn with right ascension and declination axes read from its own FITS
  header. The coordinate grids are identical in all
  three.
Each panel's RA/Dec grid comes from that file's own header (real products). They are identical, so the images overlay exactly in DS9 and other WCS-aware software.

In DS9, load the images in separate frames and use Frame → Lock → Frame → WCS. Images are never resized, cropped, shifted or reprojected, so pixel (i, j) of every product is pixel (i, j) of the science image.

Images in FITS extensions

Many archives store the science image in an extension (for example SCI in HST files). Select it with CFITSIO syntax, quoted for the shell:

elliprof 'galaxy.fits[SCI]' X0=500 Y0=500 R0=5 R1=200 NR=30 \
    -m galaxy.prf
elliprof 'galaxy.fits[1]'   X0=500 Y0=500 R0=5 R1=200 NR=30
  • Only the selected HDU is fitted, and its header and WCS go into the products.
  • elliprof never falls back to another HDU. If the selected one is not a 2-D image, it stops with an error.
  • --mask and --sky-image take the same syntax: --mask 'galaxy.fits[MASK]'.
  • Tile-compressed FITS images (as written by fpack or astropy's CompImageHDU) are read like any other extension.