Code Monkey home page Code Monkey logo

edf's Introduction

Overview

An EDF parser written in coffee-script.

Primarily used for Polysomnographic signals, the EDF file format is multi-channel, supports multiple sampling rates on a per channel basis, and provides for an unlimited number of channels. More information can be found on the wikipedia article.

Usage and Examples

A simple Example

util	= require "util"
edf		= require "edf"

# Create a new instance of edf.EDFFile.
my_edf = new edf.EDFFile "./path/to/some.edf"

# Get some information about the file.
file_duration	= my_edf.get_file_duration( )
num_signals		= my_edf.get_header_item "num_signals_in_data_record"

util.log "The file is " + file_duration + " seconds in length."
util.log "There are " + num_signals + " signals in this file."

# Get some information about the signals.
for signal_index in [0..num_signals-1]
	signal_label	= my_edf.get_signal_item signal_index, "label"
	sample_rate		= my_edf.get_header_item( "duration_of_data_record" ) / my_edf.get_signal_item( signal_index, "num_samples_in_data_record" )
	min				= my_edf.get_signal_item signal_index, "physical_min"
	max				= my_edf.get_signal_item signal_index, "physical_max"

	util.log signal_label + " has a sampling rate of " + sample_rate + " Hz."
	util.log signal_label + " has a min and max of " + min + ": " + max  + "."

Available header information

The following items are available in the EDF header and can be accessed by using get_header_item.

  • version
  • patient_id
  • recording_id
  • start_date
  • start_time
  • number_of_bytes
  • reserved
  • num_data_records
  • duration_of_data_record
  • num_signals_in_data_record

These items are available using get_signal_item. A signal index must be passed along as the first argument.

  • label
  • transducer_type
  • physical_dimensions
  • physical_min
  • physical_max
  • digital_min
  • digital_max
  • prefiltering
  • num_samples_in_data_record

License

Three clause BSD. See LICENSE.

Thanks

Original work sponsored by Younes Sleep Technologies.

edf's People

Contributors

robertkeizer avatar

Watchers

James Cloos avatar Fedor Nezhivoi avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.