detect_compression_cycles: detect_compression_cycles

View source: R/detect_compression_cycles.R

detect_compression_cyclesR Documentation

detect_compression_cycles

Description

Detects cycle of back-and-forth movement in texture Analyzer data

Usage

detect_compression_cycles(textureAnalyzerData,do_aggregation=TRUE)

Arguments

textureAnalyzerData

Data as read by read_texture_analyzer_tab

do_aggregation

Whether or not to do aggregation. If TRUE, aggregate by the Distance column within each phase ("up" or "down") in each of the cycles. Is set to TRUE by default

Details

The routine looks for up and down movements by analyzing the "Distance" column in the textureAnalyzerData data frame.

Value

The same dataframe that was passed to the function, with two supplementary (or overwritten) columns: "direction" indicates the current movement, "cycle" indicates the current compression cycle.

Author(s)

Thomas Braschler

Examples

# This is destructive testing on a classical (nanoporous) CMC gel, for illustration of the multi-cycle analysis
path = system.file('sampleData', package = 'textureAnalyzerGels');
sampleGel=detect_compression_cycles(read_texture_analyzer_tab(paste(path,"sampleDataMultipleCycles.tab",sep="/"),chuck_diameter=4e-3,aggregate_by=FALSE))

sampleGelSmooth = smooth_texture_analyzer_data(sampleGel,boundary_extension_mm=0.2,sd=0.0025)

cycle = 1

col=palette()[cycle]

plot(pressure ~ Distance, sampleGelSmooth[sampleGelSmooth$cycle==cycle ,],type="l",col=col,ylim=c(-750,1250),xlim=c(0,8),ylab="Stress [Pa]",xlab="Compression [mm]")


for(cycle in 2:max(sampleGelSmooth$cycle))
{
col=palette()[cycle]

lines(pressure ~ Distance, sampleGelSmooth[sampleGelSmooth$cycle==cycle ,],type="l",col=col,ylim=c(-500,1000))


}


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