makeflat - a series of frames into a flat field.

makeflat coadds a set of frames by taking the median or the clipped mean at each pixel. It is designed to take the hassle out of producing sky flats for ULTRACAM data. The user can specify thresholds to determine which frames to use for the flats because typically evening flats start saturated and only become unsaturated after a while. "Saturated" for ULTRACAM really means no up/down "pepper" pattern which typically appears above about ~28,000 in the g and u CCDs and ~50,000 in the red CCD. The program first determines the mean levels of all input frames (which must be bias subtracted beforehand) and then averages them in groups of similar mean level, each of size ngroup (see below). This averaging is done via a clipped mean or median. The averages are then co-added. This procedure correctly weights low and high signal flats avoiding the problem in simultaneous combination of all frames (with combine for example) that one give ratty data and good data equal weight.

Consider taking 70 frames and setting ngroup=7. The frames will then be grouped by mean level into 10 groups. Each of these will be combined with normalisation. The frames must be normalised to make median/clipped mean combining possible under circumstances when the mean level is always changing. The 10 resulting frames should be free of stars, assuming that the telescope was moved as the flat was being taken because the median will kick them out. The 10 frames are then scaled back to the mean level of their input groups and then added together. This is the step that allocates the correct weight to both high and low count frames.

The final step is to normalise each CCD by its mean. You can separately normalise over different regions later by hand if you prefer. Frames are also selected with a lower threshold on the basis that if the level is low, uncertainty in the bias level might cause errors in the final flat. Of course, setting this level may depend on just what is available. The program tells you how many valid flats there were at the end to help you decide.

The 'sigma clipping' method used is not without pitfalls: consider what happens in a case of pure gaussian noise. Applying clipping at 1.96 sigma should lead to rejection of 5% of the points. In practice however it causes more like 12% rejection. This is because as points are rejected, the estimated RMS becomes too small. Even worse at 1.6449 sigma one expects 10% rejection whereas 45% are rejected, while, much better, at 2.5758 sigma one expects 1% rejection cf 1% observed. 2.5 sigma is thus a sensible minimum to adopt.

NB If you ctrl-C'ed grab while getting the files for makeflat you may corrupt the last file. You can tell this by seeing if there is a file in addition to whatever grab says it has written to disk. You should delete such files because they will prevent makeflat from working.

NB The flats must be bias subtracted prior to running this routine. If there are no valid frames for any CCD, the corresponding CCD will be set = 1 on output and you will need to splice it in from a different flat using uset.

Invocation

makeflat list method (sigma careful) ngroup region low high output

Arguments

list---List of file names.
method---'m' = median, 'c' = clipped mean. The clipped mean rejects one pixel at a time and then recomputes the mean and rms again before having another go.
sigma---If method = 'c', this is the number of sigmas for rejection. See above for some information on choosing this.
careful---If method = 'c', this controls the mehod of rejection. true means pixels are rejected one at a time, worst first. false means pixels are rejected in groups which can potentially lead to the odd false rejection.
ngroup---The number of frames/group to be combined prior to summing. This is used as a minimum number if it does not divide the number of available frames equally. A typical number is 7.
region---The region over which to measure the average, specified as a window file (e.g. see setwin). Set equal to "FULLFRAME" to get the entire frame.
low---Lowest mean level to include. You will be prompted for a value for each CCD
high---Highest mean level to include. You will need to specity a value for each CCD
satval---It is possible for saturated frames to have overall the correct mean, thus an extra safeguard is to eliminate saturated frames. First you need to define a level to count as saturated. You may need to account for bias subtraction
maxsat---This specifies the maximum percentage of pixels that can be saturated before a frame is kicked out
output---Output frame

Guidance notes

Assuming you have observed the twilight sky with ULTRACAM you will typically have a large file which may start with some or all of the CCDs saturated, and then later one by one, the CCDs will come off saturation. Even after this point, the green and blue typically show extensive "peppering" above count levels of about 30,000/pixel. Late in the run, the count levels may be low and you may not want these. The first thing to do is to use grab to grab the files into a series of ucm files.You should next subtract the bias frame from each of these. Next work out the upper and lower levels for each CCD of flats that you think will be OK. You are now ready to use makeflat. The output from makeflat should be immediately useable by reduce. However sometimes you may have take the flats from different runs for different filters, in which case uset is useful to splice different frames together. You should note the number of frames that makeflat says it has found for each CCD in deciding upon this.

Classes

This command is a member of the classes: Arithematic, Observing, Programs.

Author: T.R. Marsh
Created: 27 May 2003
Revised: 09 Jan 2006


Page generated Fri Jul 5 12:23:42 2013