Produced by IDL 7.1.1
User Documentation

./toolbox
dcresample.pro

Last modification date:
Wed Sep 28 13:27:10 2016

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.

Examples
    ; 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
 
Uses
data_valid dcinvert
Version
$Id$

Parameters
dc
in/out, required
variable
The data container to work on.
newinterval
in, required
real
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
in, optional
integer
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.

Keywords
nearest
in, optional
boolean
When set do nearest-neighbor interpolation.
linear
in, optional
boolean
When set (the default) do a linear interpolation.
lsquadratic
in, optional
boolean
When set do least squares quadratic fit interpolation.
quadratic
in, optional
boolean
When set do a quadratic fit interpolation.
spline
in, optional
boolean
When set do a spline interpolation.
ok
out, optional
variable
This is set to 1 on success, otherwise it is 0 (bad arguments, bad data).


Produced by IDLdoc 1.6 on Wed Sep 28 13:27:38 2016