npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

edfdecoder

v0.1.2

Published

Decode EDF (European Data Format) files in pure Javascript for Node and browser

Downloads

106

Readme

npm install --save edfdecoder

This project is a EDF file decoder in Javascript, for browser and NodeJS. Due to the lack of standard format in the world of electroencephalogram (EEG), EDF progressively took that seat, even though it is limited and far from perfect. Thanks to its simple specification, the EDF format is also used in many other bio-medical fields, not only EEG.

It is important to mention that two format are labeled EDF:

  • The regular EDF format (link)
  • The extended EDF+ (link)

This parser is NOT compatible with EDF+.

[DOCUMENTATION]
[DEMO READING] [DEMO PLOTTING]

Get started

To run the EdfDecoder you need a .edf file. Then, you have to run a procedure to get the file content as an ArrayBuffer. If you need some help on that, you can see the file examples/browser.html.

Then, create an instance of EdfDecoder and feed it with the buffer from the file:

// say you have a buffer from an edf file named fileBuffer

var decoder = new edfdecoder.EdfDecoder();
decoder.setInput( buff );
decoder.decode();
var myEdf = decoder.getOutput();

The EdfDecoder.getOutput() method returns an instance of Edf (link to doc).
This Edf object contains all the data from the edf file plus some helper function to query all these data.

Use an Edf object

The header of edf file contains metadata that are accessible using helper functions in edfdecoder, you can see the list of methods here.

// Get the number of signals, usually it is equivalent to the number of sensors
var numberOfSignals = myEdf.getNumberOfSignals();

// get the number of record
// note that each signal can have multiple records. A classic case is to have 1-second-long records
var numberOfRecords = myEdf.getNumberOfRecords();

// Get the signal, but you need to specify which signal and the index of the record
var signalIndex = 0;
var recordIndex = 0;
var aSignal = myEdf.getPhysicalSignal( signalIndex, recordIndex );

// It can be convenient to concatenate records from a same signal
// for example to get a signal that is longer than 1sec
var firstRecord = 8;
var numberOfRecords = 15;
var aLongerSignal = myEdf.getPhysicalSignalConcatRecords( signalIndex, firstRecord, numberOfRecords );