Ejemplo n.º 1
0
 def get_emg_data_object(self,n_gestures=6):
     emg_data = symbionic.EmgData()
     for g in range(1,n_gestures+1):
         emg_values = self.get_chained_device_data_for_prediction(g)
         if emg_values is not None and len(emg_values) > 0:
             emg_data.store_emg_values_in_gesture(emg_values,f'g{g}')
     return emg_data
Ejemplo n.º 2
0
def test_list_to_dataframe():
    emg_data = symbionic.EmgData()
    emg_data.demean_data = False
    df = emg_data.convert_emg_values_to_dataframe(raw_emg_data_sample())
    assert df.shape == (2,
                        emg_data.channels + 1), 'Output shape does not match'
    assert df[emg_data.channel_names[0]].tolist() == [1.1] * 2
Ejemplo n.º 3
0
 def __init__(self):
     emg_data = symbionic.EmgData()
     emg_data.load(symbionic.example_data_directory() + "raw3.bin")
     emg_array = emg_data.data['g1'].drop('time', axis=1).values
     emg_iterator = DataIterator(emg_array)
     emg_iterator.step = 80
     emg_iterator.size = 500
     self.emg_iterator = emg_iterator
Ejemplo n.º 4
0
'''
currently just a script
@author: Matthijs Cox
'''

import symbionic
import numpy as np
import matplotlib.pyplot as plt

folder = symbionic.example_data_directory()

emg_data = symbionic.EmgData()
emg_data.load(folder + 'raw1.bin', gesture='g1')
emg_data.load(folder + 'raw2.bin', gesture='g2')
emg_data.load(folder + 'raw3.bin', gesture='g3')
emg_data.load(folder + 'raw4.bin', gesture='g4')
emg_data.load(folder + 'raw5.bin', gesture='g5')
emg_data.load(folder + 'raw6.bin', gesture='g6')
emg_data.label_patterns()
emg_data.plot(ylim=(-100, 100))

# get windowed training samples
# samples = emg_data.get_training_samples()

Ejemplo n.º 5
0
def test_data_retrieval():
    emg_data = symbionic.EmgData()
    emg_data.store_emg_values_in_gesture([1.1] * emg_data.channels * 2, 'g1')
    data = emg_data.get_data_from_gesture('g1')
    assert isinstance(data, pd.DataFrame)
    assert emg_data.get_data_from_gesture('g2') is None
Ejemplo n.º 6
0
def test_data_retrieval():
    emg_data = symbionic.EmgData()
    emg_data.store_emg_values_in_gesture(raw_emg_data_sample(), 'g1')
    data = emg_data.get_data_from_gesture('g1')
    assert isinstance(data, pd.DataFrame)
    assert emg_data.get_data_from_gesture('g2') is None
Ejemplo n.º 7
0
def load_emg_data_single_gesture():
    emg_data = symbionic.EmgData()
    emg_data.load(data_directory() + 'raw2.bin', gesture='g2')
    emg_data.label_patterns()
    return emg_data