Learn R Programming

ptw (version 1.9-16)

ptwgrid: Calculate RMS or WCC values on a grid

Description

Calculates values of the chosen optimization criterion (RMS or WCC) on a grid defined by the coefficients of the warping function.

Usage

ptwgrid(ref, samp, selected.traces,
	coef.mins, coef.maxs, coef.lengths, 
	optim.crit = c("WCC", "RMS"), 
	smooth.param = 1e05, 
	trwdth = 20)

Arguments

ref

reference. Either a vector (containing one reference signal) or a matrix (one reference per row). If more than one reference is specified, the number of reference signals must equal the number of sample signals

samp

sample. A vector (containing one sample signal) or a matrix (one sample per row). If more than one sample is specified, the number of sample signals must equal the number of reference signals

selected.traces

optional vector containing the row numbers to use from ref (if more than one reference signal is specified) and samp

coef.mins

a vector containing the respective minimal values of coefficients for the grid. The first number is the minimal zeroth-order coefficient (i.e., a constant shift); further numbers indicate the minimal linear, quadratic, ... stretches

coef.maxs

a vector containing the maximal values of coefficients for the grid

coef.lengths

a vector of the same length as coef.maxs and coef.mins containing the number of steps in which to vary the respective coefficients between their minimum and maximum value

optim.crit

either "WCC" or "RMS". In both cases, the optimal value of the alignment leads to a value of 0. For "WCC", this means that 1 - WCC is optimized rather than WCC (where the optimal value equals 1)

smooth.param

smoothing parameter for smoothing the reference and sample when optim.crit equals "RMS". If no smoothing is required, set this to 0

trwdth

the width of the triangle in the WCC criterion during the optimization, given as a number of data points. Default: 20

Value

An array of dimension length(coef.mins) and maximal indices per dimension specified by coef.lengths

Details

In contrast to ptw, only the three situations leading to one warping function are distinguished here:

  1. One sample and one reference;

  2. Several samples, warped to an equal number of references (pair-wise);

  3. Several samples, warped to a single reference.

Which situation is applicable is determined from the dimensions of ref and samp.

See Also

ptw

Examples

Run this code
# NOT RUN {
  
# }
# NOT RUN {
  data(gaschrom)
  mygrid <- ptwgrid(gaschrom[1,], gaschrom[16,],
                    coef.mins = c(-10, .9), coef.max = c(10, 1.1),
                    coef.lengths = c(21, 21))
  image(seq(-10, 10, length = 21),
        seq(.9, 1.1, length = 21),
        mygrid)
# }

Run the code above in your browser using DataLab