readEdfSignals: Reads signals from an EDF(+)/BDF(+) file

Description Usage Arguments Details Value Acknowledgement See Also Examples

Description

The function reads ordinary or annotation signals from an EDF(+)/BDF(+) file.

Usage

1
2
3
readEdfSignals(hdr, signals = "All", from = 0, till = Inf,
  physical = TRUE, fragments = FALSE, recordStarts = FALSE,
  mergeASignals = TRUE, simplify = TRUE)

Arguments

hdr

An ebdfHeader object read with the readEdfHeader() function.

signals

a vector with one or more of the following signal designations: 'All' (default), to include all signals; 'Ordinary', to include all ordinary signals; 'Annotations', to include all annotation signals; signal labels and/or signal names; or signal numbers (numeric or as character).

from

numeric, the time in seconds from which the signals shall be read.

till

numeric, the time in seconds till which the signals shall be read. The value may exceed the total duration of the recoding.

physical

logical, if TRUE (the default) digital samples values are mapped to their physical values, If not, the digital values are returned.

fragments

logical, if TRUE discontinuously recorded signals are stored as a list of continuous fragments. If FALSE (the default), a signal is stored as one numeric vector with NA values filling the gaps.

recordStarts

logical, if TRUE a data frame with the empty annotations with the data record start time will be included. If FALSE (the default), not.

mergeASignals

logical, if TRUE all annotations will be merged into one data frame. If FALSE there will be one data frame per annotation signal.

simplify

logical, if TRUE and if there is only one signal read, the signal itself is returned (in stead of a list with that signal as the only one element). If FALSE, this simplification is not performed.

Details

For ordinary signals the from and till parameters are interpreted as [from, till). For annotation signals from-till has to overlap the onset-(onset+duration) period. For for details see the package vignette.

Value

Either a list of one or more signals or a single signal.
The list of signals returned is of class ebdfSignals and a single signal object is of one of the following classes:

All classes have supporting print and summary functions. For object details see the package vignette.

Acknowledgement

This package has used code from:

See Also

edfReader, readEdfHeader
For the vignette use the console command:
vignette('edfReaderVignette', package = "edfReader")
or click on Index below.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Examples from the vignette
libDir <- system.file ("extdata", package="edfReader")
# a continuous recording
CFile <- paste (libDir, '/edfPlusC.edf', sep='')
CHdr  <- readEdfHeader (CFile)
CSignals <- readEdfSignals (CHdr)            # to read all signals
# read 3 differently designated signals from 5.1 till 18 seconds period
someCSignalsPeriod <- readEdfSignals (CHdr, signals=c(3, "5", "sine 8.5 Hz"), from=5.1, till=18)
someCSignalsPeriod                           # print the signals
summary(someCSignalsPeriod)                  # print singals summary
someCSignalsPeriod$`sine 8.5 Hz`             # print the `sine 8.5 Hz` signal
summary(someCSignalsPeriod$`sine 8.5 Hz`)    # print a `sine 8.5 Hz` signal summary
str(CSignals$`sine 8.5 Hz`)                  # look to the details
# a discontinuous recording
DFile <- paste (libDir, '/edfPlusD.edf', sep='')
DHdr  <- readEdfHeader (DFile)
DSignals <- readEdfSignals (DHdr, fragments=TRUE)    # to read all signals
DSignals$`sine 8.5 Hz`                       # print fragmented signal
summary (DSignals$`sine 8.5 Hz`)             # print fragmented signal summary
str(DSignals$`sine 8.5 Hz`)                  # look to the details

Example output

Start time            : 2009-12-10 12:44:02   
Ordinary signals: 
 Continuous recording : TRUE  
 Recorded period      : 20 sec 
 Period read          : 12.9 sec 
   from               : 5.1 sec 
   till               : 18 sec 
 Signals 
 R      name        transducer sampleRate preFilter samples 
 signal                              /sec                   
 1      pulse                         200              2580 
 2      noise                         200              2580 
 3      sine 8.5 Hz                   200              2580 
Start time            : 2009-12-10 12:44:02   
Ordinary signals: 
 Continuous recording : TRUE  
 Recorded period      : 20 sec 
 Period read          : 12.9 sec 
   from               : 5.1 sec 
   till               : 18 sec 
 Signals 
 R      EDF    name/label  transducer sampleRate preFilter samples 
 signal signal                              /sec                   
 1      3      pulse                         200              2580 
 2      5      noise                         200              2580 
 3      8      sine 8.5 Hz                   200              2580 
 R signal             : 3  
 Name                 : sine 8.5 Hz  
 Start time           : 2009-12-10 12:44:02   
 Continuous recording : TRUE  
 Recorded period      : 20 sec 
 Period read          : 12.9 sec 
   from               : 5.1 sec 
   till               : 18 sec 
 Sample rate          : 200 /sec 
 Number of samples    : 2580  
 R signal             : 3  
 EDF signal           : 8  
 Name / label         : sine 8.5 Hz  
 Start time           : 2009-12-10 12:44:02   
 Continuous recording : TRUE  
 Recorded period      : 20 sec 
 Period read          : 12.9 sec 
   from               : 5.1 sec 
   till               : 18 sec 
 Sample rate          : 200 /sec 
 Transducer           :   
 Range                : -1000 : 1000 uV  
 Prefilter            :   
 Bits per sample      : 16  
 Number of samples    : 2580  
