aboutsummaryrefslogtreecommitdiff
path: root/noao/onedspec/ecidentify/ecrms.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /noao/onedspec/ecidentify/ecrms.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/onedspec/ecidentify/ecrms.x')
-rw-r--r--noao/onedspec/ecidentify/ecrms.x28
1 files changed, 28 insertions, 0 deletions
diff --git a/noao/onedspec/ecidentify/ecrms.x b/noao/onedspec/ecidentify/ecrms.x
new file mode 100644
index 00000000..de84ae26
--- /dev/null
+++ b/noao/onedspec/ecidentify/ecrms.x
@@ -0,0 +1,28 @@
+include "ecidentify.h"
+
+# EC_RMS -- Compute RMS of fit about the user coordinates
+
+double procedure ec_rms (ec)
+
+pointer ec # ID pointer
+
+int i, nrms
+double rms
+
+begin
+ rms = 0.
+ nrms = 0
+ for (i=1; i<=EC_NFEATURES(ec); i=i+1) {
+ if (!IS_INDEFD (USER(ec,i)) && FTYPE(ec,i) > 0) {
+ rms = rms + (FIT(ec,i) - USER(ec,i)) ** 2
+ nrms = nrms + 1
+ }
+ }
+
+ if (nrms > 0)
+ rms = sqrt (rms / nrms)
+ else
+ rms = INDEFD
+
+ return (rms)
+end