Exemplo n.º 1
0
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 25 05:55:07 2017

@author: marzipan
"""

from MartianBCI.Pipeline import Pipeline
from MartianBCI.Blocks.block_Inc_Spectrogram import block_inc_spectrogram
from MartianBCI.Blocks.block_freq_bin import block_freq_bin
from MartianBCI.Utils.lsl_utils import create_multi_ch_test_source

# Create test data
#create_multi_ch_test_source(freqs=[9,8,10,12,30,29,40,45])

# Init and run pipeline
pipeline = Pipeline(buf_len_secs=0.016,
                    chan_sel=list(range(8)),
                    sample_update_interval=4)
pipeline.select_source()
pipeline.add_block(block_inc_spectrogram,
                   nperseg=256,
                   num_ch=8,
                   window='hanning')
pipeline.add_block(block_freq_bin)
pipeline.select_output()
pipeline.run()
Exemplo n.º 2
0
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 22 15:28:38 2017

@author: marzipan
"""

from MartianBCI.Pipeline import Pipeline
from MartianBCI.Blocks.block_FIR import block_fir_filter

# Init and run pipeline
pipeline = Pipeline(buf_len_secs=0.004, chan_sel=list(range(8)), sample_update_interval=1)
pipeline.select_source()
pipeline.add_block(block_fir_filter) 
pipeline.select_output()
pipeline.run()





Exemplo n.º 3
0
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 27 17:29:55 2017

@author: marzipan
"""

from MartianBCI.Pipeline import Pipeline
from MartianBCI.Blocks.block_Inc_Spectrogram import block_inc_spectrogram
from MartianBCI.Blocks.block_freq_bin import block_freq_bin
from MartianBCI.Blocks.block_moving_average import block_moving_average
from MartianBCI.Blocks.block_unity_normalize import block_unity_normalize

# Init and run pipeline
pipeline = Pipeline(buf_len_secs=0.016, chan_sel=list(range(8)), sample_update_interval=4)
pipeline.select_source()

pipeline.add_block(block_inc_spectrogram, nperseg=256, num_ch=8, window='hanning')
pipeline.add_block(block_freq_bin)
pipeline.add_block(block_unity_normalize) # TODO paramterizing linear map, essential to UX
pipeline.add_block(block_moving_average)

pipeline.select_output()
pipeline.run()

Exemplo n.º 4
0
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 20 00:36:55 2017

@author: marzipan
"""

from MartianBCI.Pipeline import Pipeline
from MartianBCI.Blocks.block_spectrogram import block_spectrogram
from MartianBCI.Utils.lsl_utils import create_test_source
from MartianBCI.Feedback.spectrogram_mesh import visualize_spec_stream

# Create test data
create_test_source(freq=12, sps=250)

# Init and run pipeline
pipeline = Pipeline(buf_len_secs=5)
pipeline.select_source()
pipeline.add_block(block_spectrogram, nperseg=64)
pipeline.select_output()
pipeline.run()

# Execute Feedback
visualize_spec_stream(pipeline)
Exemplo n.º 5
0
from MartianBCI.Pipeline import Pipeline
from MartianBCI.Blocks.tf_block_fir import tf_block_fir
from MartianBCI.Blocks.tf_block_convert2uv import tf_block_convert2uv
from MartianBCI.Blocks.tf_block_adapter_io import tf_block_adapter_io
from MartianBCI.Blocks.tf_block_adapter_io import tf_block_adapter_add
from MartianBCI.Utils.lsl_utils import create_multi_ch_test_source



# Create test data
create_multi_ch_test_source(freqs=[9,8,10,12,30,29,40,45])

fir_coeffs = '7-14_BP_FIR_BLACKMANN.npy'
#b,a = np.load('C:\\Conda\\MartianBCI\\Demos\\RL_Utils\\Filters\\' + fir_coeffs)
b,a = np.load('C:\\Users\\marzipan\\workspace\\MartianBCI\\Demos\\RL_Utils\\Filters\\' + fir_coeffs)

tf.reset_default_graph()

blocks = [
        tf_block_adapter_add(tf_block_fir, b.astype(np.float32)),
        tf_block_adapter_add(tf_block_convert2uv, 24)
        ]



# Init and run pipeline
pipeline = Pipeline(buf_len_secs=0.004, chan_sel=list(range(8)), sample_update_interval=1)
pipeline.select_source()
block1 = pipeline.add_block(tf_block_adapter_io, blocks, _LEN=1000, _NCHAN=8, _WRITE_SUMMARIES=False)
pipeline.select_output()
pipeline.run()