eegyolk.data_functions module

Copyright 2022 Netherlands eScience Center and Utrecht University. Licensed under the Apache License, version 2.0. See LICENSE for details.

This file contains functions designed to create simulated “dummy” data.

eegyolk.data_functions.create_labeled_dataset(size, distributions=['planck', 'constant'])

Uses the functions from this scripts to create dataset with various frequency distributions.

Args:

size: float

distributions: list of strings

The names of the distributions that are generated and labeled

eegyolk.data_functions.generate_epoch(freq_distribution, N_combined_freq=100, max_freq=256, duration=2, sample_rate=512)

Returns a single epoch of EEG dummy data.

Args:
freq_distribution: 1D numpy array

The density probability distribution

N_combined_freq: float

Number of frequencies in epoch.

eegyolk.data_functions.generate_frequency_distribution(distribution='planck', max_freq=256, freq_sample_rate=10)

This function returns the occurence of frequencies up to ‘max_freq’ from a ‘distribution’. Returns arrays of frequencies and their occurence as x and y value. The form of 1 / (x^2 *
(exp(1/x)-1)) is inspired by Planck’s law.

Args:
distribution: string

The shape of the distribution. Choose from “planck”, “constant”, “linear” or create a new one.

max_freq: float

The largest frequency that the function considers.

freq_sample_rate: float

eegyolk.data_functions.generate_sine_wave(frequency, time_points)

Function to generate a sine wave.

eegyolk.data_functions.load_events(events_directory, experiments)
eegyolk.data_functions.load_metadata(metadata_directory, metadata_filenames)
eegyolk.data_functions.load_raw_dataset(dataset_directory, file_extension='.bdf', preload=False, max_files=9999)

A function to load existing ePodium datasets. Contact Utrecht for data.

eegyolk.data_functions.random_frequency_from_density_distribution(max_freq, freq_distribution)
Returns a single random frequency from a cumulative distribution:
  1. Sum the array cumulatively and scale from 0 to 1.

  2. Pick a random number between 0 and 1.

  3. Loop through the array until the number is >= than a random value.

Args:
max_freq: float

The maximum frequency that the function can return.

freq_distribution: 1D numpy array

The density probability distribution

eegyolk.data_functions.save_experiment_names(experiments_set, path_txt)

This function saves the names of the experiments in experiments_set in path_txt as a .txt file. This is used for saving the train, test and validation sets of a model.

eegyolk.data_functions.save_longer_events(events_directory, experiments_raw, experiments_id, freq)

This function loads the events from the raw file and saves them in an external directory. Loading from a .txt file is many times faster than loading from raw. This was written by Floris Pauwels for this thesis, and he originally placed it in the data_io module as save_events. This function only saves event of a certain legnth based on a comparison to frequency.

eegyolk.data_functions.simple_load_metadata(metadata_directory, metadata_filenames)

Metadata should usually be loaded with helper_function.load_metadata, however this code is inlcuded as it was used in the code of Floris Pauwels for this thesis under the function name data_io.load_metadata