Updates, additions and fixes
Current stable version: v1.00 (main downloads page)
v1.00 (31-May-2024)
This major release contains a number of new analysis features as well as support for a Python interface to Luna, lunapi. It also contains a number fixes and smaller additions.
New interfaces
- a new lunapi Python package provides bindings to the Luna library; it also contains a number of convenience functions and an interactive viewer for signal and annotation data
New commands
-
new EDF-MINUS command to collapse gapped EDF+D whilst aligning records, stage annotations and epochs
-
new PCOUPL command for generic phase-event coupling
-
new SVD commad for time-series PCA via SVD
Annotations
-
the
ANNOTS
command now takesannot
classes to output only a subset (w/ wildcard character*
allowed to subset, in formroot*
only) -
date formats: two new options
read-mdy-annot-dates
andread-mdy-edf-dates
allow for non-European (month-day-year) format dates, instead of the default day-month-year (adopted as European Data Format files specify this convention). The first form relates to annotation files (`.annot); the second form relates to values in the EDF header (i.e. if they have been incorrectly specified). -
OVERLAP
now has option to output a shuffled set of annotations (given the full shuffling scheme - shuffle, event-based, constrained, background-filtered, etc): e.g.add-shuffled-annots=A1,A2
addss_A1
,s_A2
as new, shuffled versions ofA1
andA2
; the default tags_
can also be altered withadd-shuffled-annots-tag=s_
Epoch definitions
-
EPOCH now takes
fixed
andtrunc
; output givesFIXED_DUR
fromEPOCH
-
generic epochs can now be shifted left/right (backwards/forwards) using
shift
(-ve/+ve values) -
new
EPOCH
outputs:TOT_DUR
,TOT_PCT
,TOT_REC
,TOT_SPANNED
andTOT_UNSPANNED
-
added
SEGMENTS
largest annotation (largest1
), (largest2
) etc; the 1,2,3,... index is in the instance ID of the annotation (class =largest
); also, adding e.g.requires-min=120
enforces that largest segments must be at least 2 hours -- 1,2,3 is in INST ID
Spectral analysis
-
fixed
MTM
options; addedspeckurt
for fbins (MTM
) -
PSD
andMTM
now haveband
(=T
/F
) to drop band output altogether -
allow
skip-bands
(e.g.skip-bands=SIGMA,GAMMA,TOTAL
) forPSD
to omit certain bands from the output -
to support ISO analyses: PSD now has an
add
option to emit (currently 1Hz) values (requriesEPOCH dur=4 inc=1
andPSD segment-size=4
). This creates a new 1 Hz time-series in the EDF. -
COH
now allows generic epochs - as long as they are of fixed size (which requires addingfixed
along withannot
when applying theEPOCH
command)
Spindle/SO analyses
-
now
so-annots
(instead ofannots
) is needed to emit slow oscillation annotations (as is called by SPINDLES) -
SPINDLES
/SO
coupling issue fixed if a record is above epoch span
Data manipulation
COPY
allowsnew
to specify a full name (when used with a single channel);pretag
adds the tag to the front (better for[xx][1:8]
); also,tag
no longer adds"_"
in between, this must be explicitly specified, e.g.tag=_TAG
Scripting: filters and sequence expansions
-
all
sig
options allow[inc]
and[-exc]
matching:impliessig=C3,C4,F3,F4[F]
i.e. must match asig=C3,C4
C
character. This can be useful when working with larger sets and you want to select a subset ofsig=${s}
where${s}
may be a very large but structured list -
we now allow for more generic
[][]
expansion syntax, i.e.[seq1][seq2]
where the terms or sequences are either in the formn:m
(wheren
andm
are integers, withn
<=m
) or as a commad-delimited list. -
no nesting of terms if allowed, but they can be applied sequentially:
implies${s=[x][a,b,c]} & PSD [${s}][1:5]
Note: conditions are evaluated first, based on prior set variables; then line-by-line we evaluate a) swap in variables, wildcards,replace variables, b) expand sequencesxa1,xa2,xa3,xa4,xa5,xb1,xb2,xb3,xb4,xb5,xc1,xc2,xc3,xc4,xc5
-
fixed a bug that occurred when using
[n:n]
Misc. fixes and changes
-
added
output-both
option toCORREL
-
fixed
TOT_DUR_HMS
when >24 hrs inHEADERS
-
WRITE
now resets EDF start date if needed (i.e. when changing start time if collapsing to standard EDF) -
fixed the
ids=<list>
option (to swap in alternate IDs on reading a sample list), as it was previosly not working -
POPS
ignore-obs-staging
option is now fixed -
SIMUL
can zero-out frequencies above or below a certain value (i.e. after interpolation) withzero=lwr,upr
v0.99 (5-Dec-2023)
This release (leaping from v0.28 to v0.99 in a single bound) contains
a large number of incremental fixes and additions, as well as a few
more major features including: 1) automatically generated
hypnogram-based annotations, 2) reworked MASK
interface to simplify masks based on multiple annotations, 3) allowing
generic (variably-sized) epochs based on annotations, 4) a new
framework to implement model-based prediction given PSG-derived
features, in the PREDICT
command, also suppored
in Moonlight, 5) epoch-wise analysis using the mutlitaper command
MTM
, 6) ability to generate new
annotations conveniently on-the-fly based on pairwise contrasts of
existing ones, 7) the Moonbeam utility, that allows
NSRR data to be pulled directly into Moonlight (for NSRR users) and 8)
a prototype of a new utility for viewing hypnograms
(Hypnoscope).
Hypnograms
-
major: the
HYPNO
now has theannot
option, which adds a series of hypnogram-based annotations, e.g. that can be used in subsequent mask operations, or output, etc. -
HYPNO
epoch-level output now hasPRE
,SPT
, andPOST
flags (0/1) to reflect epochs that are pre-sleep, during the sleep period time, or post-slep; also, the base-level output has two new variables,PRE
andPOST
to give the recording time pre- and post-sleep (anchored on EDF/recording start/top times, rather than lights off, i.e. the difference betweenSOL
andPRE
is thatSOL
is defined relative to lights off. -
if a recording is entirely LightsOut (
L
stage annotation), then Lights Off and Lights On times will be now be correctly shown asNA
-
changed
HYPNO
FLANKING_MIN
toFLANKING
, which is now an epoch count -
fixed a minor issue when running with a gapped (EDF+D) recording: added new variables
TGT
(total gap time). Gaps count as missing and so do not enter the denominator for metrics (i.e. not inTRT
orTIB
). For cycle-level output,NREMC_MINS
includes gaps, whereasNREMC_N
does not include gaps. -
epoch-level elapsed time outputs are now encoded from the start of that epoch, i.e. 0 to N-1 rather than 1 to N
Prediction models
- major: initial implementation of a new
PREDICT
command
Moonlight
-
major: added a new Moonbeam feature to directly pull NSRR data into Moonlight for NSRR users
-
major: added a new Models tab to support model-based prediction of metrics, initially an estimate of adult "brain-age" based on the NREM sleep EEG, implementing a model described here
Hypnoscope
- an initial implementation of the Hypnoscope utility for viewing multiple hypnograms and generating hypnogram-based metrics
Signal processing
-
major: the
MTM
command now allows epochwise analyses (as well as segments within those epochs);epoch-spectra
/epoch-output
andsegment-spectra
/segment-output
control levels of epochwise and segmentwise outputs; renamedepoch-slopes
tosegment-slopes
-
MTM
now precomputes tapers, which greatly speeds up epochwise analysis -
added bandpower outputs for
MTM
(B
-stratified) -
added
kurt
/kurt3
options toPSD
, to give epoch-level kurtosis (of power averaged over channels) -
added
speckurt
/speckurt3
options toMTM
, to give segment-level kurtsosis (of power averaged over channels, within epochs if any epochs are specified). Also, added thealternate-speckurt
to support an alternate definition of these (only used for Sun et al model) -
added
ratio
/ratio1
options to bothPSD
andMTM
to give ratios of bandpowers for prespecifed pairs of bands;ratio1
impliesa/(1+b)
. -
both
PSD
andMTM
now allow setting user-defined power bands on the fly, e.g.PSD sigma=12-16
. (Previously, this could only be done as a special variable setting, which would be constant across all analyses.) -
added a new
PSD_CV
output (w/ bothdB
andsd
specified) for thePSD
command; this uses the calculation for coefficients of variation assuming log-normal data, i.e.CV=sqrt(exp(s^2)-1)
wheres^2
is the natural log-scaled variance. -
new more efficient cross-correlation
XCORR
implementation and new outputs
Artifact and alignment utilities
-
new
EDGER
command, designed to identify leading/trailing portions of recordings likely to be artifactual -
new
ALIGN-EPOCHS
command -
new
ALIGN-ANNOTS
command -
new
INSERT
command, with new FFT-based cross-correlation analysis to align signals from different EDFs and insert them, optionally adjusting timings
Filters:
-
FILTER
now accepts separate transition band widths (tw
) and ripples (ripple
) for the lower and upper edges of a Kaiser-window FIR filter, e.g. bytw=0.5,5
andripple=0.01,0.01
, corresponding to lower and upper edges respectively; the new filter is generated by convolution of two separate highpass and lowpass filters with those parameters. -
added
butterworth
andchebyshev
IIR filters to theFILTER
command -
added
ngaus
option toFILTER
to implement narrow-band filter via a frequency-domain Gaussian (parameters: frequency domain central mean and FWHM of the Gaussian,ngaus=11,2
) -
fft
is now the default forFILTER
Masks, epochs, freezes and caches
-
major: variable-sized ("generic") epochs are now supported by
EPOCH
, defined based on existing annotations: e.g.EPOCH annot=X
. In this context addingelse=Y
will generate a new annotation (Y
) which flags not being in an defined epoch (based onX
) but respects gaps. Multiple annotations are allowed:annot=A,B,C
. Labels are given to epochs in the output now. -
for either conceptual or practical reasons, not all command currently support variable-sized annotations (e.g.
COH
orHYPNO
) but this is flagged if attempting to run such a command in the presence of variable-sized (generic, annotation-based) epochs. -
major: reworked the primary
MASK
command to allow multiple annotations to be specified with implied OR / AND logic: e.g.MASK ifnot=N2,N3
. The type of logic can be controlled by explicitly specifyingifnot-any=N2,N3
orifnot-all=N2,arousal
to support OR versus AND logic respectively (the former is the same as the defaultifnot
). These are applied to all masks, e.g.mask-if
, etc, as described here. -
generic (annotation-based) masks can now use wildcards to complete annotation names:
MASK ifnot=artifact_*
-
new
MASK
syntaxifnot=+annot
means to match the epoch only if it is completely spanned by that annotation. (One cannot use both+
and*
symbols together, however.) -
added the option
EPOCH table
which dumps ouutput (same asverbose
) but does not change the epoch structure, i.e. it only gives output. The extra argumentmasked
will make thetable
output for both masked and unmasked epochs; theverbose
option also gives more output than previously -
the
CACHE
command has a newrecord
option, which can be used to pull any arbitrary outputs into the cache (e.g. for use with a subsequentPREDICT
command) -
the
THAW
command has a newpreserve-cache
option so that the cache is not over-written; i.e. it can be allowed to build up between successiveFREEZE
/THAW
operations -
the
RE
command has a newpreserve-cache
option, which does not wipe the cache when restructuring a dataset -
added a new
C2A
cache to annotation command
Annotations
-
major: added a new
MAKE-ANNOTS
command, to generate new annotations based on pairwise comparisons of existing ones (union, intersection, if overlapped, if not overlapped, using the syntaxA|B
,A*B
,A+B
andA-B
respectively); this also includes special behaviors if given the optionsepoch
,epoch-num
,flatten
orsplit
-
the
WRITE-ANNOTS
now acceptsprefix
to match w/ all annots starting with that; useful forprefix=h_
-
added
raw-annot
(andraw-annots
) to specify subset of annots to load - but unlikeannot
this does not apply sanitization first (if that is the global default) -
added
bins
andbins-label
options to theS2A
command: givenbins=min,max,n
to maken
bins of equal span, to make annotsB1
,B2
, etc...Bn
(orbins-label
instead ofB
)
Interval-based analyses:
-
the
OVERLAP
command now accepts*
wildcards in seed/other/fixed specifications to match annotsseed=sp*,so*
i.e. matchessp_15
,sp_11
etc -
the
OVERLAP
command now hascontrasts
,event-perm
,offsets
options. Now one should addseed-seed=T
to get seed-seed pairs; adding seed-seed pileup is now turned off by default, unlesspileup=T
is added -
the
OVERLAP
command now acceptsrp=<annot>|<tag>,...
to getrp_tag=xxx
from meta data for that annotation, in which case it will set a 0-duration time-point at that position
Spindle/slow oscillation detection:
-
added
COUPL_ALL
statistics toSPINDLES
, which performs spindle/SO analysis under both default (only using spindles that overlap a detected SO) andall-spindles
(calculatingCOUPL_ANGLE
andCOUPL_MAG
metrics based on all spindles); if theall-spindles
option is explicitly set, then these two sets are identical, and only a single set is reported). -
Slow oscillation output (
SO
/SPINDLES
commands) is changed: nowSO_SLOPE
is output by default instead ofSLOPE_NEG2
. The other slopes are only generated w/ theverbose
option. Additionally, it now doesn't output_neg
and_pos
halfwaves as annotations, but instead addsrp_mid
rp_pos
andrp_neg
as relative positions within the interval (scored 0..1); theOVERLAP
command is now able to use theserp
(relative position) terms. Finally,SO
annotations do not outputdur
now, onlyfrq
. -
SPINDLES
annotations (from theannot
argument) now addrp_mid
(as a 0-1 proportion) to indicate the mid/peak of the spindle, i.e. rather than in the old time-point based formmid=tp:123456789
-
the
SPINDLES
command has a newcache-peaks-sec
option -
SPINDLES
now gives a message iffc
is out-of-range givenq
. In this case, added the optionnoq
(i.e. equivalent to settingq=-999
) -
fixed the
SPINDLES
optionstratify-by-phase
to avoid double-counting
Minor additions and fixes
-
the
SEGMENTS
command now outputs the largest segment size (for an EDF+D w/ gaps); also, optionlargest=L1
adds an annotation spannong the largest segment calledL1
; in the case of ties, only the last will be added -
fixed bug in
EDF
- when forcing a standard EDF structure, this now updates the internal timetrack correctly, so that any subsequent call totimeline.wholetrace()
uses the correct time-points -
added
min
andmax
options toMINMAX
, to clip EDF physical min/max values; can specify both or either; other wiseMINMAX
sets allsig
channels to the be same PMIN/PMAX and DMIN/DMAX. Ifforce
is specified withmin
ormax
then that value is always set; otherwise, the physical min/max values are only changed if they are smaller, i.e. clipping, not expanding the min/max range -
channel locations are now populated by default if not otherwise specified (for a standard 64-channel 10/10 EEG only)
-
automatically sets any EDF header reserved field characters 5-44 to null (space) (also the first 5 chars if not
EDF+C
orEDF+D
) -
new
srand=XXXX
special argument to set the RNG seed -
added
REC_DUR_SEC
andREC_DUR_HMS
toHEADERS
which used to beTOT_*
. Now,TOT_DUR_SEC
andTOT_DUR_HMS
reflect the full duration, including any gaps (i.e. if an EDF+D) -
the
RESAMPLE
command has a newdownsample
argument: only channels with rates above thesr
value will be altered -
Luna can now correctly take
.edfz
and.edf.gz
files on the command line (versus from sample list) -
fixed issue with the
CPT
command when multiple classes of DV are specified; also added aall-dvars
(ordv=*
) option to select all named DVs from the DV files; also, can cluster based on time (T
) as well asF
,CH
,CH1
andCH2
; because of this,STAT
output variable is now the t-statistic, andT
means any time-level stratifier -
the
STATS
command has renamedMEDIAN.X
toX_MD
; also addedX_MN
-
STATS
has akurt3
to specify unadjusted kurtosis values (i.e. veresus excess values), such that X~N(0,1) has an expected value of 3.0, not 0; -
PEAKS
now output annotatons (annot
) as well as cache; can includew
to add window (sec) around each point
Interal changes/library upgrades
-
upgraded to Eigen library to 3.4.0
-
upgraded to sqlite library v3.41.2
-
reorganized some of the codebase, in particular, moving most TF-analyses into single
spectral/
folder
v0.28 (10-Apr-2023)
Moonlight
-
new interactive Moonlight viewer (public demostration host: http://remnrem.net)
-
extended tutorial that uses Moonlight to recapitulate the prior Luna/lunaR tutorials
Vignettes
-
new vignette on merging EDFs and working with EDF+D files
-
new vignette on how Luna expects time/date information in annotation files
Major new functionality
-
new
FREEZE
andTHAW
commands to make and revert to prior snapshots of the in-memory dataset -
new
TABULATE
option to summarize channels with discrete sets of values, e.g. body position -
new
MOVING-AVERAGE
command -
major improvements to
--merge
which can now handle gaps between consecutive files and will generate EDF+Ds -
new
add
option forMTM
to generate a new signal (with the same sample rate as the original); also,MTM
now outputs estimates of the spectral slope as well asPSD
andIRASA
. -
new
SET-TIMESTAMPS
utility command -
new
annot
option for theSEGMENTS
command; as demo'ed in this vignette, it is useful when making standard EDF from EDF+D files -
for
WRITE-ANNOTS
we now make as defaultno-specials=T
; i.e. add optionsspecials
instead ofno-specials
; and likewiseheaders
fromno-headers
. We've also addeddhms
andminimal
options. -
added
impulse
option to [SIGGEN
]( (T,A,D) andadd
not clear; makes new channle, or updates/replaces an existing one. -
new
REMAP
command to perform annotation remapping on _already-loaded_x data; -
new
EXE
optionrepresentative
to extract K examplar epochs via a clustering heuristic based on permutation distribution clustering
Minor changes/additions
-
added
starttime
andstartdate
command-line special variables to force EDF header changes (prior to attaching annotations) -
new
anon=T
special variable to set EDF headers to null values upon loading; this is similar to runnongANON
, althoughANON
allows a few extra options); as withstarttime
andstartdate
, this setting is enacted before attaching annotations (i.e. and so can influence how annotations are aligned) -
added support for dates in annotation files, e.g. dd-mm-yyy-hh:mm:ss, as illustrated in this vignette
-
added the
pct
option toSTATS
to avoid calculation of percentilespct=F
. Alsomin=T
will only give the mean. -
SOAP
now respects lights on (L
) epochs, i.e. unlike for missing (?
) epochs, it completely excludes them -
new
offset
option forWRITE-ANNOT
-
Luna now gives a warning message to the console if looking at an etnire signal (e.g. from
FILTER
) but some epochs are masked - i.e. as this means that those epochs will be included in that step (if not runningRE
beforehand to remove them) -
added
annot
feature toDUMP-MASK
to create annotation based on the mask (as well asoutput=F
andannot-unmasked=T
) -
added
file
option toRENAME
- takes a file of tab-delimited old/new channel name pairs instead ofsig
/new
from the command line -
added the
xbg
option to specify intervals to excise certain intervals from the background inOVERLAP
-
offset
option ofEPOCH
can now take hh:mm and hh:mm:ss arguments, as well as elasped seconds -
now gives an error if specified filename for a new EDF file (e.g. from
WRITE
) is the same as the input EDF. (This was allowed previously, but could cause problems and lead to corrupt outputs...) -
anchor
argument forSPINDLES
to specify between -1 and +1 for spindle start stop (0 = midpoint) for SO-coupling analysis. If not specified, default is the point of maximal CWT (i.e. typically, but not necessarily near the middle);offset=0.1
(-N ro +N seconds, default = 0) adds offset to above anchor for SO-coupling, i.e. can be combined withcouple
, i.e. look at SO phase and overlap 0.2 seconds before the start of a spindle; Gives newANCHOR
strata in output for coupling analyses. Can specify multiple anchor/offsets. -
EEG microstates
--label-maps
command now outputsand (will) add a message if match is not highest correl SPCID KT FLIP K1 MAPPED SPC . D 0 1 1 0.994548052142096 . C 0 2 1 0.972204262924326 . A 0 3 1 0.988131018834142 . B 0 4 1 0.996294406621555
OPTIMAL == 0
-
also, it now allows to matching on the minimum sum
(1-r)^p
wherep = 2
by default; this is now also the default stat forcompare-maps
(perm.) tests; addedverbose
option for info to the log -
for EEG microstate analysis, added a
grouped
option to allow A/a --> 'A' two-group mappings (i.e. case-invariant analysis, if K = 4 + 4 = 8
Misc. fixes
-
fixed issue with
ECG-SUPPRESS
when high sample rate used (insufficient smoothing -> no R-peaks detected) -
HYPNO
now outputs proper epoch time, i.e. if used EPOCH align so that epochs are not starting from 0; (as is, it assumes epoch 1 starts at 0 sec); also note thatMINS
is the elapsed time since epoch #1, not necessarily EDF start under these conditions -
annotation class/instance delimiter has been changed to have a default value of
:
(rather than/
as before) -
NSRR automatic-remapping is now turned off by default: enable with
nsrr-remap=T
; addedannot-remap
to separately control remapping of stage annotations -
automatic sanitization of annotation labels is now on by default
-
changed behavior of
keep-spaces
andsanitize
to be similar for both channel and annotation labels; also, labels are now always trimmed on both whitespace and sanitized insert character (underscore by default) -
stopped the
HEADERS
command from writing out EDF Annotation channels -
changed lunaR to attach EDF+ annotations on attaching an EDF+
v0.27 (27-Sep-2022)
In addition to multiple smaller fixes and modifications, this release contains a number of major new additions including: 1) revised macro-architecture summary statistics, 2) the SOAP and POPS tools for automated prediction/evaluation/manipulation of sleep stages, 3) new tools for assessing temporal coupling of annotation events, and 4) new signal processing tools including IRASA. Major changes are noted below:
Macro-architecture
-
revised and expanded hypnogram summary metrics, and improved documentation for the
HYPNO
command including: bout number/duration metrics, better incorporation of lights out markers, a heuristic to handle excessive leading/trailing WASO, revised calculation of total persistent sleep time (nowTST_PER
), renamed sleep efficiency/latency (SE
,SME
andSOL
), added final wake time (FWT
). -
added a new
annot-cycles
option forHYPNO
, to add an annotation indicating which NREM cycle an epoch belongs to -
fixed an issue when
HYPNO
is called twice on the same EDF -
added
first
(mins) andanchor
(T0
,T1
orT2
) options, to report hypnogram stats for only the first N minutes (setting the rest toL
); also, addedlast
(which takesT4
(default) orT5
orT6
as anchor values); also,clock
which, along withfirst
specifies an arbitrary anchor, based on the clock time; this may come before the EDF start; the variableSHORT
will be flagged if the requested window does not fully overlap the available staging -
added elapsed stage duration times, i.e. seconds after anchor that we see N minutes of N2 sleep, etc. If indiv does not have N mins of N2 sleep, a flag will be set; SS x DUR.. T and SHORT. Note that E_* epoch level output gives the elapsed duration at the START at that epoch; in contrast, this is indexed at the end...
-
fixed a bug impacting some of the elapsed time metrics from
HYPNO
(E_*
etc) if the recording started at or after midnight -
added and documented the new
SOAP
,REBASE
andPLACE
stage evaluation/manipulation commands -
added a new automated staging command:
POPS
- POPulation-based Staging that implements a flexible syntax for model specification. Internally, POPS uses Microsoft's popular open-source C/C++ LightGBM library for machine learning -
Internal: have depreciated the older (but still experimental) SUDS stager; previously, we had added some new features, including a canonical correlation based routine.
Data manipulation/handling
-
major new implementation and syntax for the
CANONICAL
command -
new
SET-HEADERS
command to directly edit EDF header values -
new
ENFORCE-SR
command -
new
fix-edf
option, to allow (i.e. ignore) truncated final records of a trivially corrupted EDF -
new
--merge
command to aggregate multiple EDFs -
the
--repath
utility now accepts.
as first character, meaning always append the second argument if (and only if) the sample list has a relative path -
new
SET-VAR
command to set individual-level variables from within a script -
new
RENAME
command to rename channels (unlike signal aliases, this command can accept variables) -
HEADERS
now outputsSTOP_TIME
-
added
pairwise
option toREFERENCE
-
new
RECTIFY
command -
new
REVERSE
command
Micro-architecture/signal processing
-
new
IRASA
command, to implement Irregular-Resampling Auto-Spectral Analysis -
new prototype/alpha implementation of detrended fluctuation analysis via the
DFA
command -
added Petrosian fractal dimension and permutation entropy (
pe
, withpe-m
andpe-t
options) toSIGSTATS
-
new prototype
ASYMM
command to evaluate (stage-specific) (regional) asymmetries (e.g. inter-hemispheric differences) in derived signal metrics -
new
Z-PEAKS
command to make annotations based on peak finding in signals -
added
segment-median
andsegment-sd
toPSD
-
added
precomputed
function toSPINDLES
-
added
ch-median
ch-epoch
ch-spatial-threshold
ch-spatial-weight
toCORREL
, which now also prints out disjoint sets of "high corr" channels (CHS
) -
added
OTSU
and--otsu
commands; changed Otsu implementation -
added the
--ftt
command -
added the
same-channel
option forTLOCK
to constrain output for whenCH
==sCH
Annotations
-
new
OVERLAP
command to evaluate enrichment of overlap/locality of annotations, in both single- and multi-sample contexts; it can also produce new annotations based on overlap with other annotations -
added the
collapse
argument forWRITE-ANNOTS
which can be used with an EDF+D if an EDF will be output (i.e. changes the times as if collapsing discontinuities) -
currently largely for internal development use, a new
A2C
command to convert sample points (ints) in annotation meta-data to a cache store -
EPOCH align
now works for EDF+D - will align the first epoch at the start of each segment, i.e. still assuming uniform epochs after that (within each segment) -
skip-edf-annots
now still reads time-track for EDF+D fromEDF Annotations
channels -
added the
numeric-inst
argument toA2S
, to set a signal to a numeric-valued instance ID (i.e. not just 0/1) -
when creating a set of epoch-level sleep stages, Luna will automatically detect if the stage annotation are 0-duration change-points (as is often the case in EDF+ stage annotations) and will extend those new signals up until the next stage annotaiton encountered (or the end of the recording)
-
alternatively, unless
assume-stage-duration=F
, if sleep stages have 0 duration (e.g. markers for change) assume they have the default epoch duration length (currently only for EDF+ embedded annotations) -
added the
add-ellipsis
option (for zero-duration annotations) -- this impactsWRITE-ANNOTS
.annot
format files only -
for EDF+ annotations, added
edf-annot-class
special variable, to make these annots classes (instead ofedf_annot_t
instanes) e.g.edf-annot-class=N1,N2,N3,R,W
Microstate analysis
-
the EEG microstates command
MS
has a neww
argument for--kmer
analysis, which performs local shuffling of microstate sequences (i.e. only within N states) -
the microstate
--kmer
command will now automatically splice out?
states, and reduce adjacent states to one e.g.AAA??AABBBCCC
->ABC
-
a new
--label-maps
command assign labels for a microstate mapsol
file, given a labelled canonical/templatesol
file (template, file, new) -
new
--cmp-maps
command to test for differences between maps, either at the group or individual (one versus all others) level, using a permutation procedure -
new
--correl-maps
to print spatial correlations for a map (from a text file)
Misc
-
added
--options
command to allow command-line functions to take args either from stdin OR from command line args (following --options) -
changed parameter parsing to include added signals when no
sig
specified (i.e. match all) in the case whensig
was specified as an initial, top-level special variable -
param files have
+group
and-group
flags. // +group include only if matches group, otherwise skip // -group exclude if matches group, otherwise parse -
IF
andIFNOT
(orENDIF
/FI
) -
fixed bug in within-record interval offset calculation for EDF+D when gaps present that are fractions of a record duration (i.e. and so record start time-points are no longer multiples of the EDF record size)
v0.26 (29-Nov-2021)
New functionality
-
TRANS
supports arbitrary transformations of signal data -
SIMUL
simulates time-series data given a power spectrum -
FFT
performs basic discrete Fourier transform (DFT) via the FFT -
HEAD
shows one epoch of data (requires same SR for selected channels) -
ZC
mean-centers signals, andROBUST-NORM
performs robust normalization (by median & IQR) -
upated the
EMD
(empirical mode decomposition) command -
--repath
convenience sample-list function -
prototype
ALTER
command to perform reference-channel, regression-based artifact removal -
peaks
andslope
options forPSD
andMTM
-
REBASE
, which adopts theSOAP
framework to (probabilistically) re-estimate sleep stages using a different epoch duration (e.g. to translate from 20-second manually scored datasets to 30-second epochs) given a) manual staging in the original epoch duration, and b) one or more signals (i.e. EEG) that are expected to encode sleep stage information well (i.e. have a high kappa from the originalSOAP
command).
Annotation format modifications/extensions
-
.annot
format now allows key=value meta-data to be specified; also, you can have fewer meta-data terms than expected (but not more), assuming order is as header; all fields still are required to be in the header; now WRITE-ANNOTS always writes meta-data as key=value pairs -
new
+
and-
options to turn on/off @includes (e.g.alias
,remap
); note, the variable must be specified before the relevant @include on the command line, i.e. as command-line arguments are processed in left-to-right order -
added a check for pipe (
|
) characters in annotation primary names (in aremap
) -
annotation times can now include AM/PM modifiers (otherwise assumes 24-hour clock)
-
new
annot-whitelist
option, such that annotations are only accepted if they appear in theremap
list (either as aliases or primaries); -
new
annot-unmapped
option to skip if the annotation is on the whitelist (i.e. complement of behavior withannot-whitelist
alone) -
if remapping an annotation to
ABD/DEF|XYZ
form (i.e. with a/
delimiter) then for the classXYZ
, it is set toABC
and instance ID is set toDEF
. If there was an existing instance value (non-null), a text meta-tag of_inst=
is added. The delimiter character can be changed from/
withclass-inst-delimiter=X
(although this only works for annot files currently, and is not generally recommended, i.e. as sanitization of labels respects/
for annotations, etc) -
added
combine-annots
option to merge class and instance identifiers. It accepts a character argument but is_
by default ); this sets the annotationclass
toclass_inst
(and setsinst
to '.' ) -
added the
skip-sl-annots
option to skip all SL-attached annotations; i.e. if wanting to only load annotations from an alternate, explicitly referenced annot file -
added the
interval
option to theEVAL
command, to generate new interval-level annotations based on eval expressions
EEG microstates
-
MS
has newadd-spc-sig
option to add spatial correlations as new EDF channels (instead of 0/1 binary variable, as peradd-sig
) -
MS
has newcanonical
option to specify a file definining canonical microstates -
MS
solutions now always have a header row; you cannot extract based on sol=file,A,B,C,D; also, 'unassigned' states are labeled 1,2,3, etc not A,B,C,... -
new
--cmp-maps
command to compare (spatial correlation) EEG microstates -
--kmer
command takes optionsreq-len
(only analyse first N sequences) andindiv-enrichment
Other fixes, minor modifications and new features
-
added ability to specify an empty EDF (
--nr
,--rs
and filename equals '.' ) -
added 1st, 2nd, 5th and 10th percentiles to
STATS
-
added transition frequency to slow oscillation output (
SPINDLES
,SO
) -
fixed bug in
flanked
mask option (e.g.flanked=W,1
) -
made
CANONICAL
definition file format more flexible: 1) it now allows whitespace, not just tab-delimitation; 2) only the first three fields are required now; if not given, the latter fields/columns will be set to.
; 3)CANONICAL
now respects the order of canonical signals (i.e. rather than processing things alphabetical); this allows multi-stage definitions, e.g. to first mapS1
, thenS2
, and then apply a rule such asS3 = S1 - S2
. -
eval syntax takes
{
and}
instead of'
to delimit strings; it allows nesting, but can also be handy on the command line (i.e. if already using-s ''
form) -
added
drop
andkeep
options to thePSC
command -
added
import=file.txt
command to [CACHE
]( to read from destrat output; can takefactors
andv
param (as well as requiredcache=
) -
added
MASK epoch=all
to set a MASK but have it all empty ; i.e. to trim records not in an epoch -
(for
.annot
only) addedalign
option : given list of annots (or *) for all, align-annots-on=N1,N2, etc... if not specified, find first instance of this annot, then align with 1 second boundary (oralign-annots-res=X
if given) align /all/ annots with this offset (bound at 0); i.e all records beforehand will be skipped if subsequentMASK
/WRITE
commands are applied -
added
pick
option toSIGNALS
to pick first of pick=a,b,c that is present, and drop the rest; can map with 'rename' to rename the pick -
allow sample-lists to have a comma-delim list of annotations, or '.' to denote no data; in this way, we can have a fixed width sample list (i.e. three tab-delimited columns), making it easier to parse (case in point: lunaR
lsl()
was broken if fewer than 3 columns were found after first five rows, reflecting how Rread.table()
works) -
CANONICAL
does not now need an explicit GROUP to be specified; the file must still have a first col, it is just ignored now; also, new 'drop-originals' option to drop all original (non-CANONICAL) signals after making the new signals; matches case-insentive -
changed
epoch-check
to accept number of.eannot
epochs that are different from expected; default is 5; only stops is absolute greater than this; otherwise writes warning to log; i.e. set to 0 for an exact match -
CONTAINS
can now skip to the next EDF (rather than alter the return code), if the optionskip
is given -
check for whether an ID contains the ID-wildcard character (by default, ^) and reports an error if it does; added the
wildcard
option to specify an alternate character
v0.25.5 (24-May-2021)
Major new functionality
-
Major changes to the epoch-wise artifact detection via
SIGSTATS
, which is now implemented via theCHEP-MASK
andCHEP
commands, as illustrated in this vignette -
Significant speed improvements for spectral analyses (
PSD
and especiallyMTM
) and other (e.g.PSC
,SUDS
,ICA
,CPT
) commands through code refactoring, tweaking our use of FFTW and the incorporation of the Eigen matrix library -
A beta-version of our new Luna-powered NAP (NSRR Automated Pipeline) cloud-based portal, described here, and available for testing from this URL http://remnrem.net/nap/ populated with public Sleep-EDF dataset.
-
Principal spectral components analysis via the
PSC
command -
Phase slope index connectivity via the
PSI
command -
Epoch-wise spherical spline interpolation via the
INTERPOLATE
command -
Independent components analysis via the
ICA
andADJUST
commands -
EEG microstate analysis via the
MS
command -
Time-series clustering of epochs and/or channels via the
EXE
command -
Cluster-based non-parametric linear models for association analysis via the
CPT
command
Other new commands/functionality
-
added
DUPES
command to find flat signals and digital duplicates -
Added
cache-metrics
options forPSD
,MTM
,COH
,PSI
,SPINDLES
andSO
(i.e. primarily for use with thePSC
command) -
SO
caches negative peaks (with thecache
option) -
New
MEANS
command to give signal means conditional on annotations -
New special variables describing topographical EEG 64-channel groups, e.g.
${anterior}
,${midline}
, etc, -
Find peaks in signals and subsequently produced peak-locked averages across other channels, via the
PEAKS
command and theTLOCK
command -
Cross-correlation and phase synchrony metrics, via the new
TSYNC
command -
New
A2S
andS2A
commands to convert anntotations to binary EDF signals channels, and vice versa -
Restructure EDFs to align records, annotations and epochs via the
ALIGN
command -
Added the
EDF
command to convert EDF+C and EDF+D to standard EDF -
Added the
LINE-DENOISE
command, using spectrum interpolation to reduce line noise -
Added the
SEDF
command to produce thumbnail-like summary EDFs (to be used in future NAP iterations) -
Added a simple
SIGGEN
command to generate test signals (currently only sine waves) -
Added the
CONTAINS
command that indicates (via Luna's exit code) whether one or more signals are present in the EDF (i.e. helps guide programmatic driving of Luna pipelines, to be used in future NAP iterations) -
new output/options for the
HYPNO
command: 1) stage transition counts and probabilities, withPRE
andPOST
factors; also with conditional probabilitiesP_PRE_COND_POST
andP_POST_COND_PRE
; 2) it now outputs epoch-level stage transition information in full and with different naming scheme:TR_NR2REM
, etc andTOT_NR2REM
. 3)FLANKING_MIN
andFLANKING_ALL
instead ofFLANKING_SIM
; 4) optionflanking-collapse-nrem
(default T), i.e. flank based on any NREM stage (1, 2 or 3) 4) optionreq-pre-post
, to only consider stage transitions that haveFLANKING_ALL
>=x
for thePOST
stage; defaults to 4 (2 mins). Added 'CONF' andOTHR
outputs.
Minor modifications/fixes
- the
epoch
argument ofMASK
acceptsend
as the final epoch number -
added the
force-edf
andEDF+D
options toWRITE
to force writing as EDF (or EDF+D); this command also now properly supports EDF+C, EDF+D files properly (e.g. in how the EDF start time is changed, etc) -
one can now add generic canonical signals via
CANONICAL
; it will not change theSR
if set to missing (.
); the canonical signal definition now includes units -
channel types now include specific reference and independent component types; further, channel type variables are now automatically updated after adding new channels (e.g. added
IC
to types; when channels added, now they are typed (i.e. the variable is updated by any commands that add channels, ICA --> ${ic} will be available afterwards to match on IC_1, IC_2, etc). -
we now allow
.eannot
to be attached with EDF+C but not EDF+D files -
SPINDLES
now has anannot
function to generate an internal annotation track (which should be used byWRITE-ANNOTS
but can also be used by, e.g.TLOCK
, etc. The oldftr
format is now retired. -
all commands that use epoch-level sleep stages (
SOAP
,HYPNO
,STAGE
, etc) will note if an epoch has multiple spanning stage annotations (i.e. which might happen if stages and epochs are not temporally well-aligned); it now reports tjeCONF
variable describing the overlap -
fixed an issue in selecting ranges when annotations do not align with sample points (fixed for continuous EDFs; need to check whether EDF+D requires additional tweaks)
-
added the
epoch
option toHYPNO
, which now give less verbose output by default -
added
offset
andalign
toEPOCH
-
added
annot
output for theSOAP
command -
added a
regional
MASK which masks epochs surrounded by masked epochs -
added
annot
,hms
andno-specials
options toWRITE-ANNOTS
-
added date-time support for annotations (in clocktime_t) and
dhms
flag forWRITE-ANNOTS
-
added test for non-integer sample rates
-
now the
HEADERS
command respects thesig
option; also, some changes to variable output names -
fixed the
mkdir
system call duringWRITE
for the Windows platform -
the
ANON
command now conforms with EDF+ specifications for the null ID -
added the
root
option to theANON
command, to specify "dummy" IDs, in the formroot_N
whereN
is 1, 2, 3, etc. As theN
count is always from 1 for a given run of luna, this can be inconvenient if splitting a sample-list and running in parallel: thus theids
option as above is also given. -
added the
ids
command-line option to supply an ID mapper [ old -> new , tab-delim file ]; this can be used with theANON
to set the EDF header IDs -
--build
has an option to add quotes around file paths if they contain spaces -
the
CLOCS
command now has an optionverbose
, to dump pairwise channel distances -
multiple changes to the
.annot
file format: allow durations (+seconds); allow hh:mm:ss elapsed time (0+hh:mm:ss offsets); allow fractional seconds in hh:mm:ss specfication; added channel labels and six-column format (but allowing reduced 3-col and 4-col formats for backwards compatibility); headers now optional; allow space/tab or tab-only delimiters; fixed an off-by-one-time-point glitch with clocktime specification; now fully allow 0-duration annotations [a,a); allow...
in the stop field to read until the start of the next; in all imports, times are scalled to 1/1000th second resolution to avoid floating-point nastiness to cause too much trouble; addedsep-dp=N
option to control the decimal place in.annot
outputs; -
added
fac
instead ofbin
for PSD (but, in general, removing support/documentation around this). -
for
SIGNALS
command, added thereq
option to require that specified signals are present/kept; in contrast, the originalkeep
option now will not complain if a requested signal is not present (i.e.keep
implies keep if present) -
added the
id
command-line option, so that a numeric ID can be specified (i.e. and not be interpreted as a sample-list line number) -
added a
min
option toEPOCH
, which gives minimal output: just the epoch count to standard output -
added a
dump
option toSTAGE
to write stages to standard out (i.e. parallelseannot
option, but does not write to a file) -
added
guess
(andeeg
) options to theCANONICAL
command, to guesscsEEG
without a file/group specified
Internal
-
added
cache_t
forPSC
commandSPINDLES
/SO
, and [in flight] adding aCOUPL
command to separate out spindle/SO detection from coupling analyses -
trims trailing whitespace from the physical dimension and transducer type fields in the EDF header; this was already done for channel labels
-
swapped in functions and classes from the Eigen matrix library for many numerical intensive procedures
-
added a runs test to the stats helper function library
v0.24 (22-August-2020)
New commands
-
ALIASES
command to list any channel/annotation aliases done for that individual -
MINMAX
command to set EDF header digital/physical min/max to same values across multiple channels -
TYPES
command and accompanying optionsch-match
,ch-exact
andch-clear
, which groups channels by types (e.g. EEG, EMG, respiratory effort, etc) and defines correspondong automatic variables (e.g.${eeg}
and${emg}
); theHEADERS
command now also outputs aTYPE
field -
CANONICAL
command to generate canonical signals,cs_EEG
,cs_LOC
,cs_ROC
,cs_EMG
andcs_ECG
-
VARS
command to output all variables defined for a given individual (designed to be paired with the new individual-level variables feature, via thevars
option) -
CC
command for connectivity and coupling statistics -
ACF
command to calculate signal autocorrelation
New options/behaviors for existing commands
-
added
SENS
andPOS
variables toHEADERS
channel-level output -
added
flat
andmax
options toSIGSTATS
-
CWT-DESIGN
now outputs FWHM in time and frequency domains, and accepts newer FWHM-basewd specification (instead of cycles); see this manuscript -
added the
wrapped
andfwhm
options toCWT
-
added the
fft
option toFILTER
for FFT convolution -
FILTER
andFILTER-DESIGN
can now read a FIR from afile
; also, instead of Kaiser windows to design a FIR, one can now fix the filter order and specify the type of window (e.g. Hamming, Blackman, etc) -
added a
new
option for theREFERENCE
command, and the ability to specify.
as a reference (i.e. to do nothing, to facilitate automatic processing) -
added summaries to
CORREL
, and improved the speed of this command -
allow now a comma-delimited list when defining stage labels for
STAGE
andHYPNO
, e.g.N1=n1,NREM2
-
added
epoch
andper-spindle
options to theSPINDLES
, making this level of output optinal, and omitted by default (i.e. forE
xF
xCH
andN
xF
xCH
) -
new added
cstats
andastats
options forSIGSTATS
-
added the
channels
option to theDESC
command (to write a simple list of all channel labels to standard output) -
the
ANNOTS
command now outputsSTART_HMS
/STOP_HMS
andSTART_ELAPSED_HMS
/STOP_ELAPSED_HMS
underANNOT
xINST
xT
output strata, which are the hh:mm:ss version of clock-time and elapsed time since EDF start, respectively
Other changes
-
default log output is now less verbose (unless
verbose=1
set) -
small fixes in processing EDF fields: the reserved field is now set to space (rather than null) characters; also, all EDF header fields (including the reserved field) are now checked for being within the 7-bit US-ASCII range 32-126 (any character outside this range is changed to a
?
character) -
changed behavior to replace spaces in channel names with underscore (
_
) characters for ease of processing; setting thespaces
variable can specify alternate replacement characters;keep-spaces
option, if true, means that spaces are retained -
added support for individual-level variables to be loaded from a file (via the
vars
option) -
added automatic special variable
${id}
, which can act in the same manner as the^
special character in scripts, i.e. to represent the current EDF ID -
added the
add=
option to turn on/off conditional blocks -
added a check that any variable defined in a script does not clash with a special variable (i.e. command line option).
-
added
include={file list}
option, to mirrorexclude={file list}
(nb. you cannot have both exclude and include) -
Luna can now read gzipped (compressed) ASCIIs directly
-
added a check that named
TAG
s do not clash with existing, internal tags, e.g.F
orCH
-
fixed an issue with 0-duration annotations, e.g. as may occur with marks from
EDF Annotations
channel -
fixed an issue with the
ANNOTS
command not reporting all output if theEPOCH
command hadn't been explicitly called first -
Luna now explicitly gives an error message if trying to use an
.eannot
file (ore:1
notation in an.annot
file) with EDF+ (i.e. which may be discontinuous). That is, if the input file is an EDF+, Luna requires annotation formats with exact times (i.e. either seconds elapsed since the start of the EDF, or hh:mm:ss format). -
added EDF+ Annotation parsing; Luna now reads all
EDF Annotations
events as an annotation track, which is automatically combined with any other annotations (e.g. from XML or.annot
files). Currently, all annotations have the classedf_annot
, which values are instance IDs/label. -
added new options to force/skip annotations:
force-edf
,skip-annots
,skip-edf-annots
andskip-all-annots
. -
added support for using braces
{
and}
instead of'
to denote string literals in eval expressions (i.e. which can be convenient if writing expressions on the command line with-s
where'
is already used) -
changed formatting of
-t
text table file names; added--tt-prepend
and--tt-append
options (equivalently,--tt-prefix
and--tt-suffix
) -
SPANNING
now works on EDF+D files -
HEADERS
now reportsEDF_TYPE
v0.23 (15-Jan-2020)
-
new help function (
-h
command line argument), to list commands, parameters and their output tables/variables -
new spindle/slow oscillation coupling permutation option and output variables
-
provisional support for text-table output mode with
-t
option, optionally writing gzipped text (with corresponding lunaRltxttab()
function -
new option to read data from a plain text file rather than an EDF
-
automatically generate sample lists with a new --build option, i.e. to recursively find all EDFs and match annotation files in a set of folders
-
added support to read and write compressed EDF files, via the EDFZ format, as highlighed in this vignette
-
new scripting features: command files now allow conditional clauses, via the
[[var
syntax, within-script variable definitions, via the${var=xyz}
syntax, and expanding numeric sequences, e.g.[ICA][1:10]
expands toICA1,ICA2,ICA3,...
-
new
SEGMENTS
command to show contiguous time intervals within a discontinuous EDF+ -
can now write EDF+ files
-
new experimental commands for multi-channel EEG:
CLOCS
(to read channel locations),CHEP
(channel/epoch masks),INTERPOLATE
(to interpolate missing channels/epoch based on spherical splines),SL
(to compute the surface Laplacian), andICA
(implementation of the fastICA algorithm). -
added individual-ID wildcards in the specification of output database names (
-o
or-a
), i.e. to write to a separate database for each EDF/individual, e.g.-o path/to/out-^.db
-
COH
performance has increased, and it now reports imaginary and lagged coherence; also, can acceptsig1
andsig2
parameters to more flexibly specify which pairs of channels are considered -
the
CHS
output factor is now split into two separate factors,CH1
andCH2
, forCOH
CORREL
andMI
-
added
SPANNING
command to report on "coverage" of an EDF by one or more annotations -
added special variables
silent
to turn off all console logging -
added
--xml2
command line option for verbose view of XML tree -
removed the
skip-annots
special variable; replaced with two new variables:skip-edf-annots
andskip-all-annots
-
the
MASK
epoch
andmask-epoch
parameters can now take comma-delimited lists of ranges, e.g.epoch=1,6,8-10,22
-
changed the behavior of
assume-pm-start
; it is now off by default, and accepts a time parameter to define whether ambiguous times are assigned AM or PM values -
added
START_TIME
,START_DATE
and (optionally)SIGNALS
output variables to theHEADERS
command -
now make new, unique labels for any duplicate channel labels found in an EDF (e.g. EEG, EEG.1, EEG.2, etc) and writes a message to the log
-
now check whether the same channel alias points to more than one channel, and if so, will give an error message
-
can now use hh:mm:ss clock-time format in
.annot
files (assumes 24 hour; requires start & stop specified) -
changed clock-time format from
hh:mm:ss
tohh.mm.ss
for compliance with the EDF spec; Luna can still read clock-times with the colon-delimiter however -
new mode (
-a
instead of-o
) to append to, rather than overwrite, output databases -
fixed an issue with the
MTM
command'sepoch
option, when used with multiple signals -
fixed issue with command parameters not being recorded in the output database
-
added the
nsrr-remap
option to turn off auto-remapping of NSRR annotations -
new
RECS
andSEGMENTS
commands to dump basic EDF record and interval info to stdout -
added a
fail-list
option [note: need to check implementation] -
fixed issue with
ANNOTS
where an annotation was flagged as overlapping a region/epoch is it ended exactly 1 time-unit beforehand (i.e. ignored convention that intervals are internally represented as [start] to [one past the end] of the interval).
v0.22 (31-March-2019)
Initial public release.