Learn R Programming

powdR: Full Pattern Summation of X-Ray Powder Diffraction Data

Overview

powdR is an implementation of the full pattern summation approach to quantitative mineralogy from X-ray powder diffraction data (Chipera and Bish 2002, 2013; Eberl 2003).

powdR has several advantages over the excel based implementations of full pattern summation such as FULLPAT (Chipera and Bish 2002) and RockJock (Eberl 2003). First, computation is faster and, when quantifying multiple samples, can be used in combination with other packages (e.g foreach and doParallel) for parallel processing. Secondly, powdR can be run via a Shiny web application, which offers a user friendly interface for fast and iterative mineral quantification. Lastly, R represents a powerful tool for data manipulation, allowing users to creatively adapt, pre-treat and visualise their data.

Installation

The stable version of powdR is on CRAN:

install.packages("powdR")

Alternatively, the development version can be downloaded from GitHub

#Install devtools if you don't already have it on your machine
install.packages("devtools")

devtools::install_github('benmbutler/powdR')

Usage

library(powdR)
#> powdR: Full Pattern Summation of X-Ray Powder Diffraction Data

#Load some soils to quantify
data(soils)

#Load a powdRlib reference library of pure patterns
data(minerals)

#Quantify a sample
q <-  fps(lib = minerals,
          smpl = soils$sandstone,
          refs = minerals$phases$phase_id,
          std = "QUA.1")
#> 
#> -Aligning sample to the internal standard
#> -Interpolating library to same 2theta scale as aligned sample
#> -Optimising...
#> -Removing negative coefficients and reoptimising...
#> -Computing phase concentrations
#> -Internal standard concentration unknown. Assuming phases sum to 100 %
#> ***Full pattern summation complete***

#Inspect the phase concentrations (summarised by name)
q$phases_grouped
#>       phase_name phase_percent
#> 1         Quartz       53.6918
#> 2     K-feldspar        1.3184
#> 3    Plagioclase        1.1637
#> 4         Illite        1.3515
#> 5      Kaolinite        1.3697
#> 6 Organic-Matter       41.1049

#Inspect the quantification
plot(q, wavelength = "Cu")

Alternatively, plot(q, wavelength = "Cu", interactive = TRUE) provides an interactive plot for better inspection of the fit. More detailed usage instructions are provided in the package vignette.

The powdR Shiny app

To run powdR via the Shiny app, use run_powdR(). This loads the application in your default web browser. The application has six tabs:

  1. Reference Library Builder: Allows you to create and export a powdRlib reference library from two .csv files: one for the XRPD measurements, and the other for the ID, name and reference intensity ratio of each pattern.
  2. Reference Library Viewer: Facilitates quick inspection of the phases within a powdRlib reference library.
  3. Reference Library Editor: Allows the user to easily subset a powdRlib reference library .
  4. Full Pattern Summation: A user friendly interface for manual and automated full pattern summation of single samples.
  5. Results Viewer/Editor: Allows for results from previously saved powdRfps and powdRafps objects to be viewed and edited via addition or removal of reference patterns.
  6. Help Provides a series of video tutorials (via YouTube) detailing the use of the powdR Shiny application.

Please note that the powdR Shiny app may not work in the Microsoft Edge internet browser.

References

Chipera, Steve J., and David L. Bish. 2002. “FULLPAT: A full-pattern quantitative analysis program for X-ray powder diffraction using measured and calculated patterns.” Journal of Applied Crystallography 35 (6): 744–49. https://doi.org/10.1107/S0021889802017405.

———. 2013. “Fitting Full X-Ray Diffraction Patterns for Quantitative Analysis: A Method for Readily Quantifying Crystalline and Disordered Phases.” Advances in Materials Physics and Chemistry 03 (01): 47–53. https://doi.org/10.4236/ampc.2013.31A007.

Eberl, D. D. 2003. “User’s guide to ROCKJOCK - A program for determining quantitative mineralogy from powder X-ray diffraction data.” Boulder, CA: USGS.

