tth_transform: Transform a two theta axis between wavelengths

Description Usage Arguments Value Examples

View source: R/tth_transform.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)
#plot the change
plot(soils$sandstone, type = "l",
     xlim = c(0, 85))
lines(sandstone2, col = "red")

#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")

benmbutler/powdR documentation built on Sept. 16, 2020, 5:03 a.m.