Simple plots can be interactively created using LIVE_PLOT, or some version of LIVE_*. There are many ways to make a plot in IDL. IDL> wset, 0 & plot,x,x^2 go back to the first window and make a new plot IDL> window,1 & plot,x,y*y create new window and make a plot IDL> window,0 & plot,x,y ampserand used to separate commands on the same line
See online help for details on how to modify their default sizes, title bars, positions, etc.
You can create multiple plotting windows using IDL, and move between them easily. Here we use the optional keyword XTITLE to label the x axis - see online help for complete list of keywords IDL> plot,x,y,title='First plot',xtitle='X axis',ytitle='y axis label' IDL uses keywords to pass (often optional) information. Try to understand what the following does using online help. Use IDL> ? to find fltarr and see what this line does. IDL> y=fltarr(50) semicolon marks a comment line. One can create arrays, 1-D or 2-D, easily as well. You may need to copy this file into as361/Deposit/ for grading - ask your professor. After typing a few commands, check that the file has been created in the proper place ( ~/idlwork/). Please use JOURNAL to record your sessions for future reference. When you exit IDL (or type 'journal' again with no filename), the recording session will end. Start the recording process by typing the following command. IDL can also save all your interactive session by using the JOURNAL command, and this will part of your tutorial today instead of filling out a separate worksheet. This information is also shown in the 'Variable Watch Window.' For more information on IDL data types, you can invoke IDL online help by typing a '?': try a search for 'data types.' You see that 'a' was declared as a float, while 'i' was declared as an integer. Unlike in more structured programming languages (e.g., C++, Fortran), one does not have to explicitly define variables in IDL rather, variables are defined implicitly through their use. Now, moving on to some basic IDL programming.
For instance, from the startup file you can see the location of the important libraries, such as the Astronomy library in as361/Idlstuff/Libraries/Astrolib/pro). Next time IDL is run, this file will be loaded and will set up your path and a few other things (I recommend you restart idlde and then take a look at the startup file). Now find the idl_startup.pro file you just modified and select this as your startup file. To do this, use the FILE pulldown menu, choose PREFERENCES, and click on the STARTUP tab. To setup the environment properly, you need to choose a startup file. Please make this say home_dir ='~/idlwork/' Once you are done. Please find the line where home_dir is dfined. You should be able to edit this file in the top-right window using familiar text-editing methods.
Please open your personal copy of the idl_startup.pro using the File-> Open tool inside idlde. You will need to edit this file to customize it. The idlde environment allows you to look at local variables, edit procedures/scripts, inspect previous commands, and issue new commands. When you begin idlde, you will see the idl development environment (below picture for Windows): To start IDL, you should open an X11 terminal and type:
Restores all files and compiled routines from previous sessionĪfter logging in as yourself on the Angell Hall Mac cluster, you should copy the example startup file ( ~/./as361/Idlstuff/idl_startup.pro) into your own space ( ~/idlwork/). Can start again next login using restore. (or just '.c') allows a program/script to continue after a 'STOP' or break Set_plot,'ps' & & device,/close & set_plot,'x' Įxecute commands in the filename (run script!) Used to continue a command on the next line I have included links to other online IDL tutorials if you want to learn more also, there are lessons in the IDL reference books in the 8th floor Dennison Computer Room.įor those finding this tutorial on the Web, you can try to follow along by installing the IDL Astronomy Library and downloading this tar file: FILES Please name these files as instructed so I can review them later as part of the grading. There is no separate Worksheet to fill out, but rather the tutorial instructs you to create a 'JOURNAL' file of your IDL session and also asks you to create postscript plots at a number of junctures.
After this tutorial (and with frequent consultation of idl help '?'), you should be able to effectively use IDL to analyze and present the data taken during subsequent experiments.
This tutorial is meant to take approximately 2-3 hours and expose you to the basic functionality of IDL.