Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main ():
parser = argparse.ArgumentParser ()
# use docs to check which parameters are required for specific board, e.g. for Cyton - set serial port
parser.add_argument ('--ip-port', type = int, help = 'ip port', required = False, default = 0)
parser.add_argument ('--ip-protocol', type = int, help = 'ip protocol, check IpProtocolType enum', required = False, default = 0)
parser.add_argument ('--ip-address', type = str, help = 'ip address', required = False, default = '')
parser.add_argument ('--serial-port', type = str, help = 'serial port', required = False, default = '')
parser.add_argument ('--mac-address', type = str, help = 'mac address', required = False, default = '')
parser.add_argument ('--other-info', type = str, help = 'other info', required = False, default = '')
parser.add_argument ('--streamer-params', type = str, help = 'other info', required = False, default = '')
parser.add_argument ('--board-id', type = int, help = 'board id, check docs to get a list of supported boards', required = True)
parser.add_argument ('--log', action = 'store_true')
args = parser.parse_args ()
params = BrainFlowInputParams ()
params.ip_port = args.ip_port
params.serial_port = args.serial_port
params.mac_address = args.mac_address
params.other_info = args.other_info
params.ip_address = args.ip_address
params.ip_protocol = args.ip_protocol
if (args.log):
BoardShim.enable_dev_board_logger ()
else:
BoardShim.disable_board_logger ()
board = BoardShim (args.board_id, params)
board.prepare_session ()
board.start_stream ()
parser.add_argument ('--serial-port', type = str, help = 'serial port', required = False, default = '')
parser.add_argument ('--mac-address', type = str, help = 'mac address', required = False, default = '')
parser.add_argument ('--other-info', type = str, help = 'other info', required = False, default = '')
parser.add_argument ('--board-id', type = int, help = 'board id, check docs to get a list of supported boards', required = True)
parser.add_argument ('--log', action = 'store_true')
args = parser.parse_args ()
params = BrainFlowInputParams ()
params.ip_port = args.ip_port
params.serial_port = args.serial_port
params.mac_address = args.mac_address
params.other_info = args.other_info
params.ip_address = args.ip_address
params.ip_protocol = args.ip_protocol
synth_params = BrainFlowInputParams ()
if (args.log):
BoardShim.enable_dev_board_logger ()
else:
BoardShim.disable_board_logger ()
board = BoardShim (args.board_id, params)
synth_board = BoardShim (brainflow.board_shim.BoardIds.SYNTHETIC_BOARD.value, synth_params)
board.prepare_session ()
synth_board.prepare_session ()
board.start_stream ()
synth_board.start_stream ()
time.sleep (10)
data = board.get_board_data ()
synth_data = synth_board.get_board_data ()
def main ():
parser = argparse.ArgumentParser ()
# use docs to check which parameters are required for specific board, e.g. for Cyton - set serial port
parser.add_argument ('--ip-port', type = int, help = 'ip port', required = False, default = 0)
parser.add_argument ('--ip-protocol', type = int, help = 'ip protocol, check IpProtocolType enum', required = False, default = 0)
parser.add_argument ('--ip-address', type = str, help = 'ip address', required = False, default = '')
parser.add_argument ('--serial-port', type = str, help = 'serial port', required = False, default = '')
parser.add_argument ('--mac-address', type = str, help = 'mac address', required = False, default = '')
parser.add_argument ('--other-info', type = str, help = 'other info', required = False, default = '')
parser.add_argument ('--board-id', type = int, help = 'board id, check docs to get a list of supported boards', required = True)
parser.add_argument ('--log', action = 'store_true')
args = parser.parse_args ()
params = BrainFlowInputParams ()
params.ip_port = args.ip_port
params.serial_port = args.serial_port
params.mac_address = args.mac_address
params.other_info = args.other_info
params.ip_address = args.ip_address
params.ip_protocol = args.ip_protocol
if (args.log):
BoardShim.enable_dev_board_logger ()
else:
BoardShim.disable_board_logger ()
board = BoardShim (args.board_id, params)
board.prepare_session ()
board.start_stream ()
def main ():
BoardShim.enable_dev_board_logger ()
# use synthetic board for demo
params = BrainFlowInputParams ()
board_id = BoardIds.SYNTHETIC_BOARD.value
board = BoardShim (board_id, params)
board.prepare_session ()
board.start_stream ()
BoardShim.log_message (LogLevels.LEVEL_INFO.value, 'start sleeping in the main thread')
time.sleep (10)
data = board.get_board_data ()
board.stop_stream ()
board.release_session ()
eeg_channels = BoardShim.get_eeg_channels (board_id)
# demo for transforms
for count, channel in enumerate (eeg_channels):
print ('Original data for channel %d:' % channel)
print (data[channel])
# demo for wavelet transforms
def main ():
parser = argparse.ArgumentParser ()
# use docs to check which parameters are required for specific board, e.g. for Cyton - set serial port
parser.add_argument ('--ip-port', type = int, help = 'ip port', required = False, default = 0)
parser.add_argument ('--ip-protocol', type = int, help = 'ip protocol, check IpProtocolType enum', required = False, default = 0)
parser.add_argument ('--ip-address', type = str, help = 'ip address', required = False, default = '')
parser.add_argument ('--serial-port', type = str, help = 'serial port', required = False, default = '')
parser.add_argument ('--mac-address', type = str, help = 'mac address', required = False, default = '')
parser.add_argument ('--other-info', type = str, help = 'other info', required = False, default = '')
parser.add_argument ('--board-id', type = int, help = 'board id, check docs to get a list of supported boards', required = True)
parser.add_argument ('--log', action = 'store_true')
args = parser.parse_args ()
params = BrainFlowInputParams ()
params.ip_port = args.ip_port
params.serial_port = args.serial_port
params.mac_address = args.mac_address
params.other_info = args.other_info
params.ip_address = args.ip_address
params.ip_protocol = args.ip_protocol
synth_params = BrainFlowInputParams ()
if (args.log):
BoardShim.enable_dev_board_logger ()
else:
BoardShim.disable_board_logger ()
board = BoardShim (args.board_id, params)
synth_board = BoardShim (brainflow.board_shim.BoardIds.SYNTHETIC_BOARD.value, synth_params)
def main():
BoardShim.enable_dev_board_logger ()
# use synthetic board for demo
params = BrainFlowInputParams ()
board = BoardShim (BoardIds.SYNTHETIC_BOARD.value, params)
board.prepare_session ()
board.start_stream ()
time.sleep (10)
data = board.get_board_data ()
board.stop_stream ()
board.release_session ()
eeg_channels = BoardShim.get_eeg_channels (BoardIds.SYNTHETIC_BOARD.value)
eeg_data = data[eeg_channels, :]
eeg_data = eeg_data / 1000000 # BrainFlow returns uV, convert to V for MNE
# Creating MNE objects from brainflow data arrays
ch_types = ['eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg', 'eeg']
ch_names = ['T7', 'CP5', 'FC5', 'C3', 'C4', 'FC6', 'CP6', 'T8']
sfreq = BoardShim.get_sampling_rate (BoardIds.SYNTHETIC_BOARD.value)
def main ():
parser = argparse.ArgumentParser ()
# use docs to check which parameters are required for specific board, e.g. for Cyton - set serial port,
parser.add_argument ('--ip-port', type = int, help = 'ip port', required = False, default = 0)
parser.add_argument ('--ip-protocol', type = int, help = 'ip protocol, check IpProtocolType enum', required = False, default = 0)
parser.add_argument ('--ip-address', type = str, help = 'ip address', required = False, default = '')
parser.add_argument ('--serial-port', type = str, help = 'serial port', required = False, default = '')
parser.add_argument ('--mac-address', type = str, help = 'mac address', required = False, default = '')
parser.add_argument ('--other-info', type = str, help = 'other info', required = False, default = '')
parser.add_argument ('--board-id', type = int, help = 'board id, check docs to get a list of supported boards', required = True)
parser.add_argument ('--log', action = 'store_true')
args = parser.parse_args ()
params = BrainFlowInputParams ()
params.ip_port = args.ip_port
params.serial_port = args.serial_port
params.mac_address = args.mac_address
params.other_info = args.other_info
params.ip_address = args.ip_address
params.ip_protocol = args.ip_protocol
if (args.log):
BoardShim.enable_dev_board_logger ()
else:
BoardShim.disable_board_logger ()
# demo how to read data as 2d numpy array
board = BoardShim (args.board_id, params)
board.prepare_session ()
board.start_stream ()