Writing your own functions.It is possible to write your own functions using IDL commands. These can be written using any editor or within the IDL Development Environment (IDLDE). These functions can be called from within the signal processing dialog.
IDL uses files with the extension JETDSP automatically searches the AddIns directory for these files, which makes it a useful place to put them. Previously it was necessary to create a '.sav' file but these do not need to be created now.
As an example a function to normalise a signal will be written. The code for this is given below, copy it into an editor an save to a file named function my_normalise,data min_data=min(data,max=max_data) scale=1.0/(max_data-min_data) return,(data-min_data)*scale endThis function can now be called in the same way as any IDL expression. These functions can take other variables as well, but one function is required for each set of data (signal/time/x) required. For example to perform FFT's two calls are required, the first has the form function my_fft,data,time ;put the data onto a uniform time axis using interpolate commands. ;fft the data return, data_fft endHowever 'time' axis values are not returned. These require a second call. function my_fft_time,time ; calculate the 'time' points required. return, time_fft endThis then would require the following information to be entered into the dialogue; This is far from ideal in more complicated cases where the same processing must be done three times to return all the data. To get round this problem a new way of using signal processing function has been introduced. This uses only one function call and must return a specific structure. This is used to create the new signal object and is shown pictorially below.
This is illustrated in the my_truncate function. An example of this is the fixgrid function previously discussed. For further information on using these structures please contact Data and Coding, whose address is linked at the bottom of the page.
|