diff options
Diffstat (limited to 'noao/imred/quadred/src/quad/quadtest')
-rw-r--r-- | noao/imred/quadred/src/quad/quadtest/artobs.cl | 68 | ||||
-rw-r--r-- | noao/imred/quadred/src/quad/quadtest/artobs.par | 5 | ||||
-rw-r--r-- | noao/imred/quadred/src/quad/quadtest/ccdpars.par | 29 | ||||
-rw-r--r-- | noao/imred/quadred/src/quad/quadtest/logfile | 1 | ||||
-rw-r--r-- | noao/imred/quadred/src/quad/quadtest/mkamp.cl | 166 | ||||
-rw-r--r-- | noao/imred/quadred/src/quad/quadtest/mkimage.par | 10 | ||||
-rw-r--r-- | noao/imred/quadred/src/quad/quadtest/mkquad.cl | 222 | ||||
-rw-r--r-- | noao/imred/quadred/src/quad/quadtest/mkquad.par | 4 | ||||
-rw-r--r-- | noao/imred/quadred/src/quad/quadtest/quadtest.cl | 14 | ||||
-rw-r--r-- | noao/imred/quadred/src/quad/quadtest/quadtest.par | 20 |
10 files changed, 539 insertions, 0 deletions
diff --git a/noao/imred/quadred/src/quad/quadtest/artobs.cl b/noao/imred/quadred/src/quad/quadtest/artobs.cl new file mode 100644 index 00000000..292ed8c6 --- /dev/null +++ b/noao/imred/quadred/src/quad/quadtest/artobs.cl @@ -0,0 +1,68 @@ +# ARTOBS -- Simulate observe command using artificial data. + +procedure artobs () + +begin + string image, oim, ccdt + int picnum, nexps, i + real exptime + string imtitle + + # Get ccdtype + ccdt = obspars.ccdtype + + # Get number of pictures to take + nexps = npics + + # Get next picture number + if (obspars.autopicnum) { + picnum = obspars.picture.p_value + } else { + picnum = obspars.picture + } + + # Get exposure time + if (ccdt != "zero") { + exptime = obspars.exposure + } else { + exptime = 0.0 + } + + # Set filter + if (obspars.setfilter != "none" && ccdt != "zero" && ccdt != "dark") { + if (instrpars.instrname != "") + mkquad.filter = instrpars.filter1 + } + + # Get imtitle. This MUST always be the last interactive prompt! + imtitle = title + + for (i = picnum; i < picnum+nexps; i = i+1) { + + # Make image name + if (ccdt == "object") { + printf ("obj%03d\n", i) | scan (image) + } else { + printf ("%s%03d\n", ccdt, i) | scan (image) + } + if (access (image//".imh")) { + oim = image + image = mktemp (image//".") + printf ("Output image %s already exists... %s used \n", oim, + image) + } + + if (ccdt == "dflat" || ccdt == "pflat") + ccdt = "flat" + + if (ccdt == "sflat" || ccdt == "comp" ) + ccdt = "other" + + # Call MKQUAD task + mkquad (image, exptime, ccdt) + hedit (image, "i_title", imtitle, add+, ver-, show-) + obspars.picture.p_value = i + 1 + printf ("Image %s written to disk\n", image, > "STDERR") + } + +end diff --git a/noao/imred/quadred/src/quad/quadtest/artobs.par b/noao/imred/quadred/src/quad/quadtest/artobs.par new file mode 100644 index 00000000..d9611ef5 --- /dev/null +++ b/noao/imred/quadred/src/quad/quadtest/artobs.par @@ -0,0 +1,5 @@ +# observe parameter file +obspars,pset,h,,,,Observing parameters +detpars,pset,h,,,,Detector parameters +instrpars,pset,h,,,,Instrument parameters +telpars,pset,h,,,,Telescope parameters diff --git a/noao/imred/quadred/src/quad/quadtest/ccdpars.par b/noao/imred/quadred/src/quad/quadtest/ccdpars.par new file mode 100644 index 00000000..b30fbb99 --- /dev/null +++ b/noao/imred/quadred/src/quad/quadtest/ccdpars.par @@ -0,0 +1,29 @@ +ncols,i,h,1060,,,"Number of columns" +nlines,i,h,1024,,,"Number of lines +" +datasec,s,h,"[1:1024,1:1024]",,,"Data section" +trimsec,s,h,"[1:1024,1:1024]",,,"Trim section" +biassec,s,h,"[1025:1060,1:1024]",,,"Bias section +" +amplifiers,s,h,"Quad","|Quad|UpperPair|LowerPair|LowerLeft|",,"Amplifiers to use +" +gain1,r,h,1.0,,,gain (e-/ADU) for Amp12 +ron1,r,h,4.0,,,readout noise for Amp11 +zero1,i,h,1000,,,"zero level for Amp11" +nlin1,s,h,"",,,"Non-linearity coefficants +" +gain2,r,h,1.0,,,gain (e-/ADU) for Amp12 +ron2,r,h,4.0,,,readout noise for Amp12 +zero2,i,h,1000,,,"zero level for Amp12" +nlin2,s,h,"",,,"Non-linearity coefficants +" +gain3,r,h,1.0,,,gain (e-/ADU) for Amp21 +ron3,r,h,4.0,,,readout noise for Amp21 +zero3,i,h,1000,,,"zero level for Amp21" +nlin3,s,h,"",,,"Non-linearity coefficants +" +gain4,r,h,1.0,,,gain (e-/ADU) for Amp22 +ron4,r,h,4.0,,,readout noise for Amp22 +zero4,i,h,1000,,,"zero level for Amp22" +nlin4,s,h,"",,,"Non-linearity coefficants +" diff --git a/noao/imred/quadred/src/quad/quadtest/logfile b/noao/imred/quadred/src/quad/quadtest/logfile new file mode 100644 index 00000000..ddf97f0a --- /dev/null +++ b/noao/imred/quadred/src/quad/quadtest/logfile @@ -0,0 +1 @@ +obj99999: Dec 9 12:21 Quadjoin: nampsx=2 nampsy=2 diff --git a/noao/imred/quadred/src/quad/quadtest/mkamp.cl b/noao/imred/quadred/src/quad/quadtest/mkamp.cl new file mode 100644 index 00000000..98cd8468 --- /dev/null +++ b/noao/imred/quadred/src/quad/quadtest/mkamp.cl @@ -0,0 +1,166 @@ +# MKAMP -- Make a CCD observation + +procedure mkamp (image, exptime, ccdtype) + +string image {prompt="Image name"} +real exptime {prompt="Exposure time"} +string ccdtype {prompt="CCD type"} + +int ncols=132 {prompt="Number of columns"} +int nlines=100 {prompt="Number of lines"} +string filter="" {prompt="Filter"} +string datasec="" {prompt="Data section"} +string trimsec="" {prompt="Trim section"} +string biassec="" {prompt="Bias section"} + +file imdata="" {prompt="Image data"} +real skyrate=0. {prompt="Sky count rate"} +real zeroval=0. {prompt="Zero level value"} +real zeroslope=0. {prompt="Slope of zero level"} +real flashval=0. {prompt="Preflash value"} +real flashslope=0. {prompt="Slope of preflash value"} +real darkrate=0. {prompt="Dark count rate"} +real darkslope=0. {prompt="Slope of dark count rate"} +real flatslope=0. {prompt="Flat field slope"} +file badpix="" {prompt="Bad pixel regions"} +real badval=0. {prompt="Bad pixel value"} +real gain=1. {prompt="Gain (e-/adu)", min=1.0e-9} +real ron=0. {prompt="Read out noise e-"} +string nonlin {prompt="Non-linearity coefficiants"} +bool poisson=yes {prompt="Add poisson noise?"} +bool overwrite=no {prompt="Overwrite existing image?"} +struct *fdnl {prompt="Internal use"} + +begin + int c1, c2, l1, l2, rseed, i, dummy + real exp, value, valslope, invgain, date, rval, coef[7] + string im, type, s, lincoefs, ampsec + + im = image + exp = exptime + type = ccdtype + + # Check for zero (or very small) gain + if (abs (gain) < 1.0e-9) + call error (0, "zero (or very small) gain specified") + + invgain = 1.0 / gain + + if (access (im//".imh") == yes) + im = im // ".imh" + if (access (im//".hhh") == yes) + im = im // ".hhh" + if (access (im) == yes) { + if (overwrite == yes) + imdelete (im, verify=no) + else + return + } + + # Create the image. + s = str (ncols) // " " // str (nlines) + mkimage (im, "make", 0., 2, s, pixtype="real", slope=0., sigma=0.) + + # Add a data image. + if (access (imdata//".imh") == yes) + imdata = imdata // ".imh" + if (access (imdata//".hhh") == yes) + imdata = imdata // ".hhh" + if (access (imdata) == yes) + imcopy (imdata//datasec, im//datasec, verbose=no) + + # Add sky. + value = exp * skyrate + if (value != 0.) + mkimage (im//datasec, "add", value, slope=0., sigma=0.) + + # Add flat field response. + if (flatslope != 0.) + mkimage (im//datasec, "mul", 1., slope=flatslope, sigma=0.) + + # Add preflash level and dark count. + value = flashval + exp * darkrate + valslope = flashslope + exp * darkslope + if ((value != 0.) && (valslope != 0.)) + mkimage (im//datasec, "add", value, slope=valslope, sigma=0.) + + # Convert to ADU + mkimage (im//datasec, "mul", invgain, slope=0., sigma=0.) + + # Add poisson and readout noise + # if seed is 0 pick a fairly arbitrary value + if (seed == 0) { + date | translit ("STDIN", from_string="a-zA-Z: ", delete+) | + scan (date) + rseed = abs (date / 10000) + } else { + rseed = seed + } + + # Add non-linearity + if (nonlin != "") { + lincoefs = mktemp ("uparm$tmp") + files (nonlin, >> lincoefs) + fdnl = lincoefs + coef[1] = 1.0 + for (i=2; i <= 7; i = i+1) { + dummy = fscan (fdnl, rval) + if (dummy == EOF) { + coef[i] = 0.0 + } else { + coef[i] = rval + } + } + + irlincor (im, im, section= "", coeff1=coef[1], coeff2=coef[2], + coeff3=coef[3], coeff4=coef[4], coeff5=coef[5], coeff6=coef[6], + coeff7=coef[7], maxadu=65535.0) + delete (lincoefs, ver-) + } + + mknoise (im, background=0., gain=gain, rdnoise=ron, poisson=poisson, + seed=rseed, cosrays="", ncosrays=0, comments=no) + + # decrement seed for next use + if (seed < 0) + seed.p_value = seed - 1 + + # Add zero level + # We add an extra 0.5 so that we nint rather than truncate when + # converting to short integer. + zeroval = zeroval + 0.5 + mkimage (im, "add", zeroval, slope=zeroslope, sigma=0.) + + # Set bad pixels. + if (access (badpix)) { + list = badpix + while (fscan (list, c1, c2, l1, l2) != EOF) { + if (nscan() != 4) + next + c1 = max (1, c1) + c2 = min (ncols, c2) + l1 = max (1, l1) + l2 = min (nlines, l2) + s = "["//c1//":"//c2//","//l1//":"//l2//"]" + mkimage (im//s, "replace", badval, slope=0., sigma=0.) + } + } + + # Convert to ushort data type + chpixtype (im, im, "ushort", oldpixtype="all", ver-) + + # Set image header + ccdhedit (im, "exptime", exp, type="real") + if (type != "") + ccdhedit (im, "imagetyp", type, type="string") + + if (datasec != "") { + ccdhedit (im, "datasec", datasec, type="string") + } + if (trimsec != "") + ccdhedit (im, "trimsec", trimsec, type="string") + if (biassec != "") + ccdhedit (im, "biassec", biassec, type="string") + if (filter != "") + ccdhedit (im, "subset", filter, type="string") +end diff --git a/noao/imred/quadred/src/quad/quadtest/mkimage.par b/noao/imred/quadred/src/quad/quadtest/mkimage.par new file mode 100644 index 00000000..148bf7ea --- /dev/null +++ b/noao/imred/quadred/src/quad/quadtest/mkimage.par @@ -0,0 +1,10 @@ +image,s,a,,,,Image to make or modify +option,s,a,,"make|replace|add|multiply",,Editing option +value,r,a,,,,Mean pixel value +slope,r,h,0.,,,Slope of pixel values +sigma,r,h,0.,0.,,Noise sigma +seed,i,h,0,0,,Seed for noise generator + +ndim,i,a,,1,7,Number of dimensions +dims,s,a,,,,Image dimensions +pixtype,s,h,"real","short|real",,Pixel datatype diff --git a/noao/imred/quadred/src/quad/quadtest/mkquad.cl b/noao/imred/quadred/src/quad/quadtest/mkquad.cl new file mode 100644 index 00000000..391d1a61 --- /dev/null +++ b/noao/imred/quadred/src/quad/quadtest/mkquad.cl @@ -0,0 +1,222 @@ +# MKQUAD -- Make an artifical multi-readout image + +procedure mkquad (image, exptime, ccdtype) + +begin + string im, ccdt + real exp, sky + + string amps, as, bs, cs, ds, ts, nampsyx, amplist + int tx1, tx2, ty1, ty2 + int bx1, bx2, by1, by2 + int cx1, cx2, cy1, cy2 + int dx1, dx2, dy1, dy2 + int txs1, txs2, tys1, tys2 + int bxs1, bxs2, bys1, bys2 + int nx, ny, dnx, dny, onx, ony + int nampx, nampy + bool use_amp[4] + + im = image + if (access (im//".imh")) + error (0, "Output image already exists") + + exp = exptime + ccdt = ccdtype + sky = skyrate + amps = ccdpars.amplifiers + + nx = ccdpars.ncols + ny = ccdpars.nlines + + # Set number of amplifiers and use_amp. This is a bit kludgy + if (amps == "Quad") { + nampx = 2 + nampy = 2 + use_amp[1] = yes + use_amp[2] = yes + use_amp[3] = yes + use_amp[4] = yes + amplist = "11 12 21 22" + } else if (amps == "LowerPair") { + nampx = 2 + nampy = 1 + use_amp[1] = yes + use_amp[2] = yes + use_amp[3] = no + use_amp[4] = no + amplist = "11 12" + } else if (amps == "UpperPair") { + nampx = 2 + nampy = 1 + use_amp[1] = no + use_amp[2] = no + use_amp[3] = yes + use_amp[4] = yes + amplist = "21 22" + } else if (amps == "LowerLeft") { + nampx = 1 + nampy = 1 + use_amp[1] = yes + use_amp[2] = no + use_amp[3] = no + use_amp[4] = no + amplist = "11" + } + + # Parse sections strings. + ccdsection (ccdpars.trimsec) | scan (tx1, tx2, ty1, ty2) + tx1 = max (1, tx1) + tx2 = min (nx, tx2) + ty1 = max (1, ty1) + ty2 = min (ny, ty2) + + ccdsection (ccdpars.biassec) | scan (bx1, bx2, by1, by2) + bx1 = max (1, bx1) + bx2 = min (nx, bx2) + by1 = max (1, by1) + by2 = min (ny, by2) + + ccdsection (ccdpars.datasec) | scan (dx1, dx2, dy1, dy2) + dx1 = max (1, dx1) + dx2 = min (nx, dx2) + dy1 = max (1, dy1) + dy2 = min (ny, dy2) + + # Number of pixels to trim + txs1 = tx1 - 1 + txs2 = dx2 - tx2 + tys1 = ty1 - 1 + tys2 = dy2 - ty2 + + # Number of pixels to skip before overscan strip + bxs1 = bx1 - dx2 - 1 + bxs2 = nx - bx2 + bys1 = by1 - 1 + bys2 = ny - by2 + + # Number of pixels in subimages + nx = nx / nampx + ny = ny / nampy + dnx = (dx2 - dx1 + 1) / nampx + dny = (dy2 - dy1 + 1) / nampy + onx = nx - dnx + ony = ny + + # Set ampsec for all amps + printf ("[1:%d,1:%d]\n", nx, ny) | scan (as) + + # Set sections for Amp11 & Amp21 + dx1 = 1 + dx2 = dx1 + dnx - 1 + dy1 = 1 + dy2 = dy1 + dny - 1 + printf ("[%d:%d,%d:%d]\n", dx1, dx2, dy1, dy2) | scan (ds) + + tx1 = dx1 + txs1 + tx2 = dx2 + ty1 = dy1 + tys1 + ty2 = dy2 + printf ("[%d:%d,%d:%d]\n", tx1, tx2, ty1, ty2) | scan (ts) + + bx1 = dx2 + bxs1 + 1 + bx2 = nx - bxs2 + by1 = 1 + bys1 + by2 = ny + printf ("[%d:%d,%d:%d]\n", bx1, bx2, by1, by2) | scan (bs) + + if (use_amp[1]) { + mkamp (im//".11", exp, ccdt, ncols=nx, nlines=ny, + filter=filter, datasec=ds, trimsec=ts, biassec=bs, imdata=imdata, + skyrate=sky, zeroval=ccdpars.zero1, zeroslope=zeroslope, + badpix=badpix, badval=badval, flashval=flashval, + flashslope=flashslope, darkrate=darkrate, darkslope=darkslope, + flatslope=flatslope, gain=ccdpars.gain1, ron=ccdpars.ron1, + nonlin=ccdpars.nlin1, poisson=poisson, overwrite=yes) + hedit (im//".11", "asec11", as, show-, ver-, add+) + cx1 = 1 + cx2 = cx1 + dnx - 1 + cy1 = 1 + cy2 = cy1 + dny - 1 + printf ("[%d:%d,%d:%d]\n", cx1, cx2, cy1, cy2) | scan (cs) + hedit (im//".11", "ccdsec", cs, show-, ver-, add+) + } + + if (use_amp[3]) { + mkamp (im//".21", exp, ccdt, ncols=nx, nlines=ny, + filter=filter, datasec=ds, trimsec=ts, biassec=bs, imdata=imdata, + skyrate=sky, zeroval=ccdpars.zero3, zeroslope=zeroslope, + badpix=badpix, badval=badval, flashval=flashval, + flashslope=flashslope, darkrate=darkrate, darkslope=darkslope, + flatslope=flatslope, gain=ccdpars.gain3, ron=ccdpars.ron3, + nonlin=ccdpars.nlin3, poisson=poisson, overwrite=yes) + hedit (im//".21", "asec21", as, show-, ver-, add+) + cx1 = 1 + cx2 = cx1 + dnx - 1 + cy1 = dny + 1 + cy2 = cy1 + dny - 1 + printf ("[%d:%d,%d:%d]\n", cx1, cx2, cy1, cy2) | scan (cs) + hedit (im//".21", "ccdsec", cs, show-, ver-, add+) + } + + # Set sections for Amp12 & Amp22 + dx1 = onx + 1 + dx2 = nx + dy1 = 1 + dy2 = dy1 + dny - 1 + printf ("[%d:%d,%d:%d]\n", dx1, dx2, dy1, dy2) | scan (ds) + + tx1 = dx1 + txs1 + tx2 = dx2 + ty1 = dy1 + tys1 + ty2 = dy2 + printf ("[%d:%d,%d:%d]\n", tx1, tx2, ty1, ty2) | scan (ts) + + bx1 = 1 + bxs1 + bx2 = onx - bxs2 + by1 = 1 + bys1 + by2 = ny + printf ("[%d:%d,%d:%d]\n", bx1, bx2, by1, by2) | scan (bs) + + if (use_amp[2]) { + mkamp (im//".12", exp, ccdt, ncols=nx, nlines=ny, + filter=filter, datasec=ds, trimsec=ts, biassec=bs, imdata=imdata, + skyrate=sky, zeroval=ccdpars.zero2, zeroslope=zeroslope, + badpix=badpix, badval=badval, flashval=flashval, + flashslope=flashslope, darkrate=darkrate, darkslope=darkslope, + flatslope=flatslope, gain=ccdpars.gain2, ron=ccdpars.ron2, + nonlin=ccdpars.nlin2, poisson=poisson, overwrite=yes) + hedit (im//".12", "asec12", as, show-, ver-, add+) + cx1 = dnx + 1 + cx2 = cx1 + dnx - 1 + cy1 = 1 + cy2 = cy1 + dny - 1 + printf ("[%d:%d,%d:%d]\n", cx1, cx2, cy1, cy2) | scan (cs) + hedit (im//".12", "ccdsec", cs, show-, ver-, add+) + } + + if (use_amp[4]) { + mkamp (im//".22", exp, ccdt, ncols=nx, nlines=ny, + filter=filter, datasec=ds, trimsec=ts, biassec=bs, imdata=imdata, + skyrate=sky, zeroval=ccdpars.zero4, zeroslope=zeroslope, + badpix=badpix, badval=badval, flashval=flashval, + flashslope=flashslope, darkrate=darkrate, darkslope=darkslope, + flatslope=flatslope, gain=ccdpars.gain4, ron=ccdpars.ron4, + nonlin=ccdpars.nlin4, poisson=poisson, overwrite=yes) + hedit (im//".22", "asec22", as, show-, ver-, add+) + cx1 = dnx + 1 + cx2 = cx1 + dnx - 1 + cy1 = dny + 1 + cy2 = cy1 + dny - 1 + printf ("[%d:%d,%d:%d]\n", cx1, cx2, cy1, cy2) | scan (cs) + hedit (im//".22", "ccdsec", cs, show-, ver-, add+) + } + + # Set NAMPSYX and amplistin header + nampsyx = str (nampy) // " " // str (nampx) + hedit (im//".??.imh", "nampsyx", nampsyx, show-, ver-, add+) + hedit (im//".??.imh", "amplist", amplist, show-, ver-, add+) + + quadjoin (im, output="", delete=yes) + +end diff --git a/noao/imred/quadred/src/quad/quadtest/mkquad.par b/noao/imred/quadred/src/quad/quadtest/mkquad.par new file mode 100644 index 00000000..662f315f --- /dev/null +++ b/noao/imred/quadred/src/quad/quadtest/mkquad.par @@ -0,0 +1,4 @@ +image,s,a,,,,"Image name" +exptime,r,a,,,,"Exposure time" +ccdtype,s,a,,,,"CCD type" +filter,s,h,"",,,"Filter" diff --git a/noao/imred/quadred/src/quad/quadtest/quadtest.cl b/noao/imred/quadred/src/quad/quadtest/quadtest.cl new file mode 100644 index 00000000..3129f636 --- /dev/null +++ b/noao/imred/quadred/src/quad/quadtest/quadtest.cl @@ -0,0 +1,14 @@ +# QUADTEST -- QUAD Test package + +# load artdata package (mknoise) +artdata + +package quadtest + +task mkimage = quadtest$x_ccdred.e +task mkamp = quadtest$mkamp.cl +task mkquad = quadtest$mkquad.cl +task artobs = quadtest$artobs.cl +task ccdpars = quadtest$ccdpars.par + +clbye() diff --git a/noao/imred/quadred/src/quad/quadtest/quadtest.par b/noao/imred/quadred/src/quad/quadtest/quadtest.par new file mode 100644 index 00000000..efe72ef5 --- /dev/null +++ b/noao/imred/quadred/src/quad/quadtest/quadtest.par @@ -0,0 +1,20 @@ +# QUADTEST -- package parameter file +imdata,f,h,"",,,"Image data" +skyrate,r,h,0.,,,"Sky count rate +" +zeroslope,r,h,0.,,,"Slope of zero value" +flatslope,r,h,0.,,,"Flat field slope +" +badpix,f,h,"",,,"Bad pixel regions" +badval,r,h,0.,,,"Bad pixel value +" +flashval,r,h,0.,,,"Preflash level value" +flashslope,r,h,0.,,,"Slope of preflash level +" +darkrate,r,h,0.,,,"Dark count rate" +darkslope,r,h,0.,,,"Slope of dark count rate +" +poisson,b,h,yes,,,"Add Poisson noise" +seed,i,h,0,,,"Random number seed +" +version,s,h,"Version 1.0 - Oct 93","Version 1.0 - Oct 93" |