Skip to content

p-x9/swift-edf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

swift-edf

A Swift package for reading EDF(European Data Format) files.

Github issues Github forks Github stars Github top language

Usage

Load from file

Load an edf file as follows:

let path = "Path To EDF File"
let url = URL(fileURLWithPath: path)
letedf = try! EDFFile(url: url)

Header Information

Basic information about the entire file can be obtained via the header.

let header = edf.header
print("Version:", header.version)
print("Patient ID:", header.localPatientID)
print("Record ID:", header.localRecodingID)
print("Record Start:", header.recordingStartDate, header.recordingStartTime)

print("Header Record Size:", header.headerRecordSize)
print("Reserved:", String(tuple: edf.header._reserved))

print("Number of Records:", header.numberOfRecords)
print("Duration of Records:", header.durationOfRecord)

print("Number of Signals:", header.numberOfSignals)

Signal Metadata

To obtain information such as label names and units for a signal, write:

let column = 0
let info = edf.signalInfo(for: column)

// info.label, info.transducerType, ...

Read Signal Data

To obtain the signal of a column, write

let column = 0
let signal = edf.signal(for: column)

The signal is acquired as a two-dimensional array, the size of which is the number of records * the number of samples.

To retrieve only a specific record of a signal, use the following statement.

let column = 0
let index = 100
let record = edf.record(for: column, at: index)

License

EDF is released under the MIT License. See LICENSE

About

🫀A Swift package for reading EDF(European Data Format) files

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors