Deepsearch Software Docs: Reading and Displaying Images

Do this:

IDL> r=freadimage2(ims1,im1,'apr198btc3642csg.fts')

IDL> r=freduceimage2(ims1,im1,pho1)

IDL> window,0

Resize the window so it's big. (It doesn't matter, but it will be prettier that way.)

IDL> frame,im1,zero=-50,span=2000

IDL> boxdata,30,pho1.x,pho1.y,colordex('s')

There. Now you know everything you need to know about our software.

In more detail....

The readimage command finds the image apr198btc3642csg.fts in our database, loads its header information into the variable ims1, and loads the image data into the variable im1. Suppose you just wanted the header information and didn't want to read in 16 megabytes of image data; in that case, you can do:

IDL> r=freadimage2(ims1,im1,'apr198btc3642csg.fts',/noim)
Here, the /noim parameter tells readimage not to actually read the image data, but only the header. Note, however, that even though im1 still isn't used, you need to put something there for the call to readimage to work.

freadimage2 calls the routine findimage to find the physical location of the file on our disks. Suppose you want to get at this file outside of IDL; you can use IDL to find it for you:

IDL> print,findimage('apr198btc3642csg.fts')

The result is the full Unix path to the image.

The freduceimage2 command either runs a number of procedures that find objects on the frame, or reads the database entry which was created the first time somebody ran reduceimage on this image. It loads the variable pho1 with an array of type star_struct. The x and y fields of these structures are the x and y positions on the image whose header is in ims[1].

The window command is standard IDL.

The frame command draws the image. You can use standard IDL array slices to just show a piece of the image, e.g.:

IDL> frame,im1[700:1300,700:1300],zero=-50,span=2000
The zero and span keywords are optional; frame will work without them. They let you specify the "stretch", or mapping of image values to pixel colors. Pixels with values equal to or less than zero will be set to black; pixels with values equal to or greater than zero+span will be set to white. In between the colors are interpolated linearly. So, in this case, pixels with value 975 will be set to a half-intensity grey. Futzing with zero and span can bring out different features in an image.

boxdata draws boxes on an image. You can easily confuse yourself with this routine if you draw more than one image in multiple windows, or if you do something like display a smaller section of an image, so be careful. The first parameter is the size of the boxes to draw, in pixels. The second and third parameters are arrays of, respectively, x and y coordinates of the boxes to draw. You can draw a single box, or many. (This example draws many.) The last parameter is the color of the boxes to draw (see Display and Colors). This is just an example of how you might visualize a photometry list.

For yucks, try:

IDL> frame,im1[700:1300,700:1300],zero=-50,span=2000
IDL> w=where(pho1.x gt 700 and pho1.x lt 1300 and $
             pho1.y gt 700 and pho1.y lt 1300)
IDL> pho1=pho1[w]
IDL> boxdata,10,pho1.x-700,pho1.y-700,colordex('s')

What all this means is left as an exercise to the reader who wishes to learn IDL. (Note that the whole "where" command could have been typed on one line; the $ is the flag to IDL that the current line is continued on the next line, and may be used both on the command line and in programs.)