create_linearinterpol_with_xtrafo_map: Create a linear interpolation mapping including energy...

View source: R/map_linearinterpol_with_xtrafo.R

create_linearinterpol_with_xtrafo_mapR Documentation

Create a linear interpolation mapping including energy calibration

Description

Creates a map to linearly interpolate the values at the source indices given on a one-dimensional mesh to the one-dimensional mesh associated with the variables at the target indices. It is possible to apply a shift and scaling to the target mesh to account for, e.g., an energy calibration error of an experiment. The transformation is given by x = α + β x' where x' is an x-value of the target mesh as stated by the user and the resulting x is the correct x-value that should be used for the linear interpolation.

Usage

create_linearinterpol_with_xtrafo_map()

Details

The following fields are required in the parameter list to initialize the mapping:

mapname Name of the mapping
maptype Must be "linearinterpol_with_xtrafo_map"
src_idx Vector of source indices
tar_idx Vector of target indices
src_x Vector with the mesh associated with the source indices
tar_x Vector with the mesh associated with the target indices
zero_outside Default is FALSE. If TRUE, y-values of target x-values outside the limits of the source mesh will be zero, otherwise this situation is not allowed.
shiftx_idx Index associated with the variable that contains α.
scalex_idx Index associated with the variable that contains β

Value

Returns a list of functions to operate with the mapping, see create_maptype_map.

See Also

Other mappings: create_compound_map(), create_convolution_with_xtrafo_map(), create_derivative2nd_map(), create_derivative_map(), create_linearinterpol_map(), create_linearmap_map(), create_maptype_map(), create_map(), create_nonlinear_map(), create_normerr_map(), create_product_map()

Examples

params <- list(
  mapname = "mylinearintmap",
  maptype = "linearinterpol_with_xtrafo_map",
  src_idx = 1:3,
  tar_idx = 4:6,
  src_x = c(1,5,10),
  tar_x = c(4,5,6),
  shiftx_idx = 7,
  scalex_idx = 8
)
mymap <- create_linearinterpol_with_xtrafo_map()
mymap$setup(params)
x <- c(1,2,3,0,0,0,0.5,1.1)
mymap$propagate(x)
mymap$jacobian(x)


gschnabel/nucdataBaynet documentation built on Feb. 3, 2023, 4:13 a.m.