bursts.select {scbursts} | R Documentation |
From a list of bursts, extract those that interest you by passing a selecting function.
Description
From a list of bursts, extract those that interest you by passing a selecting function.
Usage
bursts.select(bursts, func, one_file = FALSE)
Arguments
bursts |
The list of all bursts |
func |
A function of a segment that returns either TRUE or FALSE |
one_file |
TRUE or FALSE: Return a single file to write to disk, or a list of bursts. The one_file will return a file with all unselected bursts zeroed out. |
Value
A shorter list of bursts OR if one_file is passed one segment with zeros where the other bursts might have been originally. Defaults to FALSE.
Examples
high_popen <- function (seg) {
segment.popen(seg) > 0.7
}
infile <- system.file("extdata", "example1_qub.dwt", package = "scbursts")
dwells <- dwt.read(infile)
dwells_c <- risetime.correct_gaussian(Tr=35.0052278, dwells, units="us")
bursts <- bursts.defined_by_tcrit(dwells_c, 100, units="ms")
subset <- bursts.select(bursts, high_popen)
# To export to one .dwt file
subset_f <- bursts.select(bursts, high_popen, one_file=TRUE)
[Package scbursts version 1.6 Index]