Skip to content

Interval-based analyses

Command Description
MEANS Signal means by annotation
PEAKS Detect and cache signal peaks
TLOCK Time-locked (e.g. peak-locked) signal averaging

MEANS

Calculates signal means conditional on annotations

Reports the means of signals during certain annotations, and optionally the mean values in the flanking regions just before and just after those annotations.

This command requires the signals to have similar sampling rates.

Parameters
Parameter Example Description
sig sig=C3,C4 Optional, one or more signals
annot annot=N2,N3 One or more annotation classes
w w=5 Flanking window (seconds) to consider before and after each annotation
by-instance Report means stratified by annotation class and instance IDs

Info

Note that the flanking regions are not checked for what annotation they contain: i.e. if there are contiguous annotations of the same class, then the flanking regions will contin the same annotation.

class instance start stop
 A     i1       10    20
 A     i2       20    30  <- 'flanking' regions for this are also 'A' 
 A     i3       30    40
 A     i4       40    50
 B     i1       50    60  <- flanking regions for this B are non-B
 A     i5       60    70

Output

Means by channel and annotation (strata: CH x ANNOT)

Variable Description
M Mean of signal for this annotation class
L Mean of all left-flanking regions (if w>0)
R Mean of all right-flanking regions (if w>0)

Means by channel and annotation class/instance (option: by-instance, strata: CH x ANNOT x INST)

Variable Description
M Mean of signal for this annotation class
L Mean of all left-flanking regions
R Mean of all right-flanking regions
Example

This command will typically be performed for a channel in which the mean value is interpretable, i.e. not raw EEG channels.

For example, using MEANS to get the mean 15-Hz wavelet power per sleep stage:

luna s.lst -o out -s 'CWT sig=C3 fc=15 cycles=7 & MEANS sig=C3_cwt_mag annot=N1,N2,N3,R,W'

PEAKS

Find peaks in signals

The command identitifies peaks (local minima and maxima) in signals, and caches those sample-points for use in subsequent commands, primarily TLOCK.

Parameters
Parameter Example Description
sig sig=C3,C4 Optional, one or more signals
cache cache=p1 Name of cache
epoch Perform by epoch
min Find minima as well as maxima
min-only Only find minima
clipped clipped=3 Do not count clipped regions as peaks, defined as 3 or more equal values
percentile percentile=10 Only take top P percentile of peaks
Output

No output; this command only stores peaks in a subject-specific cache object internally (i.e. they are available for this individual in subsequent Luna commands.

Example

See the example with TLOCK below.

TLOCK

Time-locked signal averaging

Given a set of points in a cache (e.g. as constructed by the PEAKS command or similar, calculate signal means that are synced to those points, plus/minus a fixed number of seconds.

Parameters
Parameter Example Description
sig sig=C3,C4 Optional, one or more signals
cache cache=p1 Cache name to use, e.g. generated by PEAKS or similar
w w=1.5 Window size (seconds)
tolog Take the log of the signal
phase phase=20 Assume signal is a phase (circular) and use this many bins to summarize
verbose Show the entire matrix (all points) rather than just averaging
np np=0.2 Normalization points, e.g. 20% of start/end of window
Output

Channel values by time-point (strata: CH x SEC)

Variable Description
M Signal mean at this time-point

Channel values by interval and time-point (option: verbose, strata: CH x N x SEC)

Variable Description
V Signal value at this time-point
Example

to be added