From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- noao/onedspec/ecidentify/ecrms.x | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 noao/onedspec/ecidentify/ecrms.x (limited to 'noao/onedspec/ecidentify/ecrms.x') 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 -- cgit