blob: 62a52c30368d22b2ec19f6bc03922fb3f6bc2844 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# AP_CLIP -- Clip the ends of a sorted pixel distribution by a certain
# percent.
int procedure ap_clip (skypix, index, npix, loclip, hiclip, loindex, hiindex)
real skypix[ARB] # the unsorted array of sky pixels
int index[ARB] # the array of sorted indices
int npix # the number of sky pixels
real loclip, hiclip # the clipping factors in percent
int loindex, hiindex # the clipping indices
begin
# Sort the pixels.
call apqsort (skypix, index, index, npix)
# Determine the clipping factors.
loindex = nint (0.01 * loclip * npix) + 1
hiindex = npix - nint (0.01 * hiclip * npix)
if ((hiindex - loindex + 1) <= 0)
return (npix)
else
return (loindex - 1 + npix - hiindex)
end
|