5.6 The Online Liverpool Telescope Pipe-line

As a result of the decision to operate both an online PL and an off-line PL the filename specification of Section 4.2.2 has been redefined and updated to include a 3 level PL processing flag:

  • p = pipe-line processing flag.
    • 0 will identify a raw-data-file, a file that has not been successfully processed by any pipe.
    • 1 will identify a data-file that has been successfully processed by the level 1 pipe-line.
    • 2 will identify a data-file that has been successfully processed by the level 2 pipe-line, this will be the final pipe in the PL.

where the off-line PL will only run on those files with p=1.

The online LT PL has been written in collaboration with Dr. Iain Steele (IAS) and Dr. Robert Smith (RJS), and was initiated to remove overlap of the CS and original PL. IAS coded the initial online PL infrastructure and the software libraries which perform the basic data reduction (e.g., de-biasing, flat-fielding and de-fringing etc.) using CFITSIO (see Section 3.1.1 and Section 5.9.2) and algorithms presented in Section 2.4. Additional functions were then added as described below with a re-write of the online PL necessary to take advantage of the algorithm structure previously determined by functions which were written to be part of the off-line PL. The online PL’s final architecture was the responsibility of RJS.

The online PL carries out de-biasing, flat-fielding and de-fringing of every image which the LT observes, using library images which are stable for a period of at least one week at the LT site (Irwin and Lewis2001). The library frames are to be updated at set intervals which is to be decided upon during commissioning. The name of the calibration files used are recorded to the FITS header.

The online PL also enables several data quality checks by feeding data back to the CS: A background intensity is calculated using algorithms similar to those used by KAPPA in Section 4.2.5 and recorded to the FITS header. As a measure of the image seeing the Full Width at Half Maximum (FWHM) of those objects known to be stars, in practice this is only performed on the photometric standards (as defined by the LT photometric catalogue see Section 5.9.4), is calculated. These data are extracted from the FITS header by (i) the CS to implement changes to the observation scheduler, thereby performing those observations that have the best chance of being successful and to aid the telescope focus, (ii) the off-line PL to aid in the photometry calculations.

5.6.1 FITS File Input/Output

In order to allow the PL to operate on FITS files it became necessary to code a program that would read, write and perform functions with the FITS file format. The FITS read/write software will be used throughout the PL and so must be generic in format, meaning it must be able must be able to read/write all valid LT FITS files formats (see Section 5.2).

If an integer FITS file is read using floating point variables the amount of memory needed to store the file is increased for no reason (i.e., 256 is read as 256.0). To solve this each file is read in as a “char”, the data type is then iteratively tested to ascertain its actual data type, the keywords remain as “chars” unless their data is required.

To enable fast manipulation of FITS files keywords exists which scale the primary data, these are: (i) BSCALE, the ratio of the physical value to the array value at zero offset. (ii) BZERO, a floating point number which represents the physical value corresponding to an array value of zero. The default values are 1.0 and 0.0 respectively. The true value of any pixel in a FITS frame can be determined from these two keywords thus;

physical value = BZERO + BSCALE   × pij
(5.5)
where pij represents the primary array value. In this way a 32 bit file may be reduced to a 16 bit file, reducing storage needs. However NOST (1999) recommends against this procedure. The ethos is to read an entire FITS file (inc. header and image) into memory, manipulate using the scaling equation and hold it there until all necessary data has been extracted. Whilst this causes a reduction in memory available to perform other tasks, time is saved by not continually reading the FITS file, and memory is also some what expendable in modern workstations.

The reading/writing of the FITS file is achieved by strictly following the structure setout in NOST (1999) and any LT local features. Having created a new set of data to be stored as a FITS file (e.g., after flat-fielding) a new set of header files must be generated. With information taken from both the original file and newly generated data. This process involves detailed “string” manipulation which needs to be done efficiently with out altering the original-memory-held copy of the FITS file in case it has to be re-accessed. The primary data is then rescaled using Equation (5.5), byteswapped and written out.

5.6.2 Basic Reduction

De-biasing, flat-fielding and background calculating is achieved using the algorithms presented in Section 2.4.

5.6.3 Object detection

Online PL object detection is carried out in a similar way to that of PISA (Draper and Eaton1999). The method relies on the contiguous distribution of the pixels in an object. The program recurses until each pixel in the object has been detected. Each time a pixel above the determined background is detected the array element holding the data is set to zero ensuring it will not be re-detected. The location and value of each object pixel is then stored for future use.

