Skip to contents

Strip XRD ka2

Usage

ka2_strip_penalized(x, y, ...)

# S4 method for class 'numeric,numeric'
ka2_strip_penalized(
  x,
  y,
  lambda,
  wave = c(1.5406, 1.54443),
  tau = 0.5,
  nseg = 1,
  progress = interactive()
)

# S4 method for class 'ANY,missing'
ka2_strip_penalized(
  x,
  lambda,
  wave = c(1.5406, 1.54443),
  tau = 0.5,
  nseg = 1,
  progress = interactive()
)

Arguments

x, y

A numeric vector. If y is missing, an attempt is made to interpret x in a suitable way (see grDevices::xy.coords()).

...

Currently not used.

lambda

An integer giving the smoothing parameter. The larger lambda is, the smoother the curve.

wave

A length-two numeric vector giving the characteristic wavelengths of the anode material (defaults to copper).

tau

A length-one numeric vector giving the ratio between \(\alpha\)1 and \(\alpha\)2 line intensities (defaults to 1/2).

nseg

A length-one numeric vector specifying the number of equally sized segments for B-spline basis matrix computation.

progress

A logical scalar: should a progress bar be displayed?

Value

Returns a list with two components x and y.

Note

Matrix is required.

References

de Rooi, J. J., van der Pers, N. M., Hendrikx, R. W. A., Delhez, R., Böttger A. J. and Eilers, P. H. C. (2014). Smoothing of X-ray diffraction data and Ka2 elimination using penalized likelihood and the composite link model. Journal of Applied Crystallography, 47: 852-860. doi:10.1107/S1600576714005809

Author

J. J. de Rooi et al. (original R code).

Examples

if (FALSE) { # \dontrun{
## X-ray diffraction
data("XRD")

## Subset from 20 to 40 degrees
XRD <- signal_select(XRD, from = 20, to = 40)

## Plot diffractogram
plot(XRD, type = "l", xlab = expression(2*theta), ylab = "Count")

## Penalized likelihood smoothing
lambda <- seq(from = 1, to = 8, length.out = 40)
lambda <- 10^lambda

likelihood <- smooth_likelihood(XRD, lambda = lambda, d = 3)
lines(likelihood, col = "red")

## Strip ka2
ka2 <- ka2_strip_penalized(XRD, lambda = lambda, tau = 0.5, nseg = 1)
lines(ka2, col = "blue")
} # }