aboutsummaryrefslogtreecommitdiff
path: root/noao/nobsolete
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/nobsolete
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'noao/nobsolete')
-rw-r--r--noao/nobsolete/Revisions20
-rw-r--r--noao/nobsolete/badpiximage.par5
-rw-r--r--noao/nobsolete/doc/badpiximage.hlp51
-rw-r--r--noao/nobsolete/mkpkg23
-rw-r--r--noao/nobsolete/nobsolete.cl8
-rw-r--r--noao/nobsolete/nobsolete.hd7
-rw-r--r--noao/nobsolete/nobsolete.men1
-rw-r--r--noao/nobsolete/nobsolete.par3
-rw-r--r--noao/nobsolete/t_badpixim.x214
-rw-r--r--noao/nobsolete/x_nobsolete.x1
10 files changed, 333 insertions, 0 deletions
diff --git a/noao/nobsolete/Revisions b/noao/nobsolete/Revisions
new file mode 100644
index 00000000..03d18af9
--- /dev/null
+++ b/noao/nobsolete/Revisions
@@ -0,0 +1,20 @@
+.help revisions Jan92 noao.nobsolete
+.nf
+nobsolete$t_badpixim.x +
+nobsolete$badpixim.par +
+nobsolete$doc/badpiximage.hlp +
+nobsolete$nobsolete.men +
+nobsolete$nobsolete.cl
+nobsolete$nobsolete.par
+nobsolete$nobsolete.hd
+nobsolete$x_nobsolete.x
+nobsolete$mkpkg
+ Moved BADPIXIMAGE from CCDRED to NOBSOLETE. (6/17/96, Valdes)
+
+=========
+V2.10.4p2
+=========
+
+nobosolete$* +
+ The NOAO obsolete package, NOBSOLETE, was created. (1/23/92, Valdes)
+.endhelp
diff --git a/noao/nobsolete/badpiximage.par b/noao/nobsolete/badpiximage.par
new file mode 100644
index 00000000..9a964701
--- /dev/null
+++ b/noao/nobsolete/badpiximage.par
@@ -0,0 +1,5 @@
+fixfile,f,a,,,,Bad pixel file
+template,f,a,,,,Template image
+image,f,a,,,,Bad pixel image to be created
+goodvalue,i,h,1,,,Value assigned to the good pixels
+badvalue,i,h,0,,,Value assigned to the bad pixels
diff --git a/noao/nobsolete/doc/badpiximage.hlp b/noao/nobsolete/doc/badpiximage.hlp
new file mode 100644
index 00000000..4b1e76fb
--- /dev/null
+++ b/noao/nobsolete/doc/badpiximage.hlp
@@ -0,0 +1,51 @@
+.help badpiximage Jun87 noao.nobsolete
+.ih
+NAME
+badpiximage -- Create a bad pixel mask image from a bad pixel file
+.ih
+USAGE
+badpiximage fixfile template image
+.ih
+PARAMETERS
+.ls fixfile
+Bad pixel file.
+.le
+.ls template
+Template image used to define the size of the bad pixel mask image.
+.le
+.ls image
+Bad pixel mask image to be created.
+.le
+.ls goodvalue = 1
+Integer value assigned to the good pixels.
+.le
+.ls badvalue = 0
+Integer value assigned to the bad pixels.
+.le
+.ih
+DESCRIPTION
+A bad pixel mask image is created from the specified bad pixel file.
+The format of the bad pixel file is that used by \fBccdproc\fR to
+correct CCD defects (see instruments). The bad pixel image is of pixel type short and
+has the value given by the parameter \fBgoodvalue\fR for the good
+pixels and the value given by the parameter \fBbadvalue\fR for the bad pixels.
+The image size and header parameters are taken from the specified
+template image. The bad pixel mask image may be used to view the
+location of the bad pixels and blink against an data image using an
+image display, to mask or flag bad pixels later by image arithmetic,
+and to propagate the positions of the bad pixels through the
+reductions.
+.ih
+EXAMPLES
+1. To make a bad pixel mask image from the bad pixel file "cryocambp.dat"
+using the image "ccd005" as the template:
+
+ cl> badpiximage cryocambp.dat ccd005 cryocambp
+
+2. To make the bad pixel mask image with good values of 0 and bad values of 1:
+
+ cl> badpixim cryomapbp.dat ccd005 cryocambp good=0 bad=1
+.ih
+SEE ALSO
+text2image
+.endhelp
diff --git a/noao/nobsolete/mkpkg b/noao/nobsolete/mkpkg
new file mode 100644
index 00000000..4dbbd173
--- /dev/null
+++ b/noao/nobsolete/mkpkg
@@ -0,0 +1,23 @@
+# Make the NOBSOLETE package.
+
+$call relink
+$exit
+
+update:
+ $call relink
+ $call install
+ ;
+
+relink:
+ $update libpkg.a
+ $omake x_nobsolete.x
+ $link x_nobsolete.o libpkg.a -o xx_nobsolete.e
+ ;
+
+install:
+ $move xx_nobsolete.e noaobin$x_nobsolete.e
+ ;
+
+libpkg.a:
+ t_badpixim.x <ctype.h> <imhdr.h>
+ ;
diff --git a/noao/nobsolete/nobsolete.cl b/noao/nobsolete/nobsolete.cl
new file mode 100644
index 00000000..517f3645
--- /dev/null
+++ b/noao/nobsolete/nobsolete.cl
@@ -0,0 +1,8 @@
+#{ Package script task for the NOBSOLETE package.
+
+package nobsolete
+
+# Compiled tasks.
+task badpiximage = "nobsolete$x_nobsolete.e"
+
+clbye
diff --git a/noao/nobsolete/nobsolete.hd b/noao/nobsolete/nobsolete.hd
new file mode 100644
index 00000000..af7447f7
--- /dev/null
+++ b/noao/nobsolete/nobsolete.hd
@@ -0,0 +1,7 @@
+# Help directory for the NOBSOLETE package.
+
+$doc = "noao$nobsolete/doc/"
+
+badpiximage hlp=doc$badpiximage.hlp, src=t_badpixim.x
+
+revisions sys=Revisions
diff --git a/noao/nobsolete/nobsolete.men b/noao/nobsolete/nobsolete.men
new file mode 100644
index 00000000..ca32b843
--- /dev/null
+++ b/noao/nobsolete/nobsolete.men
@@ -0,0 +1 @@
+ badpiximage - Create a bad pixel mask image (from imred.ccdred V2.10.4)
diff --git a/noao/nobsolete/nobsolete.par b/noao/nobsolete/nobsolete.par
new file mode 100644
index 00000000..f488c0ea
--- /dev/null
+++ b/noao/nobsolete/nobsolete.par
@@ -0,0 +1,3 @@
+# NOBSOLETE package parameter file.
+
+version,s,h,"June 1996"
diff --git a/noao/nobsolete/t_badpixim.x b/noao/nobsolete/t_badpixim.x
new file mode 100644
index 00000000..e3a95c14
--- /dev/null
+++ b/noao/nobsolete/t_badpixim.x
@@ -0,0 +1,214 @@
+include <imhdr.h>
+
+# T_BADPIXIMAGE -- Create a bad pixel image mask from a bad pixel file.
+
+procedure t_badpiximage ()
+
+pointer bpfile # Bad pixel file
+pointer bpimage # Bad pixel image
+pointer template # Template image
+short goodval, badval # Good and bad values
+
+int i, nc, nl, c1, c2, l1, l2, fd, x1, x2, xstep, y1, y2, ystep
+pointer sp, str, im, im1
+
+short clgets()
+pointer immap(), impl2s(), imps2s()
+int open(), fscan(), nscan(), stridxs(), strmatch()
+errchk open, immap
+
+begin
+ call smark (sp)
+ call salloc (bpfile, SZ_FNAME, TY_CHAR)
+ call salloc (bpimage, SZ_FNAME, TY_CHAR)
+ call salloc (template, SZ_FNAME, TY_CHAR)
+ call salloc (str, SZ_LINE, TY_CHAR)
+
+ # Get task parameters.
+ call clgstr ("fixfile", Memc[bpfile], SZ_FNAME)
+ call clgstr ("template", Memc[template], SZ_FNAME)
+ call clgstr ("image", Memc[bpimage], SZ_FNAME)
+ goodval = clgets ("goodvalue")
+ badval = clgets ("badvalue")
+
+ # Open the files and abort on an error.
+ fd = open (Memc[bpfile], READ_ONLY, TEXT_FILE)
+ im1 = immap (Memc[template], READ_ONLY, 0)
+ im = immap (Memc[bpimage], NEW_COPY, im1)
+
+ # Set the output image.
+ IM_PIXTYPE(im) = TY_SHORT
+ call sprintf (IM_TITLE(im), SZ_IMTITLE,
+ "Bad pixel image from bad pixel file %s")
+ call pargstr (Memc[bpfile])
+
+ # Set the good pixel values.
+ nc = IM_LEN(im,1)
+ nl = IM_LEN(im,2)
+ do i = 1, nl
+ call amovks (goodval, Mems[impl2s(im,i)], nc)
+
+ # Set the bad pixel values. By default the bad pixel coordinates
+ # refer to the image directly but if the word "untrimmed" appears
+ # in a comment then the coordinates refer to the untrimmed image.
+ # This is the same algorithm as used in SETFIXPIX for CCDPROC.
+
+ x1 = 1
+ xstep = 1
+ y1 = 1
+ ystep = 1
+ while (fscan (fd) != EOF) {
+ call gargwrd (Memc[str], SZ_LINE)
+ if (Memc[str] == '#') {
+ call gargstr (Memc[str], SZ_LINE)
+ if (strmatch (Memc[str], "{untrimmed}") != 0) {
+ ifnoerr (call imgstr (im, "trim", Memc[str], SZ_LINE)) {
+ x2 = stridxs ("[", Memc[str])
+ if (x2 != 0) {
+ x1 = 1
+ x2 = IM_LEN(im,1)
+ xstep = 1
+ y1 = 1
+ y2 = IM_LEN(im,2)
+ ystep = 1
+ call ccd_section (Memc[str+x2-1], x1, x2, xstep,
+ y1, y2, ystep)
+ }
+ }
+ }
+ next
+ }
+
+ call reset_scan()
+ call gargi (c1)
+ call gargi (c2)
+ call gargi (l1)
+ call gargi (l2)
+ if (nscan() != 4) {
+ if (nscan() == 2) {
+ l1 = c2
+ c2 = c1
+ l2 = l1
+ } else
+ next
+ }
+
+ c1 = max (1, (c1 - x1 + xstep - 1) / xstep + 1)
+ c2 = min (nc, (c2 - x1) / xstep + 1)
+ l1 = max (1, (l1 - y1 + ystep - 1) / ystep + 1)
+ l2 = min (nl, (l2 - y1) / ystep + 1)
+
+ if ((c1 > c2) || (l1 > l2))
+ next
+
+ i = (c2 - c1 + 1) * (l2 - l1 + 1)
+ call amovks (badval, Mems[imps2s(im,c1,c2,l1,l2)], i)
+ }
+
+ # Finish up.
+ call imunmap (im)
+ call imunmap (im1)
+ call close (fd)
+end
+
+
+include <ctype.h>
+
+# CCD_SECTION -- Parse a 2D image section into its elements.
+# 1. The default values must be set by the caller.
+# 2. A null image section is OK.
+# 3. The first nonwhitespace character must be '['.
+# 4. The last interpreted character must be ']'.
+#
+# This procedure should be replaced with an IMIO procedure at some
+# point.
+
+procedure ccd_section (section, x1, x2, xstep, y1, y2, ystep)
+
+char section[ARB] # Image section
+int x1, x2, xstep # X image section parameters
+int y1, y2, ystep # X image section parameters
+
+int i, ip, a, b, c, temp, ctoi()
+define error_ 99
+
+begin
+ # Decode the section string.
+ ip = 1
+ while (IS_WHITE(section[ip]))
+ ip = ip + 1
+ if (section[ip] == '[')
+ ip = ip + 1
+ else if (section[ip] == EOS)
+ return
+ else
+ goto error_
+
+ do i = 1, 2 {
+ while (IS_WHITE(section[ip]))
+ ip = ip + 1
+
+ # Default values
+ if (i == 1) {
+ a = x1
+ b = x2
+ c = xstep
+ } else {
+ a = y1
+ b = y2
+ c = ystep
+ }
+
+ # Get a:b:c. Allow notation such as "-*:c"
+ # (or even "-:c") where the step is obviously negative.
+
+ if (ctoi (section, ip, temp) > 0) { # a
+ a = temp
+ if (section[ip] == ':') {
+ ip = ip + 1
+ if (ctoi (section, ip, b) == 0) # a:b
+ goto error_
+ } else
+ b = a
+ } else if (section[ip] == '-') { # -*
+ temp = a
+ a = b
+ b = temp
+ ip = ip + 1
+ if (section[ip] == '*')
+ ip = ip + 1
+ } else if (section[ip] == '*') # *
+ ip = ip + 1
+ if (section[ip] == ':') { # ..:step
+ ip = ip + 1
+ if (ctoi (section, ip, c) == 0)
+ goto error_
+ else if (c == 0)
+ goto error_
+ }
+ if (a > b && c > 0)
+ c = -c
+
+ if (i == 1) {
+ x1 = a
+ x2 = b
+ xstep = c
+ } else {
+ y1 = a
+ y2 = b
+ ystep = c
+ }
+
+ while (IS_WHITE(section[ip]))
+ ip = ip + 1
+ if (section[ip] == ',')
+ ip = ip + 1
+ }
+
+ if (section[ip] != ']')
+ goto error_
+
+ return
+error_
+ call error (0, "Error in image section specification")
+end
diff --git a/noao/nobsolete/x_nobsolete.x b/noao/nobsolete/x_nobsolete.x
new file mode 100644
index 00000000..33df055a
--- /dev/null
+++ b/noao/nobsolete/x_nobsolete.x
@@ -0,0 +1 @@
+task badpiximage = t_badpiximage