aboutsummaryrefslogtreecommitdiff
path: root/noao/imred/ccdred/src/setproc.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/imred/ccdred/src/setproc.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/imred/ccdred/src/setproc.x')
-rw-r--r--noao/imred/ccdred/src/setproc.x77
1 files changed, 77 insertions, 0 deletions
diff --git a/noao/imred/ccdred/src/setproc.x b/noao/imred/ccdred/src/setproc.x
new file mode 100644
index 00000000..06c7977b
--- /dev/null
+++ b/noao/imred/ccdred/src/setproc.x
@@ -0,0 +1,77 @@
+include <imhdr.h>
+include "ccdred.h"
+
+# SET_PROC -- Set the processing parameter structure pointer.
+
+procedure set_proc (in, out, ccd)
+
+pointer in # Input IMIO pointer
+pointer out # Output IMIO pointer
+pointer ccd # CCD structure (returned)
+
+int clgwrd(), clscan(), nscan()
+real clgetr()
+pointer sp, str
+
+begin
+ call smark (sp)
+ call salloc (str, SZ_LINE, TY_CHAR)
+
+ # Allocate the ccd structure.
+ call calloc (ccd, LEN_CCD, TY_STRUCT)
+
+ IN_IM(ccd) = in
+ OUT_IM(ccd) = out
+ COR(ccd) = NO
+ CORS(ccd, FIXPIX) = NO
+ CORS(ccd, OVERSCAN) = NO
+ CORS(ccd, TRIM) = NO
+ READAXIS(ccd) = clgwrd ("readaxis",Memc[str],SZ_LINE,"|line|columns|")
+ MINREPLACE(ccd) = clgetr ("minreplace")
+
+ CALCTYPE(ccd) = TY_REAL
+ if (clscan ("pixeltype") != EOF) {
+ call gargwrd (Memc[str], SZ_LINE)
+ call gargwrd (Memc[str], SZ_LINE)
+ if (nscan() == 2) {
+ if (Memc[str] == 'r')
+ CALCTYPE(ccd) = TY_REAL
+ else if (Memc[str] == 's')
+ CALCTYPE(ccd) = TY_SHORT
+ else
+ call error (1, "Invalid calculation datatype")
+ }
+ }
+
+ call sfree (sp)
+end
+
+
+# FREE_PROC -- Free the processing structure pointer.
+
+procedure free_proc (ccd)
+
+pointer ccd # CCD structure
+
+begin
+ # Unmap calibration images.
+ if (MASK_IM(ccd) != NULL)
+ call imunmap (MASK_IM(ccd))
+ if (ZERO_IM(ccd) != NULL)
+ call ccd_unmap (ZERO_IM(ccd))
+ if (DARK_IM(ccd) != NULL)
+ call ccd_unmap (DARK_IM(ccd))
+ if (FLAT_IM(ccd) != NULL)
+ call ccd_unmap (FLAT_IM(ccd))
+ if (ILLUM_IM(ccd) != NULL)
+ call ccd_unmap (ILLUM_IM(ccd))
+ if (FRINGE_IM(ccd) != NULL)
+ call ccd_unmap (FRINGE_IM(ccd))
+
+ # Free memory
+ if (OVERSCAN_VEC(ccd) != NULL)
+ call mfree (OVERSCAN_VEC(ccd), TY_REAL)
+ if (MASK_FP(ccd) != NULL)
+ call xt_fpfree (MASK_FP(ccd))
+ call mfree (ccd, TY_STRUCT)
+end