aboutsummaryrefslogtreecommitdiff
path: root/noao/imred/src/fibers/getspec.cl
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/imred/src/fibers/getspec.cl
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/imred/src/fibers/getspec.cl')
-rw-r--r--noao/imred/src/fibers/getspec.cl49
1 files changed, 49 insertions, 0 deletions
diff --git a/noao/imred/src/fibers/getspec.cl b/noao/imred/src/fibers/getspec.cl
new file mode 100644
index 00000000..84ce9a1c
--- /dev/null
+++ b/noao/imred/src/fibers/getspec.cl
@@ -0,0 +1,49 @@
+# GETSPEC -- Get spectra which are processed but are not extracted.
+# Strip the imtype extension.
+
+procedure getspec (images, output)
+
+string images {prompt="List of images"}
+file output {prompt="Output file of images"}
+bool ccdproc {prompt="Add CCDPROC keyword and continue?",
+ mode="q"}
+struct *fd
+
+begin
+ string imtype, temp, image, system=""
+ int n, n1
+
+ imtype = "." // envget ("imtype")
+ n = stridx (",", imtype)
+ if (n > 0)
+ imtype = substr (imtype, 1, n-1)
+ n1 = strlen (imtype)
+
+ # Initialize files
+ set clobber=yes
+ sleep (> output)
+ set clobber=no
+
+ temp = mktemp ("tmp$iraf")
+ sections (images, option="fullname", > temp)
+ fd = temp
+ while (fscan (fd, image) != EOF) {
+ hselect (image, "ccdproc", yes) | scan (system)
+ if (nscan() == 0) {
+ printf ("%s: CCDPROC keyword not found.\n", image)
+ printf (" Either run CCDPROC or add CCDPROC keyword with HEDIT.\n")
+ if (!ccdproc)
+ error (1, "Exit")
+ hedit (image, "ccdproc", "DONE", add=yes, update=yes,
+ verify=no, show=no)
+ }
+ hselect (image, "wat0_001", yes) | scanf ("system=%s", system)
+ if (system=="equispec" || system=="multispec")
+ next
+ n = strlen (image)
+ if (n > n1 && substr (image, n-n1+1, n) == imtype)
+ image = substr (image, 1, n-n1)
+ print (image, >> output)
+ }
+ fd = ""; delete (temp, verify=no)
+end