A series of Weeks lab codes have been written by various students over the years. Some of these codes are useful and some are not. To prevent you from wasting your time rewriting useful code, another series of codes were written. These are specially written codes for storing, finding, and locating useful code in an easy to use way. Below is a list of these special programs.
Also there is a website listing the Weeks Lab useful code, provided everyone does their part in adding their own useful code. The directory for this website is on spicysquid located in data/IDLWeeksLabcode. Code can be added to the website by using the add2library function.
Accessing the website
If you're on spicysquid, open up a browser and type in the address
file:///data/IDLWeeksLabcode/index.html
If you're on a linux machine that is not spicysquid, open up a browser and type in the address file:///nfs/spicysquid/data/IDLWeeksLabcode/index.html
I can't get this web page to link to the files directly, but you're welcome to cut & paste the above addresses into your browser bar.
If you're on a windows machine, then you must download the directory to your local machine to view the webpage.
kman is a program to view the source code of an idl program within idl. This program is just like the man function, except that it doesn't have the tendency to break when you put in a program that doesn't exist. This program can also display or store the path of the source code.
Different uses of kman
To view the source code of a program
IDL > kman, program_name
To display the path for the source code
IDL > kman, program_name, /loc
To store the path for the source code to a variable (let's use loc as the variable)
IDL > kman, program_name, loc
program_search is a program to search for existing programs using a wildcard. The best way to illustrate how this program works is to use an example. Say you want to draw a circle, but do not want to write the function to do so. Well you can try to search for a Weeks Lab program that may already do this. Since you know that you want a function to draw a circle, it's probably reasonable to assume that any function that performs this operation, has the letters "cir" in the function name. So if you could somehow search for functions with the letters "cir" in the function name, you may be able to get a list of possible programs that draw a circle. This is exactly what program_search does. It gives you a list of programs where the program name satisfies your wildcard search.
How to use program_search
Let's say you want to look for functions with "cir" in the name.
IDL > program_search, '*cir*'
addheader is a program to add a header to an idl code you've written. This program will strip the information in your call sequence and insert that information into a header. This header will then be placed at the top of your program. After executing the program make sure to close the source code file and reopen it, otherwise you will not see the header. Also, by default, this program assumes that the call sequence is on line 1 of your source code. If your call sequence is not on line 1, you must specify the line number using the line keyword.
How to use addheader
To add a header when your call sequence is on line 1.
IDL > addheader, program_name
To add a header when your call sequence is not on line 1.
IDL > addheader, program_name, line = line number
Also note that a backup of your program is created in case something horrible goes wrong. The name of the backup file is program_name.blah.
add2library is a program to add your program to the list of useful code. Also a webpage is made for your program. This webpage consist of the first commented section within in your source code.
How to use add2libray
To add your program to the list of useful code.
IDL > add2library, program_name
You may get an error if you do not include .pro in the program_name. However this kind of error is rare, and only happens when there is a directory with the same name as program_name. When this error occurs, it's important that you type the following into idl.
IDL > retall
IDL > close, 1
IDL > close, 10
rmfromlibrary is a program to remove your program from the list of useful code.
How to use rmfromlibray
To remove your program from the list of useful code.
IDL > rmfromlibrary, program_name