To write custom procedures, you should become familiar with IDL programming, and with the data container structure. Here is a simple example of a procedure to use as a template. This example scales the data in the spectrum by a factor given by the user.
pro myscale,factor tmp_data = getdata() tmp_data = tmp_data * factor setdata, tmp_data if !g.frozen eq 0 then show end
Suppose the code is stored in a file is called myscale.pro. To access the function, do this:
.compile myscale.pro ; Compile the program show ; Show the data myscale, 2 ; Scale the data by a factor of 2
That's it!
You can put procedures in the directory from which you are running GBTIDL, or in a special subdirectory off of your home directory called gbtidlpro. In case there are procedures with identical names in your IDL path, the directories will be searched in the following order: first the current directory, then $HOME/gbtidlpro, then the GBTIDL installation directories, and finally the IDL installation itself. If the file isn't in one of these directories, you will need to specify the path when compiling it:
.compile /users/aeinstein/mypros/myscale.pro