get_ccr_peaks: Identify peaks of a cross correlation curve

View source: R/peak.R

get_ccr_peaksR Documentation

Identify peaks of a cross correlation curve

Description

Given a comparison profile and a segment, get_ccr_peaks computes the cross correlation curve and finds peaks of the curve.

Usage

get_ccr_peaks(comp, segments, seg_outlength, nseg = 1, npeaks = 5)

Arguments

comp

a nueric vector, vector of the bullet comparison profile

segments

list with basis segments and their corresponding indices in the original profile, obtianed by get_segs()

seg_outlength

length of the enlarged segment

nseg

integer. nseg = 3: the third segment in segments

npeaks

integer. the number of peaks to be identified.

Value

a list consisting of:

  • ccr: the cross correlation curve

  • adj_pos: indices of the curve

  • peaks_pos: position of the identified peaks

  • peaks_heights: the cross correlation value (height of the curve) of the peaks

Examples

data("bullets")
land2_3 <- bullets$sigs[bullets$bulletland == "2-3"][[1]]
land1_2 <- bullets$sigs[bullets$bulletland == "1-2"][[1]]
x <- land2_3$sig
y <- land1_2$sig

segments <- get_segs(x, len = 50)

# compute ccf based on y and segment 7 with scale 1, then identify 5 highest peaks
ccrpeaks <- get_ccr_peaks(y, segments = segments, seg_outlength = 50,
                          nseg = 7, npeaks = 5)

cmpsR documentation built on July 18, 2022, 9:07 a.m.