bursts.sort {scbursts} | R Documentation |
Order a list of bursts by some function. For instance, popen.
Description
Order a list of bursts by some function. For instance, popen.
Usage
bursts.sort(bursts, func, reverse = FALSE)
Arguments
bursts |
The list of all bursts |
func |
A function of a segment that returns a numeric value |
reverse |
By default, return in ascending order. Use reverse=TRUE to change that. |
Value
A list sorted by func. By default in ascending order (unless reversed)
Examples
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")
# A sorted list of bursts.
sorted <- bursts.sort(bursts, segment.popen)
# You can also write your own functions. If you want P(Open) =~ P(Closed)
variance_fun <- function (seg) {
# Any function that maps a segment to a number works.
return( segment.popen(seg) * segment.pclosed(seg) )
}
weird_sort <- bursts.sort(bursts, variance_fun)
[Package scbursts version 1.6 Index]