5.6.4 FWHM

The Full Width at Half Maximum (FWHM) of a stellar profile is a measure of the atmospheric seeing and telescope focus, it is the same for each star in the frame regardless of brightness or position in the frame if the telescope is properly focused. This definition does not hold for large fields of view or for extremely short integrations, however the LT does not suffer from these effects. The FWHM of an object and the decision as to whether or not it is stellar is calculated as described below.
2nd Moments
In calculating the FWHM of an object its is necessary to define a centre. The bary-centre of a system of rotating bodies is the centre of the combined masses of all bodies in the system, in the case of a single star the bary-centre is generally the stars centre, although this definition can be inadequate or inaccurate if the spatial profile shows a strong skewness or very large wings (Bertin1999). The bary-centre is determined by centroiding using the following equations,
        sum    I x
x  =   - sum i (- S-i-i,                         (5.6)
        sum  i (- S Ii
         i (- S Iiyi
y  =   - sum ---I--,                           (5.7)
          i (- S i
where xi and yi are part of the spatial distribution S of pixels detected above the extraction threshold, and Ii is their associated intensity values corrected for the background contribution.

The second moments are then convenient for measuring the spatial spread of the source profile. These are calculated using algorithms presented by Draper and Eaton (1999):

            sum       2
 X     =   - sum i (- S Iix-,                      (5.8)
   2nd        i (- S Ii
            sum       2
  Y2nd =   - sum i (- S Iiy-,                      (5.9)
            sum  i (- S Ii
             i (- S Iixy
XY2nd  =   - sum ----I--,                       (5.10)
              i (- S i

The basic shape parameters, the semi-major (a) and semi-minor (b) axes of the detected object, represent the maximum and minimum spatial profile of the object in any direction and are calculated by Draper and Eaton (1999) thus:

                          V~ -----------------------
a2  =   2(X2nd + Y2nd)+ 2  (X2nd - Y2nd)2 + 4XY2nd,         (5.11)
                          V~ -----------------------
b2  =   2(X2nd + Y2nd)- 2  (X2nd - Y2nd)2 + 4XY2nd.         (5.12)
From these parameters the orientation of the object can be determined. The ratio of a and b determines whether or not the object is circular and therefore stellar; if the object is circular it is included in the calculation for the frame FWHM. The tolerance value on this ratio is to be set during commissioning.

The calculation of the FWHM for the online PL must be performed quickly so as not to increase off-line telescope time, the systems which use the computed value need only a rough value and for this reason a 2D FWHM is not calculated.

The FWHM of the seeing spatial profile is therefore determined in a 1D manner in both the x and y directions and the mean result is used as the object FWHM. This is performed for every stellar object in the frame with the mean value being the frame FWHM. The FWHM is calculated from the derivation below;

A Gaussian profile is used as a model of the detected object. In 1D, a Gaussian has the form

          1   -(x-m)2/2s2
f (x) = - V~ --e          ,
        s  2p
(5.13)
its FWHM is found by finding the half-maximum point x0. Since the constant is merely a scaling factor it can be ignored, therefore,
e-(x0-m)2/2s2 = 12f(xmax) (5.14)

f(xmax) occurs at xmax = m, therefore

e-(x0-m)2/2s2 = 12f(m) = 12 (5.15)
e-(x0-m)2/2s2 = 2-1 (5.16)
         2
--(x0--m)--
    2s2 = -ln2 (5.17)
- (x0 - m)2- = -2s2 ln2 (5.18)
x0 = ±s V~ -----
  2ln2 + m (5.19)

The full width half maximum is therefore given by

FWHM  =_ x+ - x- = 2 V~ -----
  2ln2s  ~~ 2.35482s, (5.20)
where s is the standard deviation of the data.
Integration with FITS and the Off-line Pipe-line
The information determined by the online PL will be passed to the off-line PL by means of the FITS headers. Following the FITS standard criteria three local FITS keywords are introduced, see Table 5.6.
FITS Keyword
Description




BACKGRD [counts] frame background level in counts
STDDEV [counts] Standard deviation of Backgrd in counts
SEEING [pixels] frame seeing in pixels



Table 5.6: Local Liverpool Telescope FITS keywords.

The online PL is of the order of 800 lines of code and is written using the C programming language.