bursts.sort: Order a list of bursts by some function. For instance, popen.

Description Usage Arguments Value Examples

Description

Order a list of bursts by some function. For instance, popen.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)

scbursts documentation built on July 6, 2019, 5:02 p.m.