Signal summary
   Min.   1st Qu.  Median    Mean    3rd Qu.  Max.   
 -99.9619 -70.695 0.015259 -0.229524 70.7256 99.9924 
List of 19
 $ signal        : num [1:4000] 26.4 50.9 71.8 87.6 97.2 ...
 $ startTime     : POSIXct[1:1], format: "2009-12-10 12:44:02"
 $ signalNumber  : int 8
 $ RSignalNumber : int 8
 $ label         : chr "sine 8.5 Hz"
 $ name          : chr "sine 8.5 Hz"
 $ isContinuous  : logi TRUE
 $ isAnnotation  : logi FALSE
 $ recordedPeriod: num 20
 $ totalPeriod   : num 20
 $ from          : num 0
 $ till          : num Inf
 $ start         : num 0
 $ fromSample    : num 1
 $ transducerType: chr ""
 $ sampleBits    : num 16
 $ sRate         : num 200
 $ range         : chr "-1000 : 1000 uV"
 $ preFilter     : chr ""
 - attr(*, "class")= chr "ebdfCSignal"
 R signal             : 8  
 Name                 : sine 8.5 Hz  
 Start time           : 2009-12-10 12:44:02   
 Continuous recording : FALSE  
 Recorded period      : 11 sec 
 Total period         : 20 sec 
 Period read          : whole recording  
 Sample rate          : 200 /sec 
 Number of fragments  : 6  
 R / EDF signal       : 8  
 Name / label         : sine 8.5 Hz  
 Start time           : 2009-12-10 12:44:02   
 Continuous recording : FALSE  
 Recorded period      : 11 sec 
 Total period         : 20 sec 
 Period read          : whole recording  
 Sample rate          : 200 /sec 
 Transducer           :   
 Range                : -1000 : 1000 uV  
 Prefilter            :   
 Bits per sample      : 16  
 Number of fragments  : 6  
Fragments summaries
 fragment   Min.   1st Qu.   Median     Mean    3rd Qu.  Max.   
        1 -99.8703 -65.2171  9.41482   3.73816  71.8242 99.9924 
        2 -99.8703 -65.2171  9.41482   3.73816  71.8242 99.9924 
        3 -99.9619 -70.695   0.015259  0.015259 70.7256 99.9924 
        4 -99.8703 -65.2171  9.41482   3.73816  71.8242 99.9924 
        5 -99.9619 -71.7937 -9.3843   -3.70764  65.2476 99.9008 
        6 -99.9619 -71.7937 -9.3843   -3.70764  65.2476 99.9008 
Whole recording
   Min.   1st Qu.  Median    Mean   3rd Qu.  Max.   
 -99.9619 -70.695 0.015259 0.353704 70.7256 99.9924 
List of 20
 $ startTime     : POSIXct[1:1], format: "2009-12-10 12:44:02"
 $ signalNumber  : int 8
 $ RSignalNumber : int 8
 $ label         : chr "sine 8.5 Hz"
 $ name          : chr "sine 8.5 Hz"
 $ isContinuous  : logi FALSE
 $ isAnnotation  : logi FALSE
 $ recordedPeriod: num 11
 $ totalPeriod   : num 20
 $ from          : num 0
 $ till          : num Inf
 $ start         : num 0
 $ fromSample    : num 1
 $ transducerType: chr ""
 $ sampleBits    : num 16
 $ sRate         : num 200
 $ range         : chr "-1000 : 1000 uV"
 $ preFilter     : chr ""
 $ fragments     :List of 6
  ..$ :List of 4
  .. ..$ start         : num 0
  .. ..$ fromSample    : num 1
  .. ..$ recordingStart: num 0
  .. ..$ signal        : num [1:200] 26.4 50.9 71.8 87.6 97.2 ...
  ..$ :List of 4
  .. ..$ start         : num 2
  .. ..$ fromSample    : num 401
  .. ..$ recordingStart: num 2
  .. ..$ signal        : num [1:200] 26.4 50.9 71.8 87.6 97.2 ...
  ..$ :List of 4
  .. ..$ start         : num 4
  .. ..$ fromSample    : num 801
  .. ..$ recordingStart: num 4
  .. ..$ signal        : num [1:1200] 26.4 50.9 71.8 87.6 97.2 ...
  ..$ :List of 4
  .. ..$ start         : num 12
  .. ..$ fromSample    : num 2401
  .. ..$ recordingStart: num 12
  .. ..$ signal        : num [1:200] 26.4 50.9 71.8 87.6 97.2 ...
  ..$ :List of 4
  .. ..$ start         : num 15
  .. ..$ fromSample    : num 3001
  .. ..$ recordingStart: num 15
  .. ..$ signal        : num [1:200] -26.4 -50.9 -71.8 -87.6 -97.2 ...
  ..$ :List of 4
  .. ..$ start         : num 19
  .. ..$ fromSample    : num 3801
  .. ..$ recordingStart: num 19
  .. ..$ signal        : num [1:200] -26.4 -50.9 -71.8 -87.6 -97.2 ...
 $ nSamples      : int 2200
 - attr(*, "class")= chr "ebdfFSignal"

edfReader documentation built on May 2, 2019, 3:43 p.m.