def __init__(self, addresses, type): """Do: 1) run super constructor to receive configs 2) run DriverComm constructor that fires binary driver 3) get json description from the driver (desc_params are required) 4) store that description in self.configs to share it with other modules 5) if autostart is set to true: 6) set driver params from config (sampling_rate and active_channels) 7) start sampling """ super(BinaryDriverWrapper, self).__init__(addresses=addresses, type=type) self._init_got_configs() self._mx_addresses = addresses context = ctx.get_new_context() context['logger'] = self.logger DriverComm.__init__(self, self.config, addresses, context) desc = self.get_driver_description() if desc.startswith('DEVICE OPEN ERROR'): self.abort("DEVICE PROBLEM: " + desc + " ...ABORTING!!!") self.store_driver_description(desc) autostart = self.config.true_val( self.config.get_param('start_sampling')) self.logger.info('Automatic start' + str(autostart)) self.ready() if autostart: self.set_driver_params() self.start_sampling()
def __init__(self, addresses): LogicDecision.__init__(self, addresses=addresses) context = ctx.get_new_context() context['logger'] = self.logger SpellerEngine.__init__(self, self.config.param_values(), context) self.ready() self._update_letters()
def __init__(self, addresses, type): """Do: 1) run super constructor to receive configs 2) run DriverComm constructor that fires binary driver 3) get json description from the driver (desc_params are required) 4) store that description in self.configs to share it with other modules 5) if autostart is set to true: 6) set driver params from config (sampling_rate and active_channels) 7) start sampling """ super(BinaryDriverWrapper, self).__init__(addresses=addresses, type=type) self._init_got_configs() self._mx_addresses = addresses context = ctx.get_new_context() context['logger'] = self.logger DriverComm.__init__(self, self.config, addresses, context) desc = self.get_driver_description() if desc.startswith('DEVICE OPEN ERROR'): self.abort("DEVICE PROBLEM: " + desc + " ...ABORTING!!!") self.store_driver_description(desc) autostart = self.config.true_val(self.config.get_param('start_sampling')) self.logger.info('Automatic start' + str(autostart)) self.ready() if autostart: self.set_driver_params() self.start_sampling()
def __init__(self, addresses): LogicDecision.__init__(self, addresses=addresses) context = ctx.get_new_context() context['logger'] = self.logger SpellerEngine.__init__(self, self.config.param_values(), context) RobotEngine.__init__(self, self.config.param_values(), context) self._maze_finished = False self._maze_success = False MazeEngine.__init__(self, self.config.param_values(), context) self.ready() time.sleep(2) self._update_letters()
def _get_analysis(self, send_func, cfg, montage_matrix): """Fired in __init__ method. Return analysis instance object implementing interface: - get_requested_configs() - set_configs(configs) - analyse(data) """ context = ctx.get_new_context() context['logger'] = self.logger return p300_analysis_data_peer.BCIP300FdaAnalysis( send_func, cfg, montage_matrix, int(self.config.get_param('sampling_rate')), context)
def _get_analysis(self, send_func, freqs, cfg, montage_matrix): """Fired in __init__ method. Return analysis instance object implementing interface: - get_requested_configs() - set_configs(configs) - analyse(data) """ context = ctx.get_new_context() context['logger'] = self.logger return bci_ssvep_csp_analysis.BCISsvepCspAnalysis( send_func, freqs, cfg, montage_matrix, int(self.config.get_param('sampling_rate')), True, context)
def _get_analysis(self, send_func, cfg, montage_matrix): """Fired in __init__ method. Return analysis instance object implementing interface: - get_requested_configs() - set_configs(configs) - analyse(data) """ context = ctx.get_new_context() context['logger'] = self.logger return bci_p300_fda_analysis.BCIP300FdaAnalysis( send_func, cfg, montage_matrix, int(self.config.get_param('sampling_rate')), context)
def run(self): f_name = self.config.get_param("data_file_name") f_dir = self.config.get_param("data_file_path") context = ctx.get_new_context() context['logger'] = self.logger cfg = logic_ssvep_csp_fast_analysis.run( acquisition_helper.get_file_path(f_dir, f_name), self.use_channels, self.ignore_channels, self.montage, self.montage_channels, self.mode in ['offline', 'manual'], True, context) maybe_buffer = self.config.get_param('buffer_len') if len(maybe_buffer) > 0: self.logger.info("Overwrite csp buffer len:" + str(cfg['buffer']) + "with from config:" + str(maybe_buffer)) cfg['buffer'] = float(maybe_buffer) self.finish(cfg)
def run(self): f_name = self.config.get_param("data_file_name") f_dir = self.config.get_param("data_file_path") context = ctx.get_new_context() context['logger'] = self.logger cfg = logic_ssvep_csp_fast_analysis.run( acquisition_helper.get_file_path(f_dir, f_name), self.use_channels, self.ignore_channels, self.montage, self.montage_channels, self.mode in ['offline', 'manual'], True, context) maybe_buffer = self.config.get_param('buffer_len') if len(maybe_buffer) > 0: self.logger.info("Overwrite csp buffer len:"+str(cfg['buffer'])+"with from config:"+str(maybe_buffer)) cfg['buffer'] = float(maybe_buffer) self.finish(cfg)
def __init__(self, addresses): super(UgmEnginePeer, self).__init__(addresses=addresses, type=peers.UGM_ENGINE_PEER) context = ctx.get_new_context() context['logger'] = self.logger connection = ugm_blinking_connection.UgmBlinkingConnection(settings.MULTIPLEXER_ADDRESSES, context) ENG = ugm_engine.UgmEngine( ugm_config_manager.UgmConfigManager(self.config.get_param('ugm_config')), connection, context) srv = ugm_internal_server.UdpServer( ENG, self.get_param('internal_ip'), int(self.get_param('use_tagger')), context ) self.set_param('internal_port', str(srv.socket.getsockname()[1])) thread.start_new_thread( srv.run, () ) self.ready() ENG.run()
def __init__(self, addresses): super(UgmBlinkingEnginePeer, self).__init__(addresses=addresses, type=peers.UGM_ENGINE_PEER) context = ctx.get_new_context() context['logger'] = self.logger connection = ugm_blinking_connection.UgmBlinkingConnection(settings.MULTIPLEXER_ADDRESSES, context) ENG = ugm_blinking_engine.UgmBlinkingEngine( ugm_config_manager.UgmConfigManager(self.config.get_param('ugm_config')), connection, context) ENG.set_configs(DummyClient(self.config.param_values())) srv = ugm_internal_server.UdpServer( ENG, self.config.get_param('internal_ip'), int(self.config.get_param('use_tagger')), context ) self.set_param('internal_port', str(srv.socket.getsockname()[1])) thread.start_new_thread( srv.run, () ) self.ready() ENG.run()
def __init__(self, addresses): LogicSpeller.__init__(self, addresses=addresses) context = ctx.get_new_context() context['logger'] = self.logger RobotEngine.__init__(self, self.config.param_values(), context) self.ready()