This note describes the centroid process in versions prior to 4.3 .

Data transfer.

The data arrives from the CCD controller as a stream of 16 bit pixel data. This is read into buffer #dici_data. When the frame transfer is complete, a VME interrupt causes the software to set a flag indicating that the data is ready for processing.

The r/o-task then re-initialises DICI to recieve the next frame, using local variables for buffer address and data length. The flag ??? is set and the r/o task waits for the next part of the cycle, when data transmission starts.

The Guide loop, running in CTA-TASK, waits for the ??? flag to rise, then copies the raw ccd data into the #ccd-data buffer, to avoid it being overwritten during reception of the next frame.

2D image processes

The 2D image is then processed to remove dark current and bias . Next, the image is filtered to remove high frequency noise , and the remaining noise and sky levels are calculated.

The CCD bias value is estimated by averaging the pixels in a small area in the bottom left hand corner of the CCD when a full frame is read out and the dark current removed. The bias value is stored in the table CCD-OFFSET, one value for each CCD in the system. The bias value for the last FIELD command will thus be used during the guide loop. An offset is added such that the resulting data will have the dark point at around 200 adu's which gives a dynamic range of almost 64000 - the actual CCD bais value. The bias values vary from ~64 for a thick chip to ~5000 for a thinned chip.

The dark current is estimated from two frames recorded earlier and stored on disk. The Readout pattern is generatad during the readout time and is fixed for a full frame image. ( at constant temperature)

2d processes

Dark current removal.

The dark current is then removed from the image and bias are removed from the image. The algorithm includes a constant offset, and a pattern calculated from 2 stored frames, one containing dark current generated during the time of a full frame readout, and another bulk pattern which estimates the dark current generated during the integration time of the current frame. The offset is calculated once per frame from a bias level estimate, the d.c. offset of the start pixel of the dark pattern for the current windowed readout, and an offset to ensure that the result is always positive. The bias level is estimated during the each full frame readout from an underscan area at the bottom left hand corner of the CCD. The two dark patterns are held in memory ( two buffers per CCD head ). The readout pattern frame pixels are scaled for the readout time for the current window size; the integration time frame pixels are scaled by the integration time for this frame compared to the time used in the stored frame. The two scaled values plus the bias component is removed from the CCD image, pixel by pixel. These frame scales have to be done at run time to make sure that the numbers are valid when the integration time or window size changes. The resulting image should have a flat background with the 0 level at around 200 adu's.

Pre-centroid processes

Next, the image is filtered with a 9 pixel square running average, to reduce the effect of single 'hot' or noisy pixels on the later centroid stages. This improves the system performance at low signal level. Once the signal has been filtered, the sky level is estimated by calculating the median pixel value. This is done on a two stage process as follows: First the image is shifted down such that the lowest pixel value is just above 0, to get the sky within the range of the following histogram process. A histogram of the bottom 1000 adu values is then calculated, which should include all of the sky pixels and some of the star values. The median and 25% quartiles are calculated, and the 1 and 2 sigma points derived from these. Those samples in the histogram out to 2 sigma around the median are extracted, to find the histogram of the sky, without the star component and the median and 25% quartile values calculated. The median value is taken as the sky value and the 1 sigma level is used to decide whether there is a star in the field or not. A low signal warning is flagged if the peak signal falls below 15 sigma, and guiding is suspended when the peak falls below 8 sigma. This may seem quite a high threshold, but the telescope tracks well without aid from the Autoguider, so this threshold has been chosen so as not to introduce tracking noise unnecessarily into the telescope movement. The system must not pull the telescope off the star under any circumstances. Next a copy of the image is taken and a separate process calculates the fwhm of the stellar profile from 2 marginal sums in x and y. This happens in parallel with the 1d centroid processes described below. The image is next scaled such that the sums in the centroid process do not overflow either the 32 bit CPU registers or the 16 bit pixels in the image storage memory. This step allows centroiding of images containing pixel data above 32k adu's and saturated images which contain many pixels of high adu count. The image is then converted into 2 1-D marginal sums. A marginal sum is used, post scaling, to retain sub-adu precision when working with low signal level images.

1d processes

For almost all configurations, the same process is used for the x part of the centroid as for the y. The exception is the UES slit, where the slit is always in the X plane so the image has a non-stellar profile in the Y direction. The profile is examined, to calculated the sky value for the zero point of the centre of gravity weighted sum. The peak pixel is taken as the most likely centre of the star. The star is identified as that region around the peak out to the 1 sigma point. The pixels between the +1 sigma and -1 sigma points are extracted and a centre of gravity calculated for these pixels. The process is repeated for the Y direction centroid and the results sent to the TCS to correct the telescope motion. The UES slit is a special case. The algorithm above is used for the X centroid. For the Y-centroid, the image is not stellar, especially when the star has been successfully sent down the slit and only the edges of the profile are visible. Here, the noise in the image and any unwanted ramp type effects due to imperfect dark current estimation are removed by calculating the sky+2sigma threshold and ignoting any samples whose level od below this. Hopefully only the star pixels stick up above the 2 sigma point and the Centre of gravity of the whole window is calculated. This works well, although a 12 sigma guide suspension threshold has to be used to avoid locking on to ramp effect data and pulling the telescope off the slit.

old V402d centroid

This algorithm was used before the UES A&G fibres upgrade and before the filtering routines and histogram sky estimation code was written. It takes the CCD data after dark current removal , shifts it down such that the minilum pixel value is 1 adu and then simply calculates 20% of the peak level. All pixels below this point are replaced by the threshold value and the centre of gravity of the result calculated. For images where the star dominates the image, the result is the same as that calculated above. For noisy signals and signals corrupted by ramp effetcts ( as these are ) , the centroid is diluted by the noise level causing the zero point of the CofG calc not to match the sky level and the 'signal' in the ramp is included as star signal thus adding a quasi-constant offset to the result. This algorithm is available as a reference for future algorithms.