smooth_texture_analyzer_data: smooth_texture_analyzer_data

View source: R/smooth_texture_analyzer_data.R

smooth_texture_analyzer_dataR Documentation

smooth_texture_analyzer_data

Description

Smoothes the force and pressure curves using a gaussian kernel

Usage

smooth_texture_analyzer_data(theData, sd = 0.04,cycle_col="cycle",boundary_extension_mm=0.2,lm_region_lower_mm=boundary_extension_mm,lm_region_upper_mm=boundary_extension_mm,block_size=5)

Arguments

theData

Data for the force and distance relationship. Needs to have at least the columns "direction", "Distance", "Force" and "pressure"

sd

Standard deviation for the Gaussian kernel, in the same units as the Distance column

cycle_col

Column indicating compression cycles, for data analyzed by detect_compression_cycles. Defaults to a column named "cycle", but if this column cannot be found in theData, this argument is ignored

boundary_extension_mm

To correct for boundary effects, use linear extension beyond the measured region. This should be typically a few standard deviations sd

lm_region_lower_mm

Region used to establish the linear regression for the extension at the lower Distance values. Should be within the region where the gel is not touched

lm_region_upper_mm

Region used to establish the linear regression for the extension at the upper Distance values. This is a bit delicate to set, as a longer region is more precise, but the pressure vs. Distance line should still be reasonable straight.

block_size

For optimization of calculation time in the smoothing calculation, it is possible to carry out the smoothing block-wise. See gaussianSmoothingBlock and gaussianSmoothingSlopeBlock for details. Provide block_size=0 to avoid block-wise calculation during smoothing

Details

Calls gaussianSmoothing internally

Value

Variable of the same structure and values as the theData argument, with the following changes:
- Force column now contains smoothened values
- pressure column now contains smoothened values
-new column ForceSlope, which contains the smoothened, momentaneous slope (delta Force / delta Distance)
- new column pressureSlope, which contains the smoothened, momentaneous slope (delta pressure / delta distance)

Author(s)

Thomas Braschler

Examples

data(sampleGel)
plot(Force ~ Distance, sampleGel,type="l")
sampleGelSmooth=smooth_texture_analyzer_data(sampleGel, sd = 0.05,lm_region_upper_mm=0.05)
plot.xy(xy.coords(sampleGelSmooth$Distance,sampleGelSmooth$Force),type="l",col="red")

tbgitoo/textureAnalyzerGels documentation built on March 30, 2022, 4:53 a.m.