Makeshift Neural Interface https://psylink.me
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

618 lines
17 KiB

options:
parameters:
author: ''
category: '[GRC Hier Blocks]'
cmake_opt: ''
comment: ''
copyright: ''
description: ''
gen_cmake: 'On'
gen_linking: dynamic
generate_options: qt_gui
hier_block_src_path: '.:'
id: plot_signals
max_nouts: '0'
output_language: python
placement: (0,0)
qt_qss_theme: ''
realtime_scheduling: ''
run: 'True'
run_command: '{python} -u {filename}'
run_options: prompt
sizing_mode: fixed
thread_safe_setters: ''
title: Not titled yet
window_size: ''
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [8, 8]
rotation: 0
state: enabled
blocks:
- name: offset
id: variable
parameters:
comment: ''
value: '-0.7'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [390, 16]
rotation: 0
state: true
- name: points
id: variable
parameters:
comment: ''
value: '2048'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [284, 16]
rotation: 0
state: true
- name: samp_rate
id: variable
parameters:
comment: ''
value: '500'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [188, 17]
rotation: 0
state: enabled
- name: sample_count
id: variable
parameters:
comment: ''
value: '7'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [496, 16]
rotation: 0
state: true
- name: block_BLE_source
id: epy_block
parameters:
_source_code: "# WARNING: DO NOT EDIT \"block_BLE_source.py\" DIRECTLY! IT IS\
\ AUTOGENERATED BY GNURADIO!\n# INSTEAD, OPEN GNURADIO, DOUBLE-CLICK THE BLOCK,\
\ AND CLICK ON \"Open in Editor\"!\n\nimport importlib\nimport os.path\nimport\
\ sys\n\nimport numpy as np\nfrom gnuradio import gr\n\ntry:\n import psylink.bluetooth\n\
\ import psylink.protocol\nexcept ImportError:\n # NOTE: You may need\
\ to change this path to where you downloaded psyink to:\n libpath = os.path.expanduser('~/repos/psylink/python')\n\
\ sys.path.insert(0, libpath)\n import psylink.bluetooth\n import psylink.protocol\n\
\nDEFAULT_BLE_ADDRESS = 'A6:B7:D0:AE:C2:76'\nEMG_CHANNELS = 8\nSIGNAL_COUNT\
\ = EMG_CHANNELS + psylink.config.IMU_CHANNELS\n\nclass BLESource(gr.basic_block):\n\
\ def __init__(self, ble_mac=DEFAULT_BLE_ADDRESS):\n gr.basic_block.__init__(self,\
\ name='BLE Source', in_sig=[], out_sig=[np.float32] * SIGNAL_COUNT)\n \
\ self.ble_mac = ble_mac\n self.last_sample_count = 2048 # some large\
\ conservative value\n self.BLE = None\n self.BLE_decoder = psylink.protocol.BLEDecoder(sample_value_offset=0)\n\
\ self.actual_channels = SIGNAL_COUNT # will be updated with data from\
\ device\n\n def general_work(self, input_items, output_items):\n \
\ count = 0\n pipe = self.BLE.pipe\n limit = len(output_items[0])\
\ - self.last_sample_count\n while not pipe.empty() and count < limit:\n\
\ packet = pipe.get()\n data = self.BLE_decoder.decode_packet(packet)\n\
\ samples = data['samples']\n transposed = np.transpose(samples)\n\
\ for channel_id in range(min(SIGNAL_COUNT, self.actual_channels)):\n\
\ channel = output_items[channel_id]\n channel[count:count+len(samples)]\
\ = transposed[channel_id] / 256\n count += len(samples)\n \
\ self.last_sample_count = len(samples)\n limit = len(output_items[0])\
\ - self.last_sample_count\n return count\n\n def start(self):\n \
\ if self.BLE:\n print(\"Error: Bluetooth Thread already running!\"\
)\n return False\n\n # Reset state\n importlib.reload(psylink.bluetooth)\n\
\ importlib.reload(psylink.protocol)\n\n BackendClass = list(psylink.bluetooth.BACKENDS.values())[0]\n\
\ self.BLE = BackendClass(self.ble_mac)\n self.BLE.connect()\n\
\ self.actual_channels = self.BLE_decoder.decode_channel_count(self.BLE.read_channels())\n\
\ self.BLE.thread_start()\n\n return True\n\n def stop(self):\n\
\ if self.BLE:\n self.BLE.disconnect()\n self.BLE.thread_stop()\n\
\ self.BLE = None\n return True\n"
affinity: ''
alias: ''
ble_mac: '"2E:A9:71:D7:65:95"'
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
states:
_io_cache: ('BLE Source', 'BLESource', [('ble_mac', "'A6:B7:D0:AE:C2:76'")], [],
[('0', 'float', 1), ('1', 'float', 1), ('2', 'float', 1), ('3', 'float', 1),
('4', 'float', 1), ('5', 'float', 1), ('6', 'float', 1), ('7', 'float', 1),
('8', 'float', 1), ('9', 'float', 1), ('10', 'float', 1), ('11', 'float', 1),
('12', 'float', 1), ('13', 'float', 1)], '', ['ble_mac'])
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [28, 136]
rotation: 0
state: enabled
- name: block_shift
id: epy_block
parameters:
_source_code: "# WARNING: DO NOT EDIT \"block_shift.py\" DIRECTLY! IT IS AUTOGENERATED\
\ BY GNURADIO!\n# INSTEAD, OPEN GNURADIO, DOUBLE-CLICK THE BLOCK, AND CLICK\
\ ON \"Open in Editor\"!\n\n\"\"\"\nKeeps a copy of the last N signals and outputs\
\ them at a constant rate,\nso that you can use QT GUI sinks in a \"rolling\"\
\ mode.\n\"\"\"\n\nimport numpy as np\nfrom gnuradio import gr\n\n\nCHANNELS\
\ = 14\n\n\nclass ShiftBlock(gr.interp_block):\n def __init__(self, number_of_points=1024):\n\
\ gr.interp_block.__init__(\n self,\n name='Shifting\
\ Block',\n interp=10 * number_of_points, # a large number to ensure\
\ that output_items is large enough\n in_sig=[np.float32] * CHANNELS,\n\
\ out_sig=[np.float32] * CHANNELS,\n )\n self.number_of_points\
\ = number_of_points\n self.buffer = np.zeros((CHANNELS, self.number_of_points),\
\ dtype=np.float64)\n\n def work(self, input_items, output_items):\n \
\ n_inputs = min(self.number_of_points, len(input_items[0]))\n self.buffer\
\ = np.roll(self.buffer, shift=-n_inputs, axis=1)\n for channel in range(CHANNELS):\n\
\ self.buffer[channel][-n_inputs:] = input_items[channel][:n_inputs]\n\
\ output_items[channel][:self.number_of_points] = self.buffer[channel]\n\
\ self.consume(channel, n_inputs)\n return self.number_of_points\n"
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
number_of_points: points
states:
_io_cache: ('Shifting Block', 'ShiftBlock', [('number_of_points', '1024')], [('0',
'float', 1), ('1', 'float', 1), ('2', 'float', 1), ('3', 'float', 1), ('4',
'float', 1), ('5', 'float', 1), ('6', 'float', 1), ('7', 'float', 1), ('8',
'float', 1), ('9', 'float', 1), ('10', 'float', 1), ('11', 'float', 1), ('12',
'float', 1), ('13', 'float', 1)], [('0', 'float', 1), ('1', 'float', 1), ('2',
'float', 1), ('3', 'float', 1), ('4', 'float', 1), ('5', 'float', 1), ('6',
'float', 1), ('7', 'float', 1), ('8', 'float', 1), ('9', 'float', 1), ('10',
'float', 1), ('11', 'float', 1), ('12', 'float', 1), ('13', 'float', 1)], '',
['number_of_points'])
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [264, 136]
rotation: 0
state: enabled
- name: blocks_add_const_vxx_0
id: blocks_add_const_vxx
parameters:
affinity: ''
alias: ''
comment: ''
const: offset
maxoutbuf: '0'
minoutbuf: '0'
type: float
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [537, 119]
rotation: 0
state: enabled
- name: blocks_add_const_vxx_0_0
id: blocks_add_const_vxx
parameters:
affinity: ''
alias: ''
comment: ''
const: 2*offset
maxoutbuf: '0'
minoutbuf: '0'
type: float
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [537, 169]
rotation: 0
state: enabled
- name: blocks_add_const_vxx_0_0_0
id: blocks_add_const_vxx
parameters:
affinity: ''
alias: ''
comment: ''
const: 3*offset
maxoutbuf: '0'
minoutbuf: '0'
type: float
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [536, 219]
rotation: 0
state: enabled
- name: blocks_add_const_vxx_0_0_0_0
id: blocks_add_const_vxx
parameters:
affinity: ''
alias: ''
comment: ''
const: 4*offset
maxoutbuf: '0'
minoutbuf: '0'
type: float
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [536, 270]
rotation: 0
state: enabled
- name: blocks_add_const_vxx_0_0_0_0_0
id: blocks_add_const_vxx
parameters:
affinity: ''
alias: ''
comment: ''
const: 5*offset
maxoutbuf: '0'
minoutbuf: '0'
type: float
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [534, 320]
rotation: 0
state: enabled
- name: blocks_add_const_vxx_0_0_0_0_0_0
id: blocks_add_const_vxx
parameters:
affinity: ''
alias: ''
comment: ''
const: 6*offset
maxoutbuf: '0'
minoutbuf: '0'
type: float
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [536, 372]
rotation: 0
state: enabled
- name: blocks_add_const_vxx_0_0_0_0_0_0_0
id: blocks_add_const_vxx
parameters:
affinity: ''
alias: ''
comment: ''
const: 7*offset
maxoutbuf: '0'
minoutbuf: '0'
type: float
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [540, 422]
rotation: 0
state: enabled
- name: qtgui_freq_sink_x_0
id: qtgui_freq_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
autoscale: 'False'
average: '1.0'
axislabels: 'True'
bw: samp_rate
color1: '"blue"'
color10: '"dark blue"'
color2: '"red"'
color3: '"green"'
color4: '"black"'
color5: '"cyan"'
color6: '"magenta"'
color7: '"yellow"'
color8: '"dark red"'
color9: '"dark green"'
comment: ''
ctrlpanel: 'False'
fc: '0'
fftsize: points
freqhalf: 'False'
grid: 'True'
gui_hint: ''
label: Relative Gain
label1: ''
label10: ''''''
label2: ''''''
label3: ''''''
label4: ''''''
label5: ''''''
label6: ''''''
label7: ''''''
label8: ''''''
label9: ''''''
legend: 'True'
maxoutbuf: '0'
minoutbuf: '0'
name: '""'
nconnections: '2'
showports: 'False'
tr_chan: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_tag: '""'
type: float
units: dB
update_time: '0.05'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
wintype: firdes.WIN_BLACKMAN_hARRIS
ymax: '40'
ymin: '-100'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [990, 56]
rotation: 0
state: disabled
- name: qtgui_time_sink_x_0_0
id: qtgui_time_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
autoscale: 'False'
axislabels: 'True'
color1: blue
color10: dark blue
color2: red
color3: green
color4: black
color5: dark red
color6: dark green
color7: dark blue
color8: dark red
color9: dark green
comment: ''
ctrlpanel: 'False'
entags: 'False'
grid: 'True'
gui_hint: ''
label1: Arm Right
label10: Signal 10
label2: Arm Left
label3: Wrist
label4: Thumb
label5: Index Finger
label6: Middle Finger
label7: Ring Finger
label8: Front To Back
label9: Signal 9
legend: 'True'
marker1: '-1'
marker10: '-1'
marker2: '-1'
marker3: '-1'
marker4: '-1'
marker5: '-1'
marker6: '-1'
marker7: '-1'
marker8: '-1'
marker9: '-1'
name: '""'
nconnections: '8'
size: points
srate: samp_rate
stemplot: 'False'
style1: '1'
style10: '1'
style2: '1'
style3: '1'
style4: '1'
style5: '1'
style6: '1'
style7: '1'
style8: '1'
style9: '1'
tr_chan: '0'
tr_delay: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_slope: qtgui.TRIG_SLOPE_POS
tr_tag: '""'
type: float
update_time: '0.05'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
ylabel: Amplitude
ymax: '1'
ymin: 0+sample_count*offset
yunit: '""'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [783, 103]
rotation: 0
state: enabled
- name: qtgui_time_sink_x_0_0_0
id: qtgui_time_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
autoscale: 'False'
axislabels: 'True'
color1: blue
color10: dark blue
color2: red
color3: green
color4: black
color5: dark red
color6: dark green
color7: dark blue
color8: dark red
color9: dark green
comment: ''
ctrlpanel: 'False'
entags: 'False'
grid: 'True'
gui_hint: ''
label1: Arm Right
label10: Signal 10
label2: Arm Left
label3: Wrist
label4: Thumb
label5: Index Finger
label6: Middle Finger
label7: Ring Finger
label8: Signal 8
label9: Signal 9
legend: 'True'
marker1: '-1'
marker10: '-1'
marker2: '-1'
marker3: '-1'
marker4: '-1'
marker5: '-1'
marker6: '-1'
marker7: '-1'
marker8: '-1'
marker9: '-1'
name: '""'
nconnections: '6'
size: points
srate: samp_rate
stemplot: 'False'
style1: '1'
style10: '1'
style2: '1'
style3: '1'
style4: '1'
style5: '1'
style6: '1'
style7: '1'
style8: '1'
style9: '1'
tr_chan: '0'
tr_delay: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_slope: qtgui.TRIG_SLOPE_POS
tr_tag: '""'
type: float
update_time: '0.05'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
ylabel: Amplitude
ymax: '1.2'
ymin: '-0.2'
yunit: '""'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [560, 497]
rotation: 0
state: enabled
connections:
- [block_BLE_source, '0', block_shift, '0']
- [block_BLE_source, '1', block_shift, '1']
- [block_BLE_source, '10', block_shift, '10']
- [block_BLE_source, '11', block_shift, '11']
- [block_BLE_source, '12', block_shift, '12']
- [block_BLE_source, '13', block_shift, '13']
- [block_BLE_source, '2', block_shift, '2']
- [block_BLE_source, '3', block_shift, '3']
- [block_BLE_source, '4', block_shift, '4']
- [block_BLE_source, '5', block_shift, '5']
- [block_BLE_source, '6', block_shift, '6']
- [block_BLE_source, '7', block_shift, '7']
- [block_BLE_source, '8', block_shift, '8']
- [block_BLE_source, '9', block_shift, '9']
- [block_shift, '0', qtgui_freq_sink_x_0, '0']
- [block_shift, '0', qtgui_time_sink_x_0_0, '0']
- [block_shift, '1', blocks_add_const_vxx_0, '0']
- [block_shift, '10', qtgui_time_sink_x_0_0_0, '2']
- [block_shift, '11', qtgui_time_sink_x_0_0_0, '3']
- [block_shift, '12', qtgui_time_sink_x_0_0_0, '4']
- [block_shift, '13', qtgui_time_sink_x_0_0_0, '5']
- [block_shift, '2', blocks_add_const_vxx_0_0, '0']
- [block_shift, '3', blocks_add_const_vxx_0_0_0, '0']
- [block_shift, '4', blocks_add_const_vxx_0_0_0_0, '0']
- [block_shift, '5', blocks_add_const_vxx_0_0_0_0_0, '0']
- [block_shift, '6', blocks_add_const_vxx_0_0_0_0_0_0, '0']
- [block_shift, '7', blocks_add_const_vxx_0_0_0_0_0_0_0, '0']
- [block_shift, '8', qtgui_time_sink_x_0_0_0, '0']
- [block_shift, '9', qtgui_time_sink_x_0_0_0, '1']
- [blocks_add_const_vxx_0, '0', qtgui_time_sink_x_0_0, '1']
- [blocks_add_const_vxx_0_0, '0', qtgui_time_sink_x_0_0, '2']
- [blocks_add_const_vxx_0_0_0, '0', qtgui_time_sink_x_0_0, '3']
- [blocks_add_const_vxx_0_0_0_0, '0', qtgui_time_sink_x_0_0, '4']
- [blocks_add_const_vxx_0_0_0_0_0, '0', qtgui_time_sink_x_0_0, '5']
- [blocks_add_const_vxx_0_0_0_0_0_0, '0', qtgui_time_sink_x_0_0, '6']
- [blocks_add_const_vxx_0_0_0_0_0_0_0, '0', qtgui_time_sink_x_0_0, '7']
metadata:
file_format: 1