SCULIB_CALC_FLATFIELD

calculate flat-field results for a bolometer

Description:

This routine calculates the image parameters from data taken as a flat-field measurement of a SCUBA bolometer. It takes as input data a map made of a point source with pixels on a square grid.

If status is good on entry, the routine will set default return values to VAL__BADR except QUALITY set to 0. As progress is made through the routine the various image quantities will be set to their derived values, and QUALITY will be set to 1 if any problem is encountered.

An attempt will then be made to estimate the 0 level of the image by averaging valid data points in the corners of the map area. If there are any such points then the 0 level will be subtracted from the map.

Next the routine will calculate the 0th and 1st order moments of the image on the map. Map pixels with bad quality are ignored.

The 0th order is calculated as

U0 =ijfij, (14)

where i,j are the pixel indices. The 1st order moment in X is calculated as

Ux =ijxfij, (15)

where x is the x position of pixel i,j; and the 1st order moment in Y is calculated as

Uy =ijyfij, (16)

where y is the y position of pixel i,j.

If the 0th order moment of the image was 0, i.e. there is no image on the map, then a warning message will be output and the routine will return with good status and QUALITY set to 1. Otherwise, the x,y centre of the image is calculated from:-

X cen = U_x U 0(17)
Y cen = U_y U 0(18)

With this information the image can be analysed further by one of 2 methods. The method used depends on the value of parameter FLAT_ANALYSIS. If there is an error reading this parameter, or its value is not either MOMENTS or FIT, then a warning message will be issued and a value of MOMENTS will be assumed.

For a MOMENTS analysis the 2nd order moments can be calculated about the centre of the image:-

Uxx =ij(xXcen)2fij (19)
Uxy =ij(xXcen)(yY_cen)fij (20)
Uyy =ij(yYcen)2fij (21)

The parameters of the weighted ellipse describing the data are then (following ‘Analysis of Astronomical Images using Moments’, R.Stobie, J.B.I.S., 33, 323):-

tan(2θ) = 2Uxy Uxx Uyy (22)
A2 = 2(Uxx + Uyy) + 2(Uxx Uyy )2 + 4Uxy 2 (23)
B2 = 2(Uxx + Uyy) 2(Uxx Uyy )2 + 4Uxy 2 (24)

For a FIT analysis, a 2-d Gaussian is fitted by a least-squares routine to the data. SCULIB_FIT_ROUTINE is the routine that performs the fit while SCULIB_GAUSSIAN_XISQ calculates the chi-squared of the fit to the data. An error will be reported and QUALITY set to 1 if there are any problems with the fit process. The fitted function is :-

P exp( (xXcen)2 (yYcen)2 σ2 ) (25)

where SIGMA (σ) is an ellipse with semi-axis lengths A and B, with THETA (θ) the angle between the x axis and A (THETA in radians, measured anti-clockwise).

If all is well still, the volume under the image and the variance on it are calculated. The volume will be the sum of all map pixels under a circle of 12 arcsec radius for short-wave array bolometers, or 25 arcsec for other types. If this area laps over the edges of the map, or any pixels inside it have bad quality then a warning message will be output but QUALITY will stay good.

Invocation

CALL SCULIB_CALC_FLATFIELD (BOLNAME, BOL_TYPE, IDIM, JDIM, MAP_DATA, MAP_VARIANCE, MAP_QUALITY, X, Y, VOLUME, VOLUME_VAR, X_CENTRE, Y_CENTRE, THETA, A, B, QUALITY, STATUS)

Arguments

BOLNAME = CHARACTER() (Given)
the name of the bolometer being measured
BOL_TYPE = CHARACTER() (Given)
the type of the bolometer being measured
IDIM = INTEGER (Given)
‘I’ dimension of map
JDIM = INTEGER (Given)
‘J’ dimension of map
MAP_DATA (IDIM, JDIM) = REAL (Given)
map data values
MAP_VARIANCE (IDIM, JDIM) = REAL (Given)
map variance
MAP_QUALITY (IDIM, JDIM) = REAL (Given)
map quality
X (IDIM) = REAL (Given)
x axis of map
Y (JDIM) = REAL (Given)
y axis of map
VOLUME = REAL (Returned)
volume under image within MULT times the fitted ellipse
VOLUME_VAR = REAL (Returned)
variance on VOLUME_DATA
X_CENTRE = REAL (Returned)
x of image centre
Y_CENTRE = REAL (Returned)
y of image centre
THETA = REAL (Returned)
angle of tilt of ellipse (radians)
A = REAL (Returned)
semi-major axis of ellipse
B = REAL (Returned)
semi-minor axis of ellipse
STATUS = INTEGER (Given and returned)
global status

Copyright

Copyright ©1995,1996,1997,1998,1999 Particle Physics and Astronomy Research Council. All Rights Reserved.