View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

helplog.24: imexam, coordinate list display

Frank Valdes wrote on Feb 16, 2005

NUMBER:	24
KEYWORDS:	imexam, coordinate list display
DATE:	Wed Feb 16 09:18:48 MST 2005
FROM:	valdes

Q:	I have a question having to do with IMEXAM. I think it somehow
	involves the <defkey> parameter but maybe not.

	1) Given a file consisting of x,y pixel coordinates generated
	   from separate code and
	2) Given a fits image

	I would then like, for each entry of the list of x,y pixel 
	coordinates, to

	a) Have the cursor positioned automatically at this x,y 
	   position on the image so that I can visually inspect that pixel
	   and its surrounding neighbors at a zoom high enough to let
	   individual pixels be easily seen.
	b) Depending upon the results of this visual inspection to 
	   either:

	    c-1: Execute the <x> key to record in an imexam <logfile>, 
	    the x,y coordinates of that pixel, and proceed to the next pixel 
	    position in the list
				    OR
	    c-2: Do not execute the <x> command, but go on to examine 
	    the next pixel position.

A:	IMEXAM can be used non-interactively to use one of its functions
	given by the defkey on a list of coordinates.  However, there is
	nothing to drive a zoomed image display interactively to a set of
	positions given in a file (without special GUI programming).

	The effect can be accomplished in a fairly simple script.  I
	include the script below.  What it does is go through the two
	column file of x and y coordinates.  It computes a box centered on
	those coordinates and then calls IMEXAM to display the centered
	box.  Note that because of the edges, if the box size is very large
	or the coordinates are near the edge the display will not have the
	position exactly in the center.

	You would set the zoom in the display which will be retained as
	each new image is displayed (at least under XIMTOOL).

	The installation instructions are in the comments to the script.



---- Cut here to file imreview.cl ----
# IMREVIEW -- Run IMEXAM on sections centered on list of coordinates.
#
# To install place in your IRAF home directory and type or put in
# your login.cl 
#
# task imreview = home$imreview.cl
#
# You must have IMEXAM and DISPLAY in you package environment and you must
# set the parameters for these first.

procedure imreview (image, coords)

file	image			{prompt="Image to display"}
file	coords			{prompt="Pixel coordinates"}

int	box = 51		{prompt="Display window size"}

begin
	int	half, x1, x2, y1, y2, nx, ny
	file	im
	string	imsec

	# Set query parameters and open list of coordinates.
	im = image
	list = coords
	half = box / 2

	# Get image size to limit sections.
	hselect (image, "naxis1,naxis2", yes) | scan (nx, ny)

	# Loop through coordinates and call IMEXAM.
	while (fscan (list, x, y) != EOF) {

	    # Set image section.
	    x1 = max (1, int(x-half))
	    x2 = min (nx, x1+box-1)
	    x1 = max (1, x2-box+1)
	    y1 = max (1, int(y-half))
	    y2 = min (ny, y1+box-1)
	    y1 = max (1, y2-box+1)
	    printf ("%s[%d:%d,%d:%d]\n", im, x1, x2, y1, y2) | scan (imsec)

	    # Call IMEXAM.
	    print (imsec)
	    imexamine (imsec, 1)
	}
	list = ""
end
---- Cut here ----

Frank Serduke wrote on Feb 19, 2005

I have questions relating to identify and reidentify tasks:

1) is there some utility that will read the id....fitsfile.ms text 
file and then plot the fits (with the fitted data) on a much finer 
and perhaps extended grid so, for example, the consequences of a 4th 
order or 8th order fit mapping pixels into angstroms could be 
examined in the regions between and beyond the fitted points.

2) Is the source for IRAF available?  Is it fortran?  I just want 
little bits of it.  I'd like to get the code that reads the identify 
output files and use it to modify it .. delete some of the data 
points, and rewrite it.  I could generate source to do this but 
suspect it would be more accurate and reliable if I used that same 
coding as does IRAF.

Thanks,
Frank Serduke

Last post on Feb 19, 2005