17. Prepare color picture
If you ever tried to render a nice-looking three-color picture out of CCD images, you will have noticed that this is far from trivial. The main difficulties are:
- Exact alignment of the coadded images in all filters (hereafter: channels)
- Find a good color balance
- Truncate the dynamic range in order to create 16-bit TIFF images
THELI does not go all the way to a final image. However, it can prepare suitable scaled images that can be readily processed in third-party software without much further processing.
17.1. Coadditions
The first step that has to be done is to select those stacked images that should be combined for a color picture. THELI assumes that all necessary coadd_xxx directories can be found in the same SCIENCE directory. If you followed the guidelines for processing multi-color data sets, then this will be the case.
All processing takes place in a new sub-directory
SCIENCE/color_theli/
If this directory already exists, it will be unambiguously renamed into
SCIENCE/color_theli_backup_<timestamp>
17.1.1. Preparations
SCIENCE dir: Upon opening this dialog, THELI will fill in the currently processed SCIENCE directory. You can change to any other directory you want. If coadditions are present, then these will be shown in the Select coadditions list.
Select coadditions: Mark the coadditons you want to use for the color image. Several entries can be highlighted at the same time.
Get coadded images: Upon clicking here, THELI will link the coadded images selected into
SCIENCE/color_theli/
If a coadditon was labelled coadd_xxx, the corresponding image and its weight will appear as
SCIENCE/color_theli/xxx.fits SCIENCE/color_theli/xxx.weight.fits
Once all images are linked, an automatic cropping process kicks in that trims all images such that they have precisely the same size, and such that a particular object will have identical pixel coordinates in all channels. Once this is done, the images will be called
SCIENCE/color_theli/xxx_cropped.fits SCIENCE/color_theli/xxx_cropped.weight.fits
Note
This works only if the coadditions were created with identical reference coordinates! This step does not involve any resampling anymore as the images already have identical astrometric projections (if the coadditions were done with identical reference coordinates).
Optionally, you can remove some of the cropped images from the list (they will not be deleted from the hard disk, just ignored), or the full list can be restored. The latter is useful if you want to resume work in an already existing color_theli sub-directory.
- Statistics region: Define an area which is (ideally) free of any stars and nebulosity. This can be as small as 5x5 pixels if necessary and should correspond to the darkest region in the images. In the later color picture, this area will appear with a neutral grey background. Though the coadded images are already sky-subtracted, small residuals could be left, which will be removed in this way.
17.2. ELum + NB combination
17.2.1. Create enhanced luminance
If you took red, green and blue exposures, you will obtain a significantly better (deeper) color image if you combine the three exposures into a synthetic luminance image.
If you have an unfiltered (clear filter, luminance filter) coadded image, you can add the filtered exposures to it to get even greater depth. However, this will only yield an improvement if
- the combined transmission curves of the filtered exposures cover a similarly large spectral range as the luminance filter
- if the total exposure time of each of the filtered images is comparable to or larger than the one of the unfiltered/clear/luminance exposure.
Mask combined image
Pixels which are not covered by all exposures (as judged from the individual weight maps) will be set to zero in the combined image.
Combination method
The following two options are available:
Noise normalised: The background noise of the individual images will be measured in the statistics region specified previously. Images are normalised with respect to their noise and then added (this is similar to the chi-square sense). In this way images with lower background noise contribute more than those with higher noise. The result is called
SCIENCE/color_theli/elum_chisquare.fits
You need to be careful, though. For example, at a dark sky location the background increases significantly from blue to red to unfiltered exposures. If you noise-normalise such data, it can happen that the blue exposure which might carry comparably little signal starts dominating the other exposures, in particular the deep luminance channel.
Mean: The average of the images is calculated. The result is called
SCIENCE/color_theli/elum_mean.fits
If you want to combine plain red-, green- and blue-filtered images, then this is the best approach as it mimics what a luminance filter would have seen.
Note that if you set PHOTINSTRU_KEY = FILTER during astrometry, objects in the three channels will have the same average brightness. If one of them was taken under bad transparency conditions, it will be up-scaled which increases its noise, and can therefore lead to inferior results. Same if you use an image which very low signal-to-noise ratio as compared to the others.
17.2.2. Combine broad-band and narrow-band filters
A problem commonly encountered when creating color pictures is how to include narrow-band exposures in a set of broad-band exposures. This enhances emission line structures, but commonly results in distorted stellar colors or a skewed general appearance of the image. The solution is straight-forward, and since it has not been documented anywhere else for amateur astronomers, I present it in sufficient detail so that it can be reproduced with other software.
Consider two coadded R-band and images. Both cover the line and shall fully transmit it. Two requirements have to be met:
- Both images are normalised to the same exposure time (e.g. 1 second), which happens automatically during coaddition with THELI.
- The relative throughputs between the two filters are preserved in the coadded images. In other words, the same continuum source (star) will appear n-times fainter in the narrow-band image if the narrow bandpass is n-times smaller than the broad pandpass. In THELI this is achieved by setting PHOT_INSTRUKEY = FILTER when running the astrometry/photometry with Scamp.
Problem: Let’s consider stars only, which are continuum emitters. When adding the narrow-band exposure to the broad-band exposure, we make the stars brighter, and hence change the color balance with respect to the other broad-band filters.
Solution: We have to first downscale the broad-band image by some amount, so that the final stellar flux emerges unchanged once the narrow-band image is added.
The scaling factor is easily calculated from the filters’ FWHM ratio. For example, if the narrow-band filter transmits 10% of the broad-band filter, then we have to scale the broad-band image by a factor of 0.9 to accomodate the additional narrow-band flux. Therefore,
Here, and represent the two images, and is a weighting factor that is 1 by default. Now lets consider how this formula works for continuum and emission line sources.
Continuum source (star): We assume that the star has a flat spectrum within the bandpasses, which is a good enough approximation for our purposes. Seen through the narrow-band filter, the star then has a flux of
Insert this for in the first equation, and you will find that
Therefore, a star’s brightness is conserved in the combined image.
Emission line source: Both the R-band and the filter encompass the emission line and (nearly) fully transmit it. This means that a pure emission line source, which does not emit outside the narrow bandpass, will appear equally bright in both filters:
Insert this for in the first equation, and you will find that for a weighting factor of we have
In our example, where the filter has 10% the width of the broad-band filter, this means that the flux is enhanced by a factor of 1.9 compared to the broad-band image, while maintaining stellar fluxes. This is sufficient for most purposes. For weighting factors of or , the enhancement factor would then be 2.8 and 3.7, respectively.
This method works for all sets of narrow- and broad-band filters that cover the same emission line, e.g. a blue or green filter and the [OIII] doublet. If the broad-band filter transmits the emission line to e.g. only 60%, because the line is at the edge of the bandpass, then this can easily be corrected for by multiplying the FWHM ratio by 0.6.
NGC 7822: Left: RGB; Middle: (RHa)GB, ; Right: (RHa)GB, ;
Note that the stars’ colors remain unchanged, while the extended nebulosity gets increasingly enhanced with growing weight factors. Exposure data: ST10XME, 102mm FSQ, RGB = (8x8x8)*240s, = 6*1800s. Apart from identical contrast stretching no further image processing took place for these three images. Color calibration was achieved based on BVR magnitudes of 50 stellar NOMAD sources (see next section below).
17.3. Color calibration
The idea behind color calibration is to have a solar-type G2V star appearing white in the color picture. If this only depended on the total telescope throughput (mirror reflectivity, corrector lenses, filter transmission and quantum efficiency), fixed calibration factors could be used. However, the atmosphere changes its transparency continuously because of changing airmass, dust, cirrus, humidity etc. Atmospheric extinction has a significant impact even in very clear nights when targets are rising or setting, affecting the calibration factors by 10% or more. If exposures are taken in different nights, the balance can be off even more. Variations on the level of a few percent are easily seen by the eye in a color picture.
The best way to obtain the color calibration is to identify solar-type stars directly in the images. Like that
- no external standard star observations are necessary
- it works under non-photometric conditions
- no extrapolation from external observations is necessary.
However,
- G2 stars are rare (only about 6% of all stars are have type G2)
- known G2 stars in the image could be saturated as only bright stars have spectra taken
- the reference star could be variable
- no reference stars are present in the field (or their spectral types are unknown).
17.3.1. Photometric color calibration (PCC method)
To work around these problems, one can drop the requirement of selecting known G2 stars as standards, and take G2-alike stars instead. These can be selected photometrically from an external reference catalogue by means of their color indices. In the classic Johnson-Cousins UBVRI system, G2 stars have on average B-V = 0.65 and V-R = 0.5. In SDSS ugriz filters we have u-g = 1.43 and g-r = 0.44. Once a sample of suitable field stars is known, they can be identified in the images and calibration factors are readily determined.
17.3.2. The average white approach
What if no G2-alike stars are found, i.e. in under-dense regions or in images with a very small field of view? In this situation a good white point can still be obtained by making all stars on average white. Compared to the PCC method the blue and green channels appear enhanced. The reason is that the average stellar population is somewhat reddish (80% of all main sequence stars in the solar neighbourhood are red dwarfs).
The calibration factors will also depend on the line of sight: stars in the galactic halo have different characteristics than those in the disk, and towards the galactic bulge things change once more. Thus, one will obtain slightly different calibration factors depending whether one looks outside the disk, into the disk, or towards the galactic centre. Galactic extinction (interstellar reddening) will be partially removed by this method, which might be a desirable effect (or not).
17.3.3. Calibration in THELI
THELI offers both the PCC method as well as the average white approach.
Calibration is fairly easy:
- Identify the red, green and blue channels
- Choose a download server for the photometric catalog, and click on Calibrate. THELI will probe SDSS, UCAC4 and NOMAD for G2-like reference sources. SDSS covers about 14500 square degrees around the northern galactic cap, with a few extensions down into the galactic plane. It is based on CCD photometry which is accurate to within about 1%. UCAC4 is similar but shallower, and covers all the sky. NOMAD is an all-sky catalog based on photographic plates with significantly larger uncertainties, and will be retired from THELI as soon as deep SDSS-like photometry becomes available for all the sky. THELI also calculates an average white calibration.
- You can switch between the four different calibration results. THELI uses the following color indices to select G2-like stars: u-g, g-r and r-i for SDSS, B-V, g-r, r-i for UCAC4, and B-V, V-R for NOMAD. THELI will automatically extend the search range for G2-like stars by a factor of up to 2 if no matching stars are found within +/-0.05 mag of the nominal G2 star colors.
- Upon calibration, objects will be detected in the images and non-saturated stars extracted. In case of the PCC method only stars matching the G2-alike stellar sample will be used, whereas with the average white approach all non-saturated stars will be kept. The red and blue images are then scaled such that these stars have on average the same brightness as those in the green image.
- Preview the result. This is not a well-balanced image in terms of contrast and black- and white-points, but the colors are accurate. You can modify the calibration factors manually and evaluate their impact.
17.4. FITS >> TIFF
The last step is to convert the FITS images to 16-bit TIFF format. The latter can be exported into e.g. Photoshop or other programmes for further processing. Note that for Photoshop FITS Liberator is available, which can directly import the FITS images. The next release of FITS Liberator will be a stand-alone tool that does not require Photoshop anymore.
Before you can proceed in Photoshop or with FITS Liberator, you must fine-tune the sky background and apply the color calibration factors:
Click on Get statistics, which will measure the mean background level and its rms in the statistics section defined previously.
Then choose between two methods to create the 16-bit TIFF images:
17.4.1. Convert FITS to TIFF (classic)
This will convert each FITS image to a stand-alone TIFF image, which you have to combine in an external programme to render the final color image. You can manually override THELI’s suggestions:
- Sky: This is the average background level measured in the statistics section. This value can usually be left unchanged.
TIFFmin: This will be the black-level of the TIFF image, i.e. all pixels in the FITS image with values below this threshold will be represented as black in the 16-bit TIFF. THELI identifies the image with the largest background noise and multiplies this value with -6. The resulting value, TIFFmin, will be the same for all exposures. In this way the sky background is not clipped. Usually you can leave this value unchanged.
TIFFmax: This is the white-level of the TIFF image, i.e. all pixels in the FITS image with values above this threshold will be represented as white in the 16-bit TIFF. TIFFmax is set arbitrarily 500 times higher than TIFFmin.
If you want to display even brighter image parts without saturation, increase this value, otherwise leave it (or decrease it). For example, you observed a galaxy with a bright core and don’t want this core to be saturated. Measure its brightness in the three color channels (e.g. red=25, green=15, blue=12) and set TIFFmax to a value that is somewhat higher than the maximum of the three (e.g. to 30).
Warning
TIFFmin and TIFFmax must be identical for the red, green and blue channel, otherwise the color calibration performed previously will be distorted. You may choose different values for luminance channels.
Using the Convert FITS to TIFF button will convert all images listed in the statistics table into TIFF images:
SCIENCE/color_theli/*.tif
If you want to use the corresponding FITS images (color calibrated and sky subtracted) for e.g. FITS Liberator, use
SCIENCE/color_theli/*_2tiff.fits
17.4.2. Convert FITS to TIFF (using STIFF)
A slightly different approach uses the STIFF package. STIFF creates individual 16-bit TIFF images as well, but can also combine the three color channels into a color TIFF, such that you don’t have to do this in external software anymore. In addition, STIFF offers to increase the color saturation and to apply a non-linear gamma correction. However, these things can also be done in any classic image processing software).
STIFF parameters
Note
STIFF applies the sky background values listed in the statistics table, the same as used by the classic FITS to TIFF conversion.
Min | max level: Same as TIFFmin and TIFFmax described above.
Saturation: Only meaningful when creating a RGB color TIFF
Gamma: Non-linear gamma correction to the dynamic range.
Make RGB image: Select here which images should be converted. If you choose Make RGB image, the red, green and blue images defined in the color calibration section will be converted into a 3-color RGB TIFF image, saved as
SCIENCE/color_theli/rgb_stiff.tif
If you want to convert a specific channel into a grey-level TIFF, then just select it from this pull-down menu. The resulting TIFF image will be displayed automatically and is stored as
SCIENCE/color_theli/*_stiff.tif
Only one TIFF at a time will be created when clicking on Convert FITS to TIFF.