aboutsummaryrefslogtreecommitdiff
path: root/noao/onedspec/sensfunc/sfrms.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/sensfunc/sfrms.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/onedspec/sensfunc/sfrms.x')
-rw-r--r--noao/onedspec/sensfunc/sfrms.x43
1 files changed, 43 insertions, 0 deletions
diff --git a/noao/onedspec/sensfunc/sfrms.x b/noao/onedspec/sensfunc/sfrms.x
new file mode 100644
index 00000000..72b8ea98
--- /dev/null
+++ b/noao/onedspec/sensfunc/sfrms.x
@@ -0,0 +1,43 @@
+include "sensfunc.h"
+
+
+# SF_RMS -- Compute the RMS of the sensitivity function fit.
+
+procedure sf_rms (stds, nstds, rms, npts)
+
+pointer stds[nstds] # Standard star data
+int nstds # Number of standard stars
+real rms # RMS about fit (returned)
+int npts # Number of points in fit (excluding zero wts.)
+
+int i, j, f, n
+pointer x, y, w
+
+begin
+ npts = 0
+ rms = 0.
+ do i = 1, nstds {
+ if (STD_FLAG(stds[i]) != SF_INCLUDE)
+ next
+ n = STD_NWAVES(stds[i])
+ x = STD_WAVES(stds[i])
+ y = STD_SENS(stds[i])
+ f = STD_FIT(stds[i])
+ w = STD_WTS(stds[i])
+ do j = 1, n {
+ if (Memr[w] != 0.) {
+ rms = rms + (Memr[y] - Memr[f]) ** 2
+ npts = npts + 1
+ }
+ x = x + 1
+ y = y + 1
+ f = f + 1
+ w = w + 1
+ }
+ }
+
+ if (npts > 1)
+ rms = sqrt (rms / (npts - 1))
+ else
+ rms = INDEF
+end