aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/ptools/pexamine/ptalimr.x
blob: 614b2099b8ca64553afe1b9a540cc75cd7b821c6 (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
24
25
26
27
28
29
30
31
32
33
34
35
include <mach.h>

# PT_ALIMR -- Compute the limits (minimum and maximum values) of a vector
# after rejecting any INDEF valued points.

procedure pt_alimr (a, npix, minval, maxval)

real	a[ARB]			# the input array
int	npix			# the number of points
real	minval, maxval		# the minimum and maximum value

int	i, ngood
real	value

begin
	minval = MAX_REAL
	maxval = -MAX_REAL
	ngood = 0

	do i = 1, npix {
	    value = a[i]
	    if (IS_INDEFR(value))
		next
	    ngood = ngood + 1
	    if (value < minval)
		minval = value
	    if (value > maxval)
		maxval = value
	}

	if (ngood == 0) {
	    minval = INDEFR
	    maxval = INDEFR
	}
end