Presentation is loading. Please wait.

Presentation is loading. Please wait.

IDL Tutorials : Day 3 Angela Des Jardins Goals: 1) Learn to display images 2) Understand the basics of procedures and.

Similar presentations


Presentation on theme: "IDL Tutorials : Day 3 Angela Des Jardins Goals: 1) Learn to display images 2) Understand the basics of procedures and."— Presentation transcript:

1 IDL Tutorials : Day 3 Angela Des Jardins (desjardins@physics.montana.edu) Goals: 1) Learn to display images 2) Understand the basics of procedures and functions

2 Displaying Images  Image data is often stored in column-major 2-arrays  Two-D image data can be displayed using - tv, data ; images data on screen - tvscl, data; this method scales data for display  Two-D image data are just arrays of numbers  Many Image arrays are of Byte type ( integer in [0,255])  Colors arbitrarily assigned to each number depending on color table - loadct, number - tvlct, [vectors defining each color to be used] - xloadct  Many routines to read and write images. (read_gif, write_gif,..)  For more advanced routines see /ssw/gen/idl/ and look through imaging and display folders.

3 Procedures and Functions  All procedures and functions must end with an END statement  Procedures start with the line PRO name, p1, …pn, [KEY_NAME=KEY_NAME,…] And are called: IDL>name,p1,…pn  Functions Start with the line FUNCTION name, p1,…pn, [KEY_NAME=KEY_NAME,…] And are called: IDL>result=name(p1,…pn)  Functions have the statement return, output_variable ; before the final END  Must be compiled after every saved change IDL>.r pro_textfile_name

4 Keywords  The lines KEY_NAME on the previous slide are Keywords  They are usually options for when you run the program  To select one you will use either: IDL>pro_name, p1, …pn, /Keyword or IDL>pro_name, p1, … pn, Keyword=something  For functions, it will look like: IDL>result=fn_name(p1,…pn, /Keyword) or IDL>result=fn_name(p1,…pn, Keyword=something) See the help files for more information on keywords and optional parameters.

5 Variable Handling  Whenever you use Procedures or Functions the variables used in them are “put in a box”.  The variables in that box are not accessible when the procedures and functions are finished running  Variables can be accessible to the main level if - Output parameters or keywords are used - Common blocks are used - System variables (defsysv, “!var_name”, value) are defined

6 “Homework”  Display the image, /home/angela/reu/img.sav, on your screen. You will need to restore the file above. Once you have done that, a variable called “img” will be defined. This is what you need to display. You will need to restore the file above. Once you have done that, a variable called “img” will be defined. This is what you need to display. If you want to use the program display.pro, it will need to be copied to the directory you are working in. The program lives at /home/dana/idl/display.pro or /home/angela/reu/display.pro. If you want to use the program display.pro, it will need to be copied to the directory you are working in. The program lives at /home/dana/idl/display.pro or /home/angela/reu/display.pro. You will need to change the scale of the color table (use xloadct) in order to see the image well. You will need to change the scale of the color table (use xloadct) in order to see the image well.  Cont. on next page >>>>>>>

7 “Homework” cont.  Write a function that returns sin 2 (x), where x is an array. Plot the result.  Write a procedure that plots sin 2 (x), where you input a value to create the array x in the call to the program. Also in your program, save a copy of the plot to a postscript file, where you give the name of the file in the call to the procedure.


Download ppt "IDL Tutorials : Day 3 Angela Des Jardins Goals: 1) Learn to display images 2) Understand the basics of procedures and."

Similar presentations


Ads by Google