aboutsummaryrefslogtreecommitdiff
path: root/noao/onedspec/sensfunc/sfreset.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 /noao/onedspec/sensfunc/sfreset.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'noao/onedspec/sensfunc/sfreset.x')
-rw-r--r--noao/onedspec/sensfunc/sfreset.x62
1 files changed, 62 insertions, 0 deletions
diff --git a/noao/onedspec/sensfunc/sfreset.x b/noao/onedspec/sensfunc/sfreset.x
new file mode 100644
index 00000000..fc4d974e
--- /dev/null
+++ b/noao/onedspec/sensfunc/sfreset.x
@@ -0,0 +1,62 @@
+include "sensfunc.h"
+
+# SF_RESET -- Reset the standard star data to the original input.
+# This is called cancel changes and start over.
+
+procedure sf_reset (stds, nstds, wextn, extn, nextn, ecv, shift)
+
+pointer stds[nstds] # Standard star data
+int nstds # Number of standard stars
+real wextn[nextn] # Extinction table wavelengths
+real extn[nextn] # Extinction table values
+int nextn # Number of extinction values
+pointer ecv # Residual extinction curve
+int shift # Shift flag
+
+int i, j, n, err
+real exptime, airmass, ext
+pointer waves, fluxes, dwaves, counts, sens, iwts, wts
+
+begin
+ # Reset the flags, sensitivity, and weight values.
+ shift = NO
+ do i = 1, nstds - 2 {
+ if (STD_FLAG(stds[i]) == SF_EXCLUDE)
+ next
+ STD_FLAG(stds[i]) = SF_INCLUDE
+ STD_SHIFT(stds[i]) = 0.
+ n = STD_NWAVES(stds[i])
+ exptime = STD_EXPTIME(stds[i])
+ airmass = STD_AIRMASS(stds[i])
+ waves = STD_WAVES(stds[i])
+ fluxes = STD_FLUXES(stds[i])
+ dwaves = STD_DWAVES(stds[i])
+ counts = STD_COUNTS(stds[i])
+ sens = STD_SENS(stds[i])
+ iwts = STD_IWTS(stds[i])
+ wts = STD_WTS(stds[i])
+ do j = 1, n {
+ call intrp (1, wextn, extn, nextn, Memr[waves], ext, err)
+ Memr[sens] = Memr[counts] /
+ (Memr[fluxes] * Memr[dwaves] * exptime)
+ Memr[sens] = 2.5 * log10 (Memr[sens]) + airmass * ext
+ Memr[wts] = Memr[iwts]
+
+ waves = waves + 1
+ fluxes = fluxes + 1
+ dwaves = dwaves + 1
+ counts = counts + 1
+ sens = sens + 1
+ iwts = iwts + 1
+ wts = wts + 1
+ }
+ }
+
+ # Reset the added and composite stars.
+ STD_NWAVES(stds[nstds-1]) = 0
+ STD_FLAG(stds[nstds-1]) = SF_DELETE
+ STD_FLAG(stds[nstds]) = SF_EXCLUDE
+
+ # Clear the residual extinction curve.
+ call cvfree (ecv)
+end