Copy Link

Version

Install

install.packages('powdR')

Monthly Downloads

293

Version

1.3.0

License

GPL-2 | file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Benjamin Butler

Last Published

August 13th, 2021

Functions in powdR (1.3.0)

as_multi_xy

Create a multiXY object
afsis_regroup

Regrouping structure for the Africa Soil Information Service (AfSIS) XRPD reference library
afps.powdRlib

Automated full pattern summation
as_multi_xy.data.frame

Create a multiXY object from a list of XRPD data
afps

Automated full pattern summation
align_xy.XY

Align XRPD data in an XY object to a given standard
align_xy

Align XRPD data to a given standard
align_xy.multiXY

Align XRPD data in a multiXY object to a given standard
afsis_codes

Original codes for the afsis reference patterns
afsis

Africa Soil Information Service (AfSIS) XRPD reference library
delta

Calculate the Delta value for a fitted pattern
extract_xy

Import and extract XY data from proprietary files
minerals_phases

Example phases table for a reference library
close_quant.powdRfps

Close the phase concentration data within a powdRfps object
interpolate.multiXY

Interpolate a multiXY object onto a given 2theta scale.
as_xy

Create an XY object
close_quant.powdRafps

Close the phase concentration data within a powdRafps object
as_multi_xy.list

Create a multiXY object from a list of XRPD data
fps

Full pattern summation
fps_lm

Full pattern summation using linear regression
interpolate.powdRlib

Interpolate a powdRlib object onto a given 2theta scale.
minerals_regroup

Example regrouping structure for the minerals data
omit_std

Omit the internal standard from phase concentration data within a powdRfps or powdRafps object
plot.powdRlib

Plotting elements of a powdRlib object
plot.powdRfps

Plotting elements of a powdRfps object
multi_xy_to_df.multiXY

Convert a multiXY object to a data frame.
rwp

Calculate the Rwp value for a fitted pattern
tth_transform

Transform a two theta axis between wavelengths
xrpd_pca

PCA of XRPD data
soils

Example soil XRPD data
omit_std.powdRfps

Omit the internal standard from phase concentration data within a powdRfps object
fps_lm.powdRlib

Full pattern summation using linear regression
multi_xy_to_df

Convert a multiXY object to a data frame.
fps.powdRlib

Full pattern summation
omit_std.powdRafps

Omit the internal standard from phase concentration data within a powdRafps object
summarise_mineralogy

Summarise the mineralogy from multiple powdRfps and powdRafps outputs
regroup.powdRfps

regroup
plot.XY

Plotting an XY object
plot.multiXY

Plotting a multiXY object
regroup.powdRafps

regroup
subset.powdRlib

Subset a powdRlib object
minerals_xrd

Example xrd table for a reference library
plot.powdRlm

Plotting elements of a powdRlm object
powdR

powdR: Full Pattern Summation of X-Ray Powder Diffraction Data
rockjock

RockJock reference library
rockjock_mixtures

RockJock synthetic mixtures
close_quant

Close the phase concentration data within a powdRfps or powdRafps object
minerals

An example powdRlib reference library
bkg

Fit a background to XRPD data
merge.powdRlib

Merge two powdRlib objects
interpolate

Interpolate an XY, multiXY or powdRlib object to a given 2theta scale.
regroup

regroup
interpolate.XY

Interpolate an XY object onto a given 2theta scale.
read_xy

Read ASCII XY data
run_bkg

Run the background fitting shiny app
run_powdR

Run the powdR shiny app
rockjock_regroup

Regrouping structure for the rockjock reference library
plot.powdRafps

Plotting elements of a powdRafps object
powdRlib

Create an XRPD reference library
plot.powdRbkg

Plotting a powdRbkg object
r

Calculate the R value for a fitted pattern
rockjock_weights

Mineral concentrations of the rockjock_mixtures data