Ejemplo n.º 1
0
wdir = '/home/nikolai/_Work/vibro_smr/'
data_dir = '/media/nikolai/D27ECFCB7ECFA697/Users/Nikolai/Desktop/vibro-decay/'
experiments = pd.read_csv(wdir + 'vibro-decay.csv')
experiments = experiments[experiments.protocol == 'belt']
print(experiments)


n_exp = 24
print(n_exp)


exp = experiments.iloc[n_exp]
desc = '{}-{}-{}-{}'.format(exp['subject'], exp['protocol'], {0: 'exp', 1:'control'}[exp['control']], '-'.join(exp.dataset.split('_')[-2:]))
print(exp, '\n*******************', desc, '\n*******************')
df, fs, p_names, channels = load_data('{}{}/experiment_data.h5'.format(data_dir, exp.dataset))
channels = channels[:32]
df = df[~get_outliers_mask(df[channels], std=3)]

right, left = runica2(df.loc[df['block_number'].isin([1, 2, 3, 7, 8, 9]), channels], fs, channels, ['RIGHT', 'LEFT'])
np.save(wdir + desc + '-RIGHT.npy', right)
np.save(wdir + desc + '-LEFT.npy', left)


# load and plot
right = np.load(wdir + desc + '-RIGHT.npy')
left = np.load(wdir + desc + '-LEFT.npy')
f, ax = plt.subplots(1, 4)
plot_topomap(right[0], Montage(channels).get_pos(), contours=0, axes=ax[0], show=False)
plot_topomap(right[1], Montage(channels).get_pos(), contours=0, axes=ax[1], show=False)
plot_topomap(left[0], Montage(channels).get_pos(), contours=0, axes=ax[2], show=False)
Ejemplo n.º 2
0
wdir = '/home/nikolai/_Work/vibro_smr/'
data_dir = '/media/nikolai/D27ECFCB7ECFA697/Users/Nikolai/Desktop/vibro-decay/'
experiments = pd.read_csv(wdir + 'vibro-decay.csv')
experiments = experiments[experiments.protocol == 'belt']
print(experiments)

n_exp = 20
print(n_exp)

exp = experiments.iloc[n_exp]
desc = '{}-{}-{}-{}'.format(exp['subject'], exp['protocol'], {
    0: 'exp',
    1: 'control'
}[exp['control']], '-'.join(exp.dataset.split('_')[-2:]))
print(exp, '\n*******************', desc, '\n*******************')
df, fs, p_names, channels = load_data('{}{}/experiment_data.h5'.format(
    data_dir, exp.dataset))
df = df[~get_outliers_mask(df[channels], std=3)]

right, left = runica2(
    df.loc[df['block_number'].isin([1, 2, 3, 7, 8, 9]), channels], fs,
    channels, ['RIGHT', 'LEFT'])
np.save(wdir + desc + '-RIGHT.npy', right)
np.save(wdir + desc + '-LEFT.npy', left)

# load and plot
right = np.load(wdir + desc + '-RIGHT.npy')
left = np.load(wdir + desc + '-LEFT.npy')
f, ax = plt.subplots(1, 4)
plot_topomap(right[0],
             Montage(channels).get_pos(),
             contours=0,
Ejemplo n.º 3
0
from pynfb.postprocessing.utils import load_data, fft_filter, dc_blocker, load_signals_data
import pylab as plt
import pandas as pd
import seaborn as sns
import numpy as np
cm = sns.color_palette()

file_path = r'/media/nikolai/D27ECFCB7ECFA697/Users/Nikolai/PycharmProjects/nfb/pynfb/results/delay-p4_02-20_11-38-03/experiment_data.h5'

df, fs, p_names, channels = load_data(file_path)
signals = load_signals_data(file_path)
print(signals)
print('*****', p_names)

data = pd.DataFrame()

data['p4'] = dc_blocker(df['P4'])
data['signal'] = signals['Signal']
data['block_name'] = df['block_name']
data['block_number'] = df['block_number']
data.to_csv('alpha-delayed-20-02-18.csv')

labels = []
handles = []
b_names = list(data['block_name'].unique())
data.index = np.arange(len(data)) / fs
for k in data['block_number'].unique():
    x = data.loc[data['block_number'] == k]
    name = x['block_name'].iloc[0]

    print(name)