tth_transform {powdR} | R Documentation |
Transform a two theta axis between wavelengths
Description
tth_transform
converts the two theta axis from one wavelength to another via Bragg's law.
Use this function with caution if intending the apply fps()
or afps()
to wavelength
transformed samples or libraries because background signals can vary with wavelength which may
therefore affect the quality of the fit.
Usage
tth_transform(tth, from, to)
Arguments
tth |
the 2theta vector to be transformed |
from |
numeric value defining the wavelength (Angstroms) to transform from |
to |
numeric value defining the wavelength (Angstroms) to transform to |
Value
a transformed 2theta vector
Examples
data(soils)
sandstone2 <- soils$sandstone
#Convert from Cu (1.54056 Angstroms) to Co (1.78897 Angstroms)
sandstone2$tth <- tth_transform(sandstone2$tth,
from = 1.54056,
to = 1.78897)
sandstone_list <- as_multi_xy(list("sandstone" = soils$sandstone,
"sandstone2" = sandstone2))
#plot the change
plot(sandstone_list, wavelength = "Cu")
#Alternatively convert the 2theta axis of a library
data(minerals)
minerals2 <- minerals
minerals2$tth <- tth_transform(minerals2$tth,
from = 1.54056,
to = 1.78897)
#Plot the difference
plot(x = minerals$tth, y = minerals$xrd$QUA.1,
type = "l", xlim = c(0, 85))
lines(x = minerals2$tth, y = minerals2$xrd$QUA.1,
col = "red")
[Package powdR version 1.3.0 Index]