0.0.0 • Published 4 years ago

@drowzee/biog v0.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Github open issues Bitbucket open issues GitHub contributors David Generic badge

This library acts as a converter and link between the multiple ways of storing EEG time series data in applications.

Features

  • Understands multiple JSON-type, csv and OpenBCI formats
  • Works with markers

Example

Convert from EG1 to Neurosity-1

const epoch = {
  data: [
    [
      -911.1328125,
      ... // 7 more samples
    ],
    [
      -802.734375,
      ... // 7 more samples
    ],
    [
      251.953125,
      ... // 7 more samples
    ],
    [
      106.93359375,
      ... // 7 more samples
    ]
  ],
  info: { startTime: 1635707 }
};

const data = biog.load(epoch);
const sampleFormat = biog.out("samples")

console.log(sampleFormat.length) // 8
console.log(sampleFormat)

[
  {
    data: [-911.1328125,-802.734375,251.953125,106.93359375],
    info: { startTime: 1635707 }
  },
  {
    data: [-911.1328125,-802.734375,251.953125,106.93359375],
    info: { startTime: 1635711 } // updated startTime
  },
  // ... 6 more samples
]

Different kinds of data

EG1

Used by eeg-pipes

type Sample = {
  data: number[];
  info: {
    startTime: number;
    samplingRate: number;
    channelNames: string[];
  };
};

Neurosity-1

Used by the neurosity device

type Marker = {
  label: string;
  timestamp: number;
};

type Epoch = {
  data: number[][];
  info: {
    startTime: number;
    samplingRate: number;
    channelNames: string[];
    markers?: Marker[];
  };
};