From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- pkg/xtools/inlfit/inrmsr.x | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 pkg/xtools/inlfit/inrmsr.x (limited to 'pkg/xtools/inlfit/inrmsr.x') diff --git a/pkg/xtools/inlfit/inrmsr.x b/pkg/xtools/inlfit/inrmsr.x new file mode 100644 index 00000000..e28696a1 --- /dev/null +++ b/pkg/xtools/inlfit/inrmsr.x @@ -0,0 +1,31 @@ +# IN_RMS -- Compute rms of points which have a non-zero weight. + +real procedure in_rmsr (y, fit, wts, npts) + +real y[npts] # function +real fit[npts] # fit +real wts[npts] # weights +int npts # number of points + +int i, ndata +real resid, rms + +begin + rms = real (0.0) + ndata = 0 + + do i = 1, npts { + if (wts[i] == real (0.0)) + next + resid = y[i] - fit[i] + rms = rms + resid * resid + ndata = ndata + 1 + } + + if (ndata > 0) + rms = sqrt (rms / ndata) + else + rms = real (0.0) + + return (rms) +end -- cgit