|
User Documentation |
|||||||||
prev file | next file | ||||||||||
SUMMARY: fields | routine DETAILS: routine | ||||||||||
./toolbox dcresample.pro
dcresample |
procedure dcresample, dc, newinterval[, keychan], [/nearest], [/linear], [/lsquadratic], [/quadratic], [/spline], [ok=variable] |
Resample a spectrum using one of 4 possible interpolation methods onto a new frequency axis.
Takes the data values in the given data container and interpolates them onto a new frequency axis derived from the newinterval and keychan arguments. The reference_frequency is unchanged by this operation. The new frequency_interval is given by the newinterval argument. The new frequency axis is determined by choosing one channel in the original frequency axis and requiring that the frequency at that channel be centered on one of the channels in the interpolated data (the keychan argument). This sets the new reference frequency. When not supplied, keychan defaults to the channel nearest to the original reference channel.
The dc argument is altered by this operation. The data values will contain the interpolated values and the header will describe the new frequency axis. The number of channels in the resulting interpolated data is just enough to use as much of the original data as possible without trying to interpolate beyond the ends of that data.
Interpolation is done using INTERPOL or internally (nearest). The channel number are used as the abscissa. Blanked values (NaN) are ignored. See the documentation for INTERPOL for details about the various interpolation methods.
This only works with spectrum data containers.
; get a data container from the GUIDE structure data_copy,!g.s[2], mydc ; this is a copy ; do a linear interpolation to 1.5 x the channel spacing dcresample,dc,dc.frequency_interval*1.5 show,dc ; this is exactly equivalent to "dcinvert" dcresample,dc,-dc.frequency_interval ; get a fresh copy, use channel 0 as the keychan and ; do a spline interpolation, make sure things are ok data_copy,!g.s[2],mydc dcresample,dc,dc.frequency_interval*1.5,0,/spline,ok=ok if ok then show,dc
Parameters | |
dc |
The data container to work on. |
newinterval |
The new frequency_interval to use in the interpolation. This must be non-zero. If it has opposite sign from the input frequency interval, dcinvert will be used to first reverse the sense of the frequency axis. |
keychan |
The new frequency axis will have one channel where the frequency value equals the original frequency value at the keychan channel. When not supplied, this defaults to the channel nearest to the reference_channel. |