This section comprises the final sky subtraction and the coaddition.
This step is generally considered to be mandatory, at least for multi-chip cameras, as otherwise the gaps between the chips show up as discrete jumps in the background (if the latter was variable). If you prefer not to do subtract the sky, then simply omit this step.
Sky modelling has to be done with care if very large objects are present in the field. THELI offers different and very flexible modes for sky subtraction.
Filename extension: After running through this step, images have the string .sub appended to their filename extension, e.g.
Automatic sky modelling is the default method and useful for all exposures where the largest object is significantly smaller than the field of view of the detector.
Do not use automatic modelling if you are interested in very faint and extended structures that are not or just barely visible in a single exposure. They will not be masked, therefore enter the background model and as a result will be removed from the data. Subtract a constant sky in this case.
In a first pass, SExtractor is run to remove all objects from the image. The resulting gaps in the field are filled in with a dynamically variable estimate, after which a convolution with a Gaussian kernel is performed. You must provide the usual detection threshold, minimum number of connected pixels, and the FWHM (pixels) of the Gaussian kernel. Optionally, the created sky model can be saved.
A constant sky value should be subtracted if very extended targets are present that prevent the sky from being modelled at the target’s position.
If desired, you can manually fine-tune the estimates for each image. This approach is useful if the target is in size comparable or even larger than the field of view, or if extended very low surface brightness objects are observed which might be mistaken as a background feature and removed by sky modelling.
The configuration is split in three parts, not all of them have to be filled in:
1. Choose statistics
Define how the sky background estimate is determined. Choose between
Mode or median are the best choices in most cases. The other two are unlikely to yield better results.
From each chip: If you are using a multi-chip camera, measure the sky independently in all CCDs.
From chip i: Alternatively, estimate the background from one chip only where you think the sky is representative for the entire mosaic, and subtract this value from all other chips. In this case you can make use of windowing (see below).
This task DOES run SExtractor over the images, using the detection thresholds provided under Model the sky. The statistical estimates are obtained from the object-subtracted images. If you do not provide thresholds, default values will be used (DT=1.5, DMIN=5).
2. Region with empty sky (optional)
You can specify a small window that does not contain any flux from extended objects and obtain the sky estimate from it. There are two options:
If you leave one or more of the fields empty, the entire detector area will be used.
3. Manual override (optional)
Use this feature only if you want to manually fine-tune individual sky background values.
This task DOES NOT run SExtractor to remove objects from the images, the thresholds given under Model the sky are not applied. The statistical estimates are obtained from the images as they are.
The following settings can be made:
Get estimates: Determines from each image (no objects subtracted) the mode, median, mean and lower quartile. If a window was defined, the sky will be estimated from it. This has to be done only once, as the output is stored internally. The result will be shown in the table, one value for each image. The numeric values are editable. This task will always run on all chips, no matter what selection you make elsewhere.
Load/Save: The statistics obtained by Get estimates is saved in:
You can Load such a statistics if it already exists, or Save it under a particular filename. You do not need to save the table explicitly. THELI will use the values displayed in the table when you leave this dialog (the what you see is what you get principle).
Fill: Replaces any value in the table with the numeric value entered in the field to its right. This does not erase the values obtained through Get estimates. If you select e.g. Mode again for the display, the previous values will be restored. This button can be clicked instead of Get estimates at the very beginning, for example if you know that you only want to subtract a value of e.g. 587.3 from all images.
Show mode: Can be used to display either the mode, the median, the mean or the lower quartile in the table. You can cycle through the various measures without loosing data.
Use all chips: If you have data from a multi-chip camera, select whether the sky value displayed is taken from each chip individually, or only from a particular chip whose background you consider representative for all other chips. For example, all 8 CCDs of the camera cover a large object, and only chip no. 5 contains a small region with empty sky. Then you would define the window, click on Get estimates and select Use chip 5. You can cycle through the various chips without loosing data.
Show mosaics only: Allows you to display exposures only, i.e. the table will contain only one line for a group of n images, where n is the number of chips in your camera. The name of the image of the first chip will be displayed, representative for all other images of the same exposure. The other option is to show all images of all chips.
WYSIWYG principle for constant sky configuration
When you close the dialog, sky subtraction will be performed according to your settings. If you manually fine-tuned the sky, the content of the table will be saved to
together with the associated image names. If a file with the same name is present already, it will be overwritten without warning. This file will be read once you launch the sky subtraction. If you selected Show mosaics only, then all images of one exposure have the same sky value assigned. That is, what you see is what you get.
This last step is internally broken down into several other steps. First, images are resampled to a common output grid taking into account the astrometric solution obtained previously. This step is parallelised. In an optional second step the resampled pixels contributing to one output pixel are compared and outliers can be rejected (their weight is set to zero). This task is not (yet) parallelised and can be lengthy for larger mosaics. Afterwards, the resampled images are combined into the coadded image, and the header of the latter is updated with various parameters and measurements. Resampling and stacking are done with Swarp.
The coadded image can be found under
where xxxx stands for an unambiguous, user-provided identifier. Thus different coadditions can be created without overwriting older stacks.
Proper motion: If you observed moving targets, you can enter here the proper motion vector. THELI will look up the DATE-OBS keyword in the FITS header and apply a linear offset to the WCS solution contained in the astrometric header. Like that the moving target will fall on top of itself in the coadded image instead of leaving a trail:
Good if you want to detect e.g. faint TNOs not visible in single exposures.
Pixel scale: The pixel scale of the output image. You can decrease or increase the resolution. The latter only makes sense if your data is undersampled and if you have a sufficiently large number of dithered exposures, or if you want to match your image to that taken with another telescope or camera. Upsampling by more than 50% is rarely useful with ground-based data.
If left empty, the native pixel scale given in the instrument configuration will be used. For instruments with exchangable foreoptics (e.g. SOI@SOAR, FORS1+2@VLT) this is the most frequently used pixel scale.
Sky position angle: If left empty then THELI will orient the coadded image such that North is up and East is left. If you want a different sky position angle, then enter it here (counted positive from North over East). If your data was taken under a (unknown) non-zero position angle, you can estimate it by clicking on the From image button. This will not rotate your images into standard orientation. However, note that a flipping of axes will always be corrected.
Outlier rejection threshold: The clipping threshold in units of sigma. If a (resampled) pixel deviates by more than this from the mean value of resampled pixels at this location, then it will be removed from the stack (i.e. it has its weight set to zero). If left empty, no rejection will be performed.
A value smaller than 4 should only be used if you have 15-20 exposures or more, ideally with a cluster size larger than 1 (see below). Values less than 3 hardly make sense. If you feel you need such aggressive rejection, probably something else went wrong in your data reduction process, such as mismatched darks, bad sky subtraction (near-IR only), or you forgot to dither your telescope. A warning message will be shown.
Outlier rejection cluster size: Only mask pixel groups consisting of that many bad pixels above the threshold. If you find that masking is too zealous, then increase this to values larger than 1. Values larger than 9 are not permitted and will be reset to 9. Requires the rejection threshold to be non-empty. For the Lanczos2/3 kernels values of 3-6 work appear plausible.
Outlier rejection border width: If a pixel is found to be bad, then also mask a ring of pixels around it. This parameter specifies the width of this ring in pixels. Requires the rejection threshold to be non-empty.
Resampling kernel: Choose from
Animation of images resampled with LANCZOS3 (top) and NN (bottom) kernels.
Note the erratic wiggling of stellar positions using the NN kernel:
The NN kernel can also lead to significant distortions within the PSF, depending where on the pixel grid a source is projected. Look at the bright star immediately above the diffuse large galaxy. In one of the images it appears significantly elongated, whereas this is absent with the LANCZOS3 kernel.
The projections of the proposed FITS WCS standard are available in THELI (copied from the SWarp manual, thanks Emmanuel!). Nine of them are equal-area projections, i.e. they preserve surface brightness (indicated with yellow labels).
Which of the projections is chosen does not really matter as long as the field of view is about less than 10 degrees. For larger fields projection effects become significant.
Pseudoconic and polyconic projections
Some projections require additional PVi_j parameters in the header, i.e. you must run Scamp with distort>1:
CYP, CEA, COD, COE, COO, COP, BON