aboutsummaryrefslogtreecommitdiff
path: root/noao/onedspec/ecidentify/ecffit/ecfrms.x
blob: 1140dc297a2b131eba7adc90ec98604e79e3b990 (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
# ECF_RMS -- Compute the rms with deleted points ignored.

double procedure ecf_rms (r, w, npts)

double	r[npts]			# Residuals
double	w[npts]			# Weights
int	npts			# Number of points

int	i, n
double	rms

begin
	n = 0
	rms = 0.
	do i = 1, npts {
	    if (w[i] == 0.)
		next
	    n = n + 1
	    rms = rms + r[i] * r[i]
	}
	if (n > 0)
	    rms = sqrt (rms / n)
	else
	    rms = INDEFD
	return (rms)
end