Title: | Itrax Data Analysis Tools |
---|---|
Description: | Parse, trim, join, visualise and analyse data from Itrax sediment core multi-parameter scanners manufactured by Cox Analytical Systems, Sweden. Functions are provided for parsing XRF-peak area files, line-scan optical images, and radiographic images, alongside accompanying metadata. A variety of data wrangling tasks like trimming, joining and reducing XRF-peak area data are simplified. Multivariate methods are implemented with appropriate data transformation. |
Authors: | Thomas Bishop |
Maintainer: | Thomas Bishop <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.12.2 |
Built: | 2025-01-25 04:19:26 UTC |
Source: | https://github.com/tombishop1/itraxr |
A dataset containing XRF, optical and radiographic images and metadata for ocean core CD166_19_S1. This is a subset of a more complete dataset available.
CD166_19_S1
CD166_19_S1
A list containing the following:
a tibble of scan variables
a list containing the optical image matrix and associated metadata
a list containing the radiographic image matrix and associated metadata
Bishop, Thomas; Charidemou, Miros (2023): Core Scanning Data from Core CD166/19. PANGAEA, https://doi.pangaea.de/10.1594/PANGAEA.955347
Calculates a correlation matrix for Itrax data results including normalisation and visualisation
itrax_correlation( dataframe, elementsonly = TRUE, zeros = "addone", transform = TRUE, plot = FALSE )
itrax_correlation( dataframe, elementsonly = TRUE, zeros = "addone", transform = TRUE, plot = FALSE )
dataframe |
pass the name of a dataframe parsed using |
elementsonly |
if TRUE, only chemical elements are included. If FALSE, the data is passed unfiltered, otherwise a character vector of desired variable names can be supplied |
zeros |
if "addone", adds one to all values. If "limit", replaces zero values with 0.001. Otherwise a function can be supplied to remove zero values. |
transform |
binary operator that if TRUE will center-log-transform the data, if FALSE will leave the data untransformed. Otherwise, a function can be supplied to transform the data. |
plot |
set to true if a biplot is required as a side-effect |
a correlation matrix object
itrax_correlation(CD166_19_S1$xrf, plot = TRUE)
itrax_correlation(CD166_19_S1$xrf, plot = TRUE)
Reads an Itrax image file and trims it according to the metadata provided.
itrax_image( file = "optical.tif", meta = "document.txt", plot = FALSE, trim = TRUE )
itrax_image( file = "optical.tif", meta = "document.txt", plot = FALSE, trim = TRUE )
file |
defines the name of the datafile to parse |
meta |
defines the relating metadata |
plot |
would you like to create a plot as a side-effect? |
trim |
defines custom trim parameters. The default behaviour uses the limits from the metadata file. Set the false for no trimming, or set the position limits by passing a two element vector. |
a matrix of RGB values, and the relevant data from the metadata file relating to the image.
itrax_image(file = system.file("extdata", "CD166_19_S1_optical_lowres.tif", package = "itraxR", mustWork = TRUE), meta = system.file("extdata", "CD166_19_S1_xrf_document.txt", package = "itraxR", mustWork = TRUE), plot = TRUE)
itrax_image(file = system.file("extdata", "CD166_19_S1_optical_lowres.tif", package = "itraxR", mustWork = TRUE), meta = system.file("extdata", "CD166_19_S1_xrf_document.txt", package = "itraxR", mustWork = TRUE), plot = TRUE)
Imports and parses data from a results file created by Q-Spec software, part of the Itrax core scanner.
itrax_import( filename = "Results.txt", depth_top = NA, trim_top = 0, trim_bottom = 0, parameters = "some" )
itrax_import( filename = "Results.txt", depth_top = NA, trim_top = 0, trim_bottom = 0, parameters = "some" )
filename |
defines the name of the datafile to parse |
depth_top |
defines the coring in depth of the top of the core, in mm |
trim_top |
defines the length of any trimming required of data at the top of the core, in mm |
trim_bottom |
defines the length of any trimming required at the bottom of the core, in mm |
parameters |
one of 'all' (leave all parameters), 'some' (remove some less useful parameters) |
a tibble of the parsed Itrax data
itrax_import( filename = system.file("extdata", "CD166_19_S1_Results.txt", package = "itraxR", mustWork = TRUE), depth_top = 0)
itrax_import( filename = system.file("extdata", "CD166_19_S1_Results.txt", package = "itraxR", mustWork = TRUE), depth_top = 0)
Join two or more Itrax datasets that have been parsed using "itrax_import()"
itrax_join(list)
itrax_join(list)
list |
a list of dataframes that are parsed Itrax result files — this should have been imported using |
a tibble of all the input data
itrax_join(list(core1 = CD166_19_S1$xrf, core2 = CD166_19_S1$xrf))
itrax_join(list(core1 = CD166_19_S1$xrf, core2 = CD166_19_S1$xrf))
Parses the "document.txt files"
generated from Itrax core scanners
itrax_meta(datafile = "document.txt")
itrax_meta(datafile = "document.txt")
datafile |
a |
a dataframe of all the parsed input data
itrax_meta(system.file("extdata", "CD166_19_S1_xrf_document.txt", package = "itraxR", mustWork = TRUE))
itrax_meta(system.file("extdata", "CD166_19_S1_xrf_document.txt", package = "itraxR", mustWork = TRUE))
Reads a colour calibrated Itrax image file and processes it to estimate Munsell colour.
itrax_munsell(image, proportion = 0.1)
itrax_munsell(image, proportion = 0.1)
image |
defines the name of the image file imported using 'itrax_image()'. It is essential that the image has been colour calibrated using a colour card or other method. |
proportion |
defines the width down the centre of the image to use for processing |
a table of values
## Not run: itrax_image(file = system.file("extdata", "CD166_19_S1_optical_lowres.tif", package = "itraxR", mustWork = TRUE), meta = system.file("extdata", "CD166_19_S1_xrf_document.txt", package = "itraxR", mustWork = TRUE), plot = FALSE) %>% magrittr::extract2(1) %>% itrax_munsell() %>% dplyr::slice_sample(n = 10) ## End(Not run)
## Not run: itrax_image(file = system.file("extdata", "CD166_19_S1_optical_lowres.tif", package = "itraxR", mustWork = TRUE), meta = system.file("extdata", "CD166_19_S1_xrf_document.txt", package = "itraxR", mustWork = TRUE), plot = FALSE) %>% magrittr::extract2(1) %>% itrax_munsell() %>% dplyr::slice_sample(n = 10) ## End(Not run)
Performs and visualises principle component analysis data from Itrax result data
itrax_ordination( dataframe, elementsonly = TRUE, zeros = "addone", transform = TRUE, return = "list", plot = FALSE )
itrax_ordination( dataframe, elementsonly = TRUE, zeros = "addone", transform = TRUE, return = "list", plot = FALSE )
dataframe |
pass the name of a dataframe parsed using |
elementsonly |
if TRUE, only chemical elements are included. If FALSE, the data is passed unfiltered, otherwise a character vector of desired variable names can be supplied |
zeros |
if "addone", adds one to all values. If "limit", replaces zero values with 0.001. Otherwise a function can be supplied to remove zero values. |
transform |
binary operator that if TRUE will center-log-transform the data, if FALSE will leave the data untransformed. Otherwise, a function can be supplied to transform the data. |
return |
if "pca" the output of |
plot |
set to true if a biplot is required as a side-effect |
either an output of prcomp()
, or a list including the input data
itrax_ordination(CD166_19_S1$xrf, plot = TRUE)
itrax_ordination(CD166_19_S1$xrf, plot = TRUE)
This is used to retrieve settings important elsewhere, for example the mca bin width and offset
itrax_qspecsettings(filename = "Results_settings.dfl")
itrax_qspecsettings(filename = "Results_settings.dfl")
filename |
the *.dfl settings file that relates to the rest of the data |
a tibble of the parsed data
itrax_qspecsettings(filename = system.file("extdata", "Results_settings.dfl", package = "itraxR", mustWork = TRUE) )
itrax_qspecsettings(filename = system.file("extdata", "Results_settings.dfl", package = "itraxR", mustWork = TRUE) )
Reads an Itrax radiograph file and trims it according to the metadata provided.
itrax_radiograph( file = "radiograph.tif", meta = "document.txt", plot = FALSE, trim = TRUE )
itrax_radiograph( file = "radiograph.tif", meta = "document.txt", plot = FALSE, trim = TRUE )
file |
defines the name of the datafile to parse |
meta |
defines the relating metadata |
plot |
would you like to create a plot as a side-effect? |
trim |
defines positions of the trim if required, input is a vector with min and max positions |
a matrix of RGB values, and the relevant data from the metadata file relating to the image. Also computes the aspect ratio of the image.
itrax_radiograph(file = system.file("extdata", "CD166_19_S1_radiograph_adj.tif", package = "itraxR", mustWork = TRUE), meta = system.file("extdata", "CD166_19_S1_rad_document.txt", package = "itraxR", mustWork = TRUE), plot = TRUE)
itrax_radiograph(file = system.file("extdata", "CD166_19_S1_radiograph_adj.tif", package = "itraxR", mustWork = TRUE), meta = system.file("extdata", "CD166_19_S1_rad_document.txt", package = "itraxR", mustWork = TRUE), plot = TRUE)
Reduces Itrax XRF data into arbitrary chunks using an arbitrary function. This is useful when making direct comparisons between the Itrax XRF data and some other data collected at a lower resolution.
itrax_reduce( dataframe, names = c(1:length(breaks_lower)), breaks_lower, breaks_upper, fun = mean, edges = c(">=", "<"), by = NULL )
itrax_reduce( dataframe, names = c(1:length(breaks_lower)), breaks_lower, breaks_upper, fun = mean, edges = c(">=", "<"), by = NULL )
dataframe |
defines the name of the XRF data to reduce, usually a itraxR::itrax_import like tibble |
names |
optional, a vector of the same length as 'breaks' |
breaks_lower |
a vector of the lower limit of each chunk |
breaks_upper |
a vector of the upper limit of each chunk |
fun |
the function to apply in order to reduce the data. Default is mean(), but sd() is also common |
edges |
a vector of length 2 with the upper and lower bound behaviour; can be any of '<', '<=', '>', '>=' |
by |
if contiguous samples of even sizes are required, 'by' defines the chunk size and will automatically generate 'breaks' |
a tibble with the same number of rows as 'breaks' and the same number of columns as 'dataframe'
itrax_reduce(dataframe = CD166_19_S1$xrf, by = 10)
itrax_reduce(dataframe = CD166_19_S1$xrf, by = 10)
Parses a folder full of raw spectra files from an Itrax core scanner and produces a spectral graph of all the data by position
itrax_restspectra( foldername = "XRF data", parameters = "settings.dfl", datapos = 37, depthpos = 6, plot = TRUE, trans = "pseudo_log" )
itrax_restspectra( foldername = "XRF data", parameters = "settings.dfl", datapos = 37, depthpos = 6, plot = TRUE, trans = "pseudo_log" )
foldername |
defines the folder where the spectra |
parameters |
optionally, defines the Q-Spec settings file from which to calculate the channel energies |
datapos |
defines the row at which spectral data begins in the files |
depthpos |
defines the row at which depth data begins is located in the files |
plot |
TRUE/FALSE, selects whether to create a plot as a side-effect |
trans |
transformation applied in the plot - see '?ggplot2::scales_colour_gradient()' for options |
a dataframe of all the spectral data
## Not run: itrax_restspectra("~/itraxBook/CD166_19_(2020)/CD166_19_S1/CD166_19_S1/XRF data")
## Not run: itrax_restspectra("~/itraxBook/CD166_19_(2020)/CD166_19_S1/CD166_19_S1/XRF data")
Performs a cluster analysis and automatic statistical grouping of parsed Itrax results data to n groups. Also provides information on the most "representative" (central) of each group. These can be used to develop a sub-sampling regime for calibration using another method.
itrax_section( dataframe, divisions = 30, elementsonly = TRUE, zeros = "addone", transform = TRUE, plot = FALSE )
itrax_section( dataframe, divisions = 30, elementsonly = TRUE, zeros = "addone", transform = TRUE, plot = FALSE )
dataframe |
pass the name of a dataframe parsed using |
divisions |
the number of groups to slice into - also the number of representative samples returned. |
elementsonly |
if TRUE, only chemical elements are included. If FALSE, the data is passed unfiltered, otherwise a character vector of desired variable names can be supplied. |
zeros |
if "addone", adds one to all values. If "limit", replaces zero values with 0.001. Otherwise a function can be supplied to remove zero values. |
transform |
binary operator that if TRUE will center-log-transform the data, if FALSE will leave the data untransformed. Otherwise, a function can be supplied to transform the data. |
plot |
set to true if a summary plot is required as a side-effect - the input dataset must have a depth or position variable - depth is used preferentially. |
the input data with additional columns 'group' and 'calib_sample', and possibly 'uid' if not supplied.
itrax_section(CD166_19_S1$xrf, plot = TRUE) itrax_section(CD166_19_S1$xrf %>% itrax_reduce(by = 10), plot = TRUE)
itrax_section(CD166_19_S1$xrf, plot = TRUE) itrax_section(CD166_19_S1$xrf %>% itrax_reduce(by = 10), plot = TRUE)
Sometimes it is helpful to read an individual spectral file for diagnostics
itrax_spectra(filename, parameters = "settings.dfl", plot = TRUE, datapos = 37)
itrax_spectra(filename, parameters = "settings.dfl", plot = TRUE, datapos = 37)
filename |
defines the name of the *.spe datafile from the core scanner to parse |
parameters |
optionally defines a relevant Q-Spec settings file in order to compute the energy scale, otherwise channel numbers are reported |
plot |
logical, if TRUE a side-plot is created |
datapos |
defines the row at which spectral data begins in the files |
a tibble of the parsed data
itrax_spectra(filename = system.file("extdata", "L000676.spe", package = "itraxR", mustWork = TRUE), parameters = system.file("extdata", "Results_settings.dfl", package = "itraxR", mustWork = TRUE) )
itrax_spectra(filename = system.file("extdata", "L000676.spe", package = "itraxR", mustWork = TRUE), parameters = system.file("extdata", "Results_settings.dfl", package = "itraxR", mustWork = TRUE) )