Table of Contents Previous Chapter
The fepCClkBias module, executing in the FEP, calibrates the bias map for subsequent continuously-clocked science processing. It is called from fepCtl with a single argument, fp
, a pointer to the fepParm
structure. Before invoking fepCClkBias, the FEP must be commanded to load a continuously-clocked FEPparmBlock
into fp->tp
.
In continuous clocking mode, all pixels within the same column have moved through all rows of CCD image and frame stores, and are therefore characterized by identical values of bias threshold. However, the FEP hardware thresholder requires the bias map to be 2--dimensional as in timed exposure more, although all entries in a given column will be identical. It is therefore particularly simple to compute the continuously clocked bias map ---the image map is filled with N consecutive rows of pixels (typically 1024), and the bias threshold for each column is determined from the N values. The values are replicated in each row of the bias map. If a bias value is subsequently upset by a high-energy event and is detected by its incorrect parity, the correct value can be retrieved from the remaining values in the same column of the bias map.
The fepCClkBias function has a single mode of operation:
All interactions with the BEP and with FEP hardware are made through fepio library functions described in Section 39.0. The commands that are passed between FEP and BEP are defined in that document and in Section 4.10. fepCClkBias makes use of the following functions which call each other in the manner shown in Figure 1:
FEPparmBlock
,
fp->tp
, and perform all necessary initialization.
EVEN=0
, ODD=1
) of the corresponding bias map value.
The following FEPparm fields, defined in fepCtl.h and fepBep.h, are invariably addressed by the fp pointer parameter, are used by the bias calculation:
br
bias0[4]
biassumex
FEPexpRec
record
expnum
timestamp
expcount
fepStatus
biasflagflags
FP_SUSPEND
BEP_FEP_CMD_SUSPEND
sent
FP_PAST_EOR
FP_TERMINATE
BEP_FEP_CMD_STOP
FP_DONE
nextexpnum
quadrants
tp
bparm[5]
ncols
noclk
nrows
quadcodeThe following paragraphs describe the basic functions performed by fepCClkBias during continuously clocked bias calibrations, which are determined by the fields in the parameter block, fp->tp
shown in Table 48.
TABLE 48. Parameters used by fepCClkBias
---------------------------------------------------------------------------------- Field Type Field Name Description ---------------------------------------------------------------------------------- unsignednrows
Number of pixel rows between frame markers. unsignedncols
Number of pixels per output node per row fepQuadCodequadcode
Output node configuration, i.e., ABCD, AC, or BD. unsignednoclk
Number of overclocks per row per output node intbparm[1] =0 to use the Interated Mean algorithm, mean =1 to use the Fractile algorithm, fractile int
bparm[2] For mean, specifies s rejection criterion. For fractile, index of sorted pixel array. ----------------------------------------------------------------------------------
The bias calibration algorithms themselves are presented in some detail in the ACIS report entitled "CCD Bias Level Determination" by Rita Somigliana and Peter Ford, ACIS part #36--56101--02, MIT CSR, Revision 2.1, June 19, 1995.
This algorithm, described in Section 3.2.4 of 36--56101--02, is implemented by the function mean (see page 1264 of the current document). It takes the N pixel values pi, i=0,N--1, (N is 2*fp->tp.nrows
, usually 1024 in continuously clocked mode), and computes their mean value p and variance s2:
If the value of BPARM[2] is zero, mean returns p as the bias value. Otherwise, it inspects the pi and removes any that do not satisfy the condition
Finally, it recomputes p from the remaining pi using Eq. 9, and returns it as the bias value.
This algorithm, which is a generalization of the Median method described in Section 3.2.5 of 36--56101--02, is implemented in the function fractile (see page 1265 of the current document). It takes the N pixel values pi, i=0,N--1, sorts them into ascending order, and returns the value indexed by the value of bparm
[2]
. For instance, if N were 11, and bparm
[2]
were 5, and the pixel values pi were,
212 216 205 1041 208 217 211 214 215 206 210
their bias value would be 212, since, when the values are sorted into ascending order,
205 206 208 210 211 212 214 215 216 217 1041
that is the value of the element p5. In practice, N is 2*fp->tp.nrows
, usually 1024.
45.6.3 Use 1: Calculate a Continuously-Clocked Bias Map
fepCClkBias calls FEPCClkBiasInit to validate the fp->tp parameter block, to initialize the parity table (fp->parity), and set the hardware registers to write the first half-frame (512 rows) of image pixels into the first half of the image buffer. It then loops over calls to FIOgetExpInfo, waiting for the image frames to be received from the DEA. The first fp->tp.initskip frames are ignored.
Immediately a valid frame arrives, fepCClkBias resets the hardware registers to cause the second set of 512 rows to be written into the remainder of the image buffer. It then calls FEPCClkBiasExec to monitor the arrival of the 2*fp->tp.nrows
rows and accumulating overclock values. Once the last row has been processed, FEPCClkBiasExec saves the average overclock for each CCD quadrant and returns. While waiting for each row to arrive, FEPCClkBiasExec calls FIOgetNextCmd to see whether a command has arrived from the BEP. If it has, FEPCClkBiasExec calls fepHandleCmd and then tests the FP_TERMINATE
bit in fp->flags. If the latter has been set, as a result of receiving a BEP_FEP_CMD_STOP
command, FEPCClkBiasExec terminates immediately and fepCClkBias marks the bias map as bad.
fepCClkBias then calls FEPCClkBiasProc to calculate the bias for each CCD column, using either the "iterated mean" algorithm, or the "fractile" algorithm. These are discussed in detail in Section 3.2 of the CCD Bias Level Determination report described in Section 45.5 above. Once computed, the bias values are written into all elements of that column of the bias map. Their parity is also calculated and written into the bias parity buffer.
This section describes the functions that are local to the fepCClkBias module. The only external is fepCClkBias itself which is called from fepCtl. The FEPparm
structure is defined in fepCtl.h and fepBep.h, along with several pixel access macros. The interface to the FEP I/O library is described in Section 39.0, and data and messages exchanged between FEP and BEP are described in Section 4.10.
FEPparm *fp
fepCClkBias is called from fepCtl with a single argument: the pointer fp to the fepParm structure. It is responsible for all FEP actions associated with a timed exposure bias calibration. It performs the following actions:
fepParm
fields and hardware registers. It tells the hardware to begin writing the first frame at the top of the image map. If FEPCClkBiasInit returns FEP_CMD_NOERR
, fepCClkBias calls fepAckCmd and continues. Otherwise, it calls fepNackCmd to pass the error code to the BEP, indicating that the command has failed, and fepCClkBias then returns to fepCtl.
FP_TERMINATE
bit is set in fp->flags, indicating that the BEP has issued a BEP_FEP_CMD_STOP
command, it marks the bias map as "good" by setting fp->biasmode
to TRUE
and fp->br.biassum
to the sum of the 4 elements in the fp->br.bias0
array, and it saves these values in I-cache via a call to FIOsetBiasConfig.
FEPparm *fp
This function is called from fepCCLKBias to process a single frame. It loops over incoming rows of image pixels, calling FIOgetNextCmd once per row to catch in coming commands from the BEP and, when detected, fepHandleCmd is called to process them. FEPCClkBiasExec then sums the overclocks. The process is termi nated prematurely if a BEP_FEP_CMD_STOP command is received from the BEP, in which case the FP_TERMINATE flag is set in fp->flags. Once a pair of frames (2*fp->tp.nrows rows) has been processed, the over clock values are summed and saved in fp->br.bias0.
FEPparm *fp
This function is called from fepCClkBias to verify the contents of the FEPparmBlock, fp->tp, and to perform the following initializations:
fp->quadrants
is set to to 2 or 4, depending on the value of fp->tp.quadcode
.
FEPparm *fp
This function is called from fepCClkBias once the image map has been filled with two frames of pixel rows. It begins by computing a table of 4096 elements, each either PARITY_EVEN or PARITY_ODD, according to the parity of the integers 0 through 4095. For instance, the number fifteen is represented by the bit pattern 01111, which contains an even number of `1's. Its parity is therefore even, so fp->parity[15] = PARITY_EVEN. The image pixels are then examined column by column, a bias value is computed for each column and stored in the corresponding column of the bias map. The bias values are calculated by copying a pair of pixel columns to a pair of value arrays, Data0 and Data1, located in D-cache (for access speed). The algorithm used to compute the bias values is determined by the value of fp->tp.bparm[1]. bparm[1]=0: mean is called to compute the mean of the pixel values,as de scribed in Section 45.6. When fp->tp.bparm[2] is zero, this becomes the bias map value. When fp->tp.bparm[2] is non-zero, pixels with values that differ from the zeroth-order mean by more than fp->tp.bparm[2] times the RMS vari ance of the values are eliminated, and the mean of the remainder becomes the bias map value. bparm[1]=1: fractile is called to sort the pixel values into ascending order. The element in this sorted list indexed by fp->tp.bparm[2] becomes the bias map value, as de scribed in Section 45.6.2. Once a pair of bias values has been computed, they are stored in the corresponding columns of the bias map. Then their parities are computed and, every 32 columns, a column of 32-bit parity flags is stored in the bias parity map. It is important to store the bias values and their parity flags as soon as they are calculated since their maps are located in bulk memory which is subject to single-event upsets (SEUs). By saving the values in all rows simultaneously, elements that have suffered SEUs can be replaced at a later time by undamaged duplicate values.