afmContactPoint {afmToolkit} | R Documentation |

## Contact point

### Description

Find the contact point in for the Force-Distance curve following the local regression and two thresholds methods described in Microscopy Research and Technique 2013 (see reference).

### Usage

```
afmContactPoint(afmdata, width = 1, mul1, mul2, lagdiff = width, Delta = TRUE,
loessSmooth = FALSE)
```

### Arguments

`afmdata` |
A Force-Distance curve with the afmdata structure. It should be a list with at least the 'data' field with a data frame of at least 4 columns. |

`width` |
Width of the window for the local regression (in vector position units) |

`mul1` |
First multiplier for the first alarm threshold |

`mul2` |
Second multiplier for the second alarm threshold |

`lagdiff` |
Lag for estimating the differences in Delta (or slopes) signal. By default it takes the same value as the window with. |

`Delta` |
Logical. If TRUE, then the statistic for determining the contact point is the differences between two consecutive values of the slope of the local regression line. If FALSE then the slope itself is used. |

`loessSmooth` |
Logical If TRUE, a loess smoothing (via loess.smooth()) is done prior to the determination of the contact point. The span of the smoothing is 0.05 (5 approach segment. |

### Value

An `afmdata`

class variable which will consist on the original input
`afmdata`

variable plus a new list named `CP`

with the following fields:

`CP`

The contact point value.

`iCP`

The position in the array for the contact point value.

`delta`

The delta signal.

`noise`

The noise of the delta signal

### References

Benitez R., Moreno-Flores S., Bolos V. J. and Toca-Herrera J.L. (2013). "A
new automatic contact point detection algorithm for AFM force curves".
Microscopy research and technique, **76** (8), pp. 870-876.

### See Also

### Examples

```
path <- path.package("afmToolkit")
data <- afmReadJPK("force-save-JPK-3h.txt.gz", path = path)
width <- 20
mul1 <- 1
mul2 <- 10
data <- afmContactPoint(data, width = width, mul1 = mul1, mul2 = mul2)
## Not run:
plot(data, segment = "approach") + geom_vline(xintercept = data$CP$CP, lty = 2)
## End(Not run)
```

*afmToolkit*version 0.0.1 Index]