procedure markstds(image) char image ="" {prompt="image name"} real zlo =0. {prompt="lower cut level (display)"} real zhi =0. {prompt="upper cut level"} string radstr ="11,50,60" {prompt="radii of 7\" aperture and sky annulus"} bool append =no {prompt="append to existing position file?"} bool redispl =yes {prompt="(re)display image first?"} # @(#) task markstds Author: R.A. Jansen -- May 2 1996 # @(#) # @(#) task to interactively mark all standard stars in an image and log # @(#) their positions to a file named 'image//".stdcoo". The positions # @(#) will have a label appended in column three. # @(#) # @(#) Jul.25 2002 -- Added parameters 'radstr', 'append' and 'redispl'. # @(#) Added support for other image formats. (R.A.J.) begin string img, imtyp, imrp, starfile file tmptvmark string cmd, key, arg, val real x, y int imglen, ncol, nrow, l, NN img = image # Check whether input image exists unlearn chkimg ; chkimg (img, "access", imtype="", verbose=yes) if (!chkimg.ok) { return } img = chkimg.imroot imglen = chkimg.imglen imtyp = chkimg.imtype imrp = chkimg.imrpstr # Determine input image size imgets (img//imtyp//imrp, "naxis1"); ncol = int(imgets.value) imgets (img//imtyp//imrp, "naxis1"); ncol = int(imgets.value) imgets (img//imtyp//imrp, "naxis2"); nrow = int(imgets.value) starfile = img//".stdcoo" # If older versions of positions/regions files are present, rename them # NB: The 'verbose' option in task copy seems not to be implemented! if ( access(starfile) ) { if (append) { print ("Appending to existing coordinate file \""//starfile//"\"") } else { print ("Renaming \""//starfile//"\" --> \""//starfile//"~\"") if ( access(starfile//"~") ) { delete (starfile//"~", yes, verify=no) } copy (starfile, starfile//"~", verbose=yes) print (" "//starfile//" --> "//starfile//"~") delete (starfile, yes, verify=no) } } # Display image if 'redispl=yes' if (redispl) { xdisplay (img//imtyp//imrp, z1=zlo, z2=zhi) } # Mark all standard stars in the image print ("Wait for the cursor cross to appear in the image display area,") print ("then mark all standard stars in the image using the 'c' key.") print ("Note: start with the main (=naming) star in the field.") sleep(1) tmptvmark=mktemp("tvmark") tvmark (frame=1, coor="", logfile=tmptvmark, autolog=yes, outimage="", mark="plus", radii="1", lengths="0", label=no, number=no, nxoffset=0, nyoffset=0, txsize=2, pointsize=3, font="raster", color=204, commands="", interactive=yes, > "dev$null", >& "STDERR" ) list=tmptvmark NN = 0 while( fscan(list,x,y,key,cmd,arg,val) != EOF ) { if ( x < 1. ) x = 1. if ( x > ncol) x = ncol if ( y < 1. ) y = 1. if ( y > nrow) y = nrow if ( NN == 0 ) { # Main (naming) star in field if ( substr(img,imglen-2,imglen) == "bdf" ) { print (x,y,"\""//substr(img,6,imglen-4)//"\"", >> starfile) } else if ( substr(img,imglen-1,imglen) == "bf" ) { print (x,y,"\""//substr(img,6,imglen-3)//"\"", >> starfile) } else { print (x,y,"\""//img//"\"", >> starfile) } } else { print (x,y,"\""//str(NN)//"\"", >> starfile) } NN += 1 } delete (tmptvmark, yes, verify=no) tvmark (1, coords=starfile, logfile="", autolog=no, outimage="", deletions="", commands="", mark="circle", radii=radstr, lengths="0", font="raster", color=205, label=yes, number=no, nxoffset=16, nyoffset=16, pointsize=3, txsize=2, tolerance=1.5, interactive=no) print ("Finished.") end