4.2 The Prototype

During October 1998 observing time was awarded on the Jacobus Kapteyn Telescope in La Palma for early February 1999. This presented an ideal opportunity to test the prototype. For this reason the prototype was constructed to operate on, and optimized for, this particular data set. The data was RIZ observations of low mass stars in the Praesepe cluster, with each target object was observed in all three filters.

The prototype PL was written using several programming languages and pre-written astronomical data reduction packages, to increase speed of production. The aim of the prototype was to find difficulties not apparent when reducing data manually. The prototype was written in several sections or “pipes” which, when connected together formed the PL.

Outlined here are each of the pipes specifying, the programming languages, any pre-written packages, difficulties and the solutions employed. Each of the prototype pipes have been written on a cluster of DEC alpha workstation running Digital Unix V 4.0F and a SUN Sparc Ultra 5 workstation running Solaris Unix 7. See Figure 4.1 for a schematic view of the pipe-line.


Flowchart of the prototype pipe-line
Figure 4.1: Flow chart of the prototype pipe-line.

The Starlink (SL) collection is a multitude of software packages written to help reduce and analyse astronomical data, it is used in the prototype PL.

4.2.1 Pipe 1: Data Conversion

The standard format for astronomical data, and also the format of the test data, is FITS (see Section 5.2). The SL software however has been written to operate on files of Extensible N-Dimensional Data Format (ndf ), where “N” is 1 for a spectrum, 2 for an image etc. The conversion between FITS and ndf  is a accomplished by use of SLCONVERT package (Currie et al.1999b), which supplies an ndf -to-FITS converter. The conversion is lossless, meaning that the process is fully reversible, and the FITS format is preserved within the ndf  file. This preservation means that a reverse conversion, once data manipulation has been achieved, is possible. The automation of this command is carried out through use of a C shell  script. The C shell  is a command interpreter with a syntax reminiscent of the C language.

4.2.2 Pipe 2: File Identification

To perform de-biasing and flat-fielding the calibration files must first be found. Since the files’ names need bear no resemblance to the data contained within them, this is achieved by interrogating the files’ Header Data Units (HDU) (see section 5.2) and searching for the line which references this information. To realise this task when using an ndf  file the KAPPA program was used (Currie and Berry1999). The calibration frames then have a marker placed in their file names to enable easier identification, e.g., filename_vflat.ndf for a V band flat-field frame.

Once identified the individual calibration frames must be combined to form the master versions. This is achieved through use of the CCDPACK package (Draper1999). The master frames are achieved by median filtering the relevant files together. The locating of self-similar files and automation of this pipe is achieved through use of a C shell  script.

4.2.3 Pipe 3: Calibration and Normalisation

The process of de-biasing and flat-fielding is carried out using the CCDPACK package.

De-biasing is performed by the methods described in Section 2.4.1. First a mean bias level is calculated from bias strips of the object frame. This value is then used to normalise the bias frame’s bias strips, and hence the bias frame, to the same bias level as the object frame. This normalised bias frame is then subtracted from the object frames.

Flat-fielding is implemented by the method described in Section 2.4.3. It is important that the correct pass band is used to flat-field the object frames. To this end the automation of this script is again carried out using a C shell  script with in-script use of the programming languages awk, a pattern scanning and processing language, and sed, a stream editor.

This pipe also normalises all object frames to a one second time-scale, by interrogating the HDUs for the exposure time, as described above and dividing the object frame by this value. Photometry may now be performed on the reduced files.

4.2.4 Pipe 4: Image Scaling

Part of the PL is written using SLs Position Intensity and Shape Analysis software (PISA, see Draper and Eaton1999). This software will only deal with data in the INTEGER range 0-32766. Since the FITS images are of 32 bit precision, the data produced by PISA is inaccurate. To enable the images to be processed by PISA they must be reduced to within the correct range. To accomplish this a KAPPA routine was used to find the maximum pixel value in the image. This value is then divided into PISA’s maximum value to create a fractional normalisation, which is stored in a file for data reconstruction later. Each pixel of the image is then multiplied by the normalisation value to reduce its data to within PISAs operating range. The multiplication is carried out using KAPPAs CMULT routine which is a direct interface with the image pixel array.

The pipe’s automation was carried out using C shell  scripts on SLs routines and complemented with in-script use of awk and sed commands.

4.2.5 Pipe 5: Intensity Extraction

The first stage of performing photometry is to detect the objects in the image file. To achieve this several processes must be implemented. Firstly the detection level must be set, if a pixel contains a count above this level then it can be preliminarily labelled as a detection. The detection level of the prototype was initially set to be 3s above the average background level of the frame, this gave a 99.7% probability that the feature detected was real (Bevington and Robinson1992). It will be seen later that this was a reasonable level of detection, as all target objects were detected. The background level was computed by KAPPA using a median algorithm. A true image median would need to use all 10242 values contained in the image. However this is impractical, the more values used the longer the computation time will be. The number of values used is a tradeoff between accuracy and processing time. Currie and Berry (1999) note that: “It is hard to quantify the tradeoff precisely; testing with a typical CCD image of stars and galaxies increases the process time approximately as the log of the number of bins, the accuracy of the pixel sum for varying values of histogram bins used was: 100, 2.8%; 1000, 0.1%; 10000, 0.03% and 100000, 0.002%”. The default value of 2048 bins, giving an accuracy of 0.02%, was the value used, using the default value increased production of the prototype by speeding coding whilst the accuracy produced was sufficient.

A single value above this detection level can not be considered an object, a true object detection is judged by a group of contiguous pixels above the specified level. A target object must be integrated upon long enough to gain a suitable signal to noise and the spread of a point source is governed by the seeing. If a good signal to noise had been achieved then most objects are found to have spread to occupy at least 6 pixels. However inspecting the object frames it was found that some of the targets occupied at least 8 pixels. This larger value was used as the pixel threshold to reduce objects being detected that were not real.

