EDF.jl

EDF.jl is a Julia package for working with European Data Format (EDF) and BioSemi Data Format (BDF) files, including reading, writing, and an intermediate representation for direct access to data.

Package API

Representation of Data

EDF.FileType
EDF.File{T,I<:IO}

Type representing an EDF file with samples encoded as values of type T, which is Int16 for EDF files and Int24 (internally defined) for BDF files.

Fields

  • io::I
  • header::FileHeader
  • signals::Vector{Union{Signal{T},AnnotationsSignal}}
source
EDF.FileHeaderType
EDF.FileHeader

Type representing the parsed header record of an EDF.File (excluding signal headers).

Fields

  • version::String: data format version
  • patient::Union{String,PatientID}: local patient identification
  • recording::Union{String,RecordingID}: local recording identification
  • start::DateTime: start date/time of the recording
  • is_contiguous::Bool: if true, data records are contiguous; is true for non-EDF+-compliant files
  • record_count::Int: number of data records in the recording
  • seconds_per_record::Float64: duration of a data record in seconds
source
EDF.SignalHeaderType
EDF.SignalHeader

Type representing the header for a single EDF signal.

Fields

  • label::String: the signal's type/sensor label, see https://www.edfplus.info/specs/edftexts.html#label
  • transducer_type::String: non-standardized transducer type information
  • physical_dimension::String: see https://www.edfplus.info/specs/edftexts.html#physidim
  • physical_minimum::Float32: physical minimum value of the signal
  • physical_maximum::Float32: physical maximum value of the signal
  • digital_minimum::Float32: minimum value of the signal that could occur in a data record
  • digital_maximum::Float32: maximum value of the signal that could occur in a data record
  • prefilter::String: non-standardized prefiltering information
  • samples_per_record::Int16: number of samples in a data record (NOT overall)
source
EDF.SignalType
EDF.Signal{T}

Type representing a single EDF signal with sample type T.

Fields

  • header::SignalHeader
  • samples::Vector{T}
source
EDF.AnnotationsSignalType
EDF.AnnotationsSignal

Type representing a single EDF Annotations signal.

Fields

  • samples_per_record::Int16
  • records::Vector{Vector{TimestampedAnnotationList}}
source
EDF.TimestampedAnnotationListType
EDF.TimestampedAnnotationList

A type representing a time-stamped annotations list (TAL).

Note that this type's constructor may attempt to round given onset_in_seconds and duration_in_seconds arguments to their nearest representable values in accordance with the EDF+ specification, which a) represents these values as ASCII, b) constrains these values to an 8 character limit, and c) does not allow the use of scientific notation for these fields.

See EDF+ specification for details.

Fields

  • onset_in_seconds::Float64: onset w.r.t. recording start time (may be negative)
  • duration_in_seconds::Union{Float64,Nothing}: duration of this TAL
  • annotations::Vector{String}: the annotations associated with this TAL
source
EDF.PatientIDType
EDF.PatientID

A type representing the local patient identification field of an EDF+ header.

See EDF+ specification for details.

Fields

  • code::Union{String,Missing}
  • sex::Union{Char,Missing} ('M', 'F', or missing)
  • birthdate::Union{Date,Missing}
  • name::Union{String,Missing}
source
EDF.RecordingIDType
EDF.RecordingID

A type representing the local recording identification field of an EDF+ header.

See EDF+ specification for details.

Fields

  • startdate::Union{Date,Missing}
  • admincode::Union{String,Missing}
  • technician::Union{String,Missing}
  • equipment::Union{String,Missing}
source
EDF.sample_typeFunction
EDF.sample_type(file::EDF.File{T})

Return the encoded type T of the samples stored in file.

source
EDF.is_bdfFunction
EDF.is_bdf(file)

Return true if file is a BDF (BioSemi Data Format) file, otherwise false.

source

The EDF+ specification introduced the notion of discontiguous signals, denoted with a value of "EDF+D" in one of the reserved fields; the EDF.FileHeader type notes this in a Bool field called is_contiguous. EDF.jl always stores signal data contiguously, regardless of whether the data records are declared to be contiguous, but, given an EDF.Signal, users of the package can construct a lazy iterator over non-overlapping chunks of a signal::EDF.Signal via:

Iterators.partition(signal.samples, signal.header.samples_per_record)

Reading

EDF.read!Function
EDF.read!(file::File)

Read all EDF sample and annotation data from file.io into file.signals and file.annotations, returning file. If eof(file.io), return file unmodified.

source
EDF.decodeFunction
EDF.decode(signal::Signal)

Return signal.samples decoded into the physical units specified by signal.header.

source

Writing

EDF.writeFunction
EDF.write(io::IO, file::EDF.File)
EDF.write(path::AbstractString, file::EDF.File)

Write file to the given output, returning the number of bytes written.

source