The goal of rigakuXRD is to analyze x-ray diffraction data from the Rigaku Smartlab x-ray diffractometer; mostly for low-angle reflectivity data and Bragg-Brentano diffractive data sets.
You can install the released version of rigakuXRD from GitHub with:
# install.packages("devtools")
devtools::install_github("thomasgredig/rigakuXRD")
The first line installs the popular devtools
package that you can use to install R packages from (Github)[http://www.github.com]. The second lines installs the latest version of the rigakuXRD
package.
The package comes with several sample data files, which can be found with the function xrd.getSampleFiles()
. A general example of loading a sample XRD file:
library(rigakuXRD)
d = xrd.import(filename = xrd.getSampleFiles()[1])
The data can be graphed, typically on a semi-log graph:
plot(d$theta, d$I.meas, log='y')
If you are loading a text file without a header, you could use the following approach:
d = xrd.read.TXTnoheader('xrd.txt')
plot(d$theta, d$I.meas, log='y')
In addition to .asc
files, .ras
or .rasx
files are also text files and contain a header information, followed by the data. Here is an example:
fileName = xrd.getSampleFiles(fileExt = 'rasx')[1]
d = xrd.import(fileName)
The largest peak in a sub dataset is found with the xrd.peakEstimate()
function. It is not a fit, but an estimate
to find the parameters of the largest peak in the data set.
Finding the precise peak position, you need to provide a starting angle (see xrd.peakEstimate()
). The xrd.find.Peak()
function attempts to fit a Gaussian function to the main peak. Here is an example:
fileName = xrd.getSampleFiles(fileExt = 'asc')[1]
d = xrd.import(fileName)
library(dplyr)
d %>% filter(theta < 42 & theta > 32) -> d1
p = xrd.peakEstimate(d1$theta, d1$I)
# is there a Au peak ?
xrd.find.Peak(d$theta, d$I, p[3])
# is there a Si substrate peak ?
xrd.find.Peak(d$theta, d$I, 44, Try.Sigma = c(0.05,0.1) )
You can search for all the prominent peaks, using the following function, which returns a vector with all the peaks.
xrd.get.AllPeaks(d$theta, d$I)
After finding the peaks, the peak amplitude is compared to the background to check the prominence of the peak, it should rise above 5%:
peak.stats = xrd.get.PeakStats(d$theta, d$I, 38.217)
peak.prom = xrd.get.PeakProminence(peak.stats)
paste0("Peak prominence: ",signif(peak.prom,3),"%.")
You can also get the thickness or grain size using the Debye-Scherrer analysis.
peak.d = xrd.get.DebyeScherrer(peak.stats)
paste("Debye-Scherrer thickness from peak:", peak.d/10, "nm")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.