Having calculated the necessary inputs the software used to do this work was PISA, automated through the C shell  and complemented with in-script use of awk and sed commands. For each object frame a file was generated which contained the integrated intensity of each detected object, its peak intensity, its location within the frame the number of pixels above the threshold value, the object’s ellipticity, object orientation and an object index number. The generated file then needs to be reconstructed back to a 32 bit data range. This was achieved by an external awk script which divides the columns, peak intensity and integrated intensity, by the normalising constant calculated in pipe 4.

4.2.6 Pipe 6: Object Identification

The intensity extraction described in Section 4.2.5 occurs for every object in the frame, but since the pixel co-ordinates returned by PISA are meaningless in terms of where the object is on the sky it is not possible to automatically select the desired object. Therefore human intervention is required. The logical method of identifying the target object and correlating it with the intensity list previously generated is to display the object file and then use the data recorded by PISA in pipe 5 to plot an overlay map. The overlay map takes the form of a series of ellipses that correspond directly to both the objects in the frame and the data in the file via the object number printed along side the generated ellipse. The task of finding the target object in the frame is carried out manually using finder charts.

Once the target object has been located its data can be extracted from the file generated by PISA. The data may then be input, along with a unique identification tag which indicates the where data was extracted from, to a file created to record the target object data from a full nights observations. Also written to this file are the airmass and filter band, these data being extracted by cross-referencing the identification tag with the object frames and interrogating the HDUs as above.

If the images are of standard objects, e.g., objects with known magnitudes, then a separate file is created in the same format as the object file, however the magnitude must also be recorded to the data file to enable construction of airmass curves. The standard objects for the RIZ data used during the construction of the PL were extracted from Cossburn et al. (in prep).

Much of the work carried out in this pipe is manual. The automation that could be carried out was accomplished through use of FORTRAN 77, the C shell  and complemented with in-script use of awk and sed commands.

4.2.7 Pipe 7: Colour Correction I

The observations employed Harris R and I filters and the Royal Greenwich Observatory (RGO) Z filter. The natural system of the instrumentation used however, is also Harris. A colour correction is performed before photometry takes place on the magnitudes of the standard stars (Landolt1992) are these are listed in Cousins R and I magnitudes. These are transformed to the natural system using the empirical transformations for red objects presented for the identical telescope, detector and filter combination by Cossburn et al. (in prep).

In the Z band the standard stars used were those presented by Cossburn et al. (in prep), which were again observed with same telescope and instrumentation used to observe the target objects. Therefore the Z band observations are on the Cossburn et al. (in prep) system which is defined using the Zrgo filter by setting the I-Z colour of an un-reddened A0 star to be 0.00.

This pipe was coded using FORTRAN 77. The file containing data for the standard stars is appended with the converted magnitudes.

4.2.8 Pipe 8: Airmass Corrections


Example R-band airmass curve
Figure 4.2: An example R-band airmass curve for night 1, the standard star fields used were PG0918+ & RUBIN 149 (Landolt1992).


Example I-band airmass curve
Figure 4.3: An example I-band airmass curve for night 3, the standard star fields used were PG0918+ & RUBIN 149 (Landolt1992).

The airmass correction which needs to be applied to observational data is described in Equation (2.10). In practice the airmass correction is generated by construction of a straight line through a zeropoint versus airmass x,y scatter plot (See Figures 4.2 & 4.3). Ideally all of the data will lie directly on this line, but since weather conditions change throughout the observing run then this is not the case. The algorithm used to produce the line in the PL is a least squares fit. The errors in the abscissa are so small as to be negligible. Data often lie far off the line, to such an extent that a reasonable fit can not be generated, data of this nature is flagged at the 3s level by the code generating the fit. These data however may still be correct. Such points are checked both against the observing logs, to ensure nothing was noted at the time by the observer, (e.g., telescope vignetted), and against the original image frame (e.g., a cosmic-ray may have occurred). If a scientific reason can be found for removing the data point then this is carried out by hand. The fitting routine may then be re-attempted.

The code for this pipe was written using FORTRAN 77 and complemented manually through use of a text editor.

4.2.9 Pipe 9: Generating Magnitudes

The instrumental magnitude is generated directly from the counts extracted from reduced CCD frames, using:
                sum n
m'=  - 2.5log10   Ci,
               i=1
(4.1)
where, Ci is the count in the ith pixel inside the aperture and n is the number of pixels in the aperture. Ct, the total counts in the aperture, has already been calculated by pipe 5 and the target objects have been extracted by pipe 6. It is therefore a simple process to calculate m', using Equation (4.1). The magnitude of each target is calculated and written to a data file along with the filter band and airmass.

To calculate the actual magnitude of the object the airmass correction calculated in pipe 7 must be used. Each straight line equation calculated by pipe 7 is unique to its filter band. In calculating the true target magnitude, m, the correct equation must be selected and the appropriate airmass used to calculate the zeropoint, zp, correction factor. Equation (4.1) may then be re-written as:

m = zp - 2.5log10 Ct,
(4.2)
The magnitudes file produced by this pipe contained 4 columns: star identification, Rh, Ih and Zrgo and was produced by a FORTRAN 77 program.

4.2.10 Pipe 10: Colour Correction II

The magnitudes produced are in the Harris system, the standard system for this work is Cousins. The magnitudes were therefore transformed back using the inverse of the equations used in the initial colour correction.

A second magnitudes file is produced by this pipe in the same configuration as the first but with Rc and Ic magnitudes, the Z magnitudes being untouched.