This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import warnings | |
import numpy as np | |
from sklearn import feature_extraction | |
def extract_windows(arr, sfreq, win_size, step_size, axis=-1): | |
"""extract 1d signal windows from an ndimensional array | |
window_size and step_size are defined in terms of seconds | |
this will extract a so called 'view' to the array, so the memory footprint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyedflib import highlevel | |
import numpy as np | |
import mne | |
def resample(data, o_sfreq, t_sfreq): | |
""" | |
resample a signal using MNE resample functions | |
This automatically is optimized for EEG applying filters etc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed Dec 5 12:56:31 2018 | |
@author: skjerns | |
Gist to save a mne.io.Raw object to an EDF file using pyEDFlib | |
(https://github.com/holgern/pyedflib) | |
Disclaimer: | |
- Saving your data this way will result in slight | |
loss of precision (magnitude +-1e-09). | |
- It is assumed that the data is presented in Volt (V), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import glob | |
import csv | |
import numpy as np | |
from sklearn.metrics import f1_score | |
from sleepscorer import Scorer, SleepData | |
edfx_dir = "D:\\sleep\\edfx\\" | |
################################## |