aboutsummaryrefslogtreecommitdiff
path: root/pkg/xtools/inlfit/inrmsd.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /pkg/xtools/inlfit/inrmsd.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'pkg/xtools/inlfit/inrmsd.x')
-rw-r--r--pkg/xtools/inlfit/inrmsd.x31
1 files changed, 31 insertions, 0 deletions
diff --git a/pkg/xtools/inlfit/inrmsd.x b/pkg/xtools/inlfit/inrmsd.x
new file mode 100644
index 00000000..26800de7
--- /dev/null
+++ b/pkg/xtools/inlfit/inrmsd.x
@@ -0,0 +1,31 @@
+# IN_RMS -- Compute rms of points which have a non-zero weight.
+
+double procedure in_rmsd (y, fit, wts, npts)
+
+double y[npts] # function
+double fit[npts] # fit
+double wts[npts] # weights
+int npts # number of points
+
+int i, ndata
+double resid, rms
+
+begin
+ rms = double (0.0)
+ ndata = 0
+
+ do i = 1, npts {
+ if (wts[i] == double (0.0))
+ next
+ resid = y[i] - fit[i]
+ rms = rms + resid * resid
+ ndata = ndata + 1
+ }
+
+ if (ndata > 0)
+ rms = sqrt (rms / ndata)
+ else
+ rms = double (0.0)
+
+ return (rms)
+end