knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The diwanalr (diffusing-wave spectroscopy (DWS) analysis using R) package contains a number of functions suitable for analysing DWS data.
DWS is derived from dynamic light scattering which is an optical technique that studies the dynamics of scattered light. If carefully calibrated, DWS allows the quantitative measurement of microscopic motion in a soft material from which micro-rheology can be used to determine the rheological properties of a complex medium.
Research capability exists which allows the application of DWS to food systems. In some instances, the analysis of data resulting from such capability can be tedious (e.g. using spreadsheets). This package is intended to allow users of such capability to perform analysis of DWS data in a more straightforward manner.
If needed, the diwanalr package can be downloaded using:
install.packages("devtools") devtools::install_github("peterjwatkins/diwanalr", force=TRUE)
One proposed workflow involves the calculation of the storage and loss moduli. The workflow consists of three steps:
The temporal autocorrelation function, g~1~($t$). In some cases, the output generated from research equipment consists of a CSV file, with two columns; the first being the correlation time while the second is the measured value of the intensity autocorrelation function, noted as g~2~($t$). The g~2~($t$) values are related to g~1~($t$) by the Seigert relationship where g~2~($t$) = 1 + $|$g~1~($t$)$|$$^2$. The function, form_g1, accepts a tibble consisting measured correlation times, $t$, and associated g~2~($t$) values, and returns a tibble consisting of three columns; namely, the correlation time ($t$), related g~1~($t$) values as well a set of scaled g~1~($t$) values, ranging from 0 to approximately 1. The scaled values are deployed in the second step of the workflow. Some functionality is provided to allow the user to set an appropriate normalisation value. The function plot_g1 is available to visualise the data. The plot_g1 function uses a spline to estimate t~1/2~ for the scaled data.
library(diwanalr) data(dws) g1 <- form_g1(dws) head(g1) plot_g1(g1)
The mean square displacement. The next stage involves calculating the mean square displacement (MSD), based on the scaled g~1~($t$) values using a minimisation step (see the vignette for further detail). The function, form_msd is used for this purpose, accepting the output from form_g1 and returning a tibble with the time and related MSD. The function plot_msd is available to visualise the output data.
``` {r second} msd <- form_msd(g1) head(msd) plot_msd(msd)
*The viscoelastic, storage and loss moduli*. The last stage is to determine the viscoelastic modulus (*G*) from the mean square displacement, which is then used to determine the related storage and loss moduli. The function *form_modulus* is used for this purpose, accepting the output from *form_msd* and returning a tibble with the time and related storage (*G'*) and loss (*G''*) moduli. The function *plot_modulus* is available for visualising the data resulting from the *form_modulus* function. ``` {r third} mods <- form_modulus(msd) head(mods) plot_modulus(mods)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.