Exemplo n.º 1
0
    def __init__(self, addresses):
        #Create a helper object to get configuration from the system
        super(BCIP300Fda, self).__init__(addresses=addresses,
                                          type=peers.P300_ANALYSIS)
        #get stats from file
        cfg = self._get_csp_config()
        cfg['pPercent'] = float(self.config.get_param('analysis_treshold'))
        cfg['nMin'] = int(self.config.get_param("n_min"))
        cfg['nMax'] = int(self.config.get_param("n_max"))
        cfg['nLast'] = int(self.config.get_param("n_last"))
        
        cfg['debug_flag'] = int(self.config.get_param('debug_flag'))

        cfg['row'] = int(self.config.get_param('row_count'))
        cfg['col'] = int(self.config.get_param('col_count'))
        row, col = cfg['row'], cfg['col']
        #~ row = cfg['row_count'] = 6
        #~ col = cfg['col_count'] = 6
      
        print "\n"*5
        self.logger.info("COL = " + str(col) + "\n" + "ROW = " +str(row) )
        print "\n"*5

        
        montage_matrix = self._get_montage_matrix(cfg)
            
        #dec_count = int(self.config.get_param('dec_count'))

        #Create analysis object to analyse data 
        self.analysis = self._get_analysis(self.send_decision, cfg, montage_matrix)

        #Initialise round buffer that will supply analysis with data
        #See auto_ring_buffer documentation
        sampling = int(self.config.get_param('sampling_rate'))
        channels_count = len(self.config.get_param('channel_names').split(';'))
        self.buffer = auto_blink_buffer.AutoBlinkBuffer(
            from_blink=0,
            samples_count=int(float(cfg['buffer'])),
            sampling=sampling,
            num_of_channels=channels_count,
            ret_func=self.analysis.analyse,
            ret_format=self.config.get_param('buffer_ret_format'),
            copy_on_ret=int(self.config.get_param('buffer_copy_on_ret'))
            )
        
        self.hold_after_dec = float(self.config.get_param('hold_after_dec'))
        if DEBUG:
            self.debug = streaming_debug.Debug(int(self.config.get_param('sampling_rate')),
                                               self.logger,
                                               int(self.config.get_param('samples_per_packet')))
                                                   
        self._last_dec_time = time.time() + 1 #sleep 5 first seconds..
        ugm_helper.send_start_blinking(self.conn)
        self.ready()
        self.logger.info("BCIAnalysisServer init finished!")
Exemplo n.º 2
0
    def __init__(self, addresses):
        #Create a helper object to get configuration from the system
        super(BCIP300Csp, self).__init__(addresses=addresses,
                                         type=peers.P300_ANALYSIS)
        #get stats from file
        cfg = self._get_csp_config()
        #~ cfg['pVal'] = float(self.config.get_param('analysis_treshold'))

        montage_matrix = self._get_montage_matrix(cfg)

        #dec_count = int(self.config.get_param('dec_count'))

        #Create analysis object to analyse data
        self.analysis = self._get_analysis(self.send_results, cfg,
                                           montage_matrix)

        #Initialise round buffer that will supply analysis with data
        #See auto_ring_buffer documentation
        sampling = int(self.config.get_param('sampling_rate'))
        channels_count = len(self.config.get_param('channel_names').split(';'))
        self.buffer = auto_blink_buffer.AutoBlinkBuffer(
            from_blink=0,
            samples_count=int(float(cfg['buffer'])),
            sampling=sampling,
            num_of_channels=channels_count,
            ret_func=self.analysis.analyse,
            ret_format=self.config.get_param('buffer_ret_format'),
            copy_on_ret=int(self.config.get_param('buffer_copy_on_ret')))

        self.hold_after_dec = float(self.config.get_param('hold_after_dec'))
        if DEBUG:
            self.debug = streaming_debug.Debug(
                int(self.config.get_param('sampling_rate')), LOGGER,
                int(self.config.get_param('samples_per_packet')))

        self._last_dec_time = time.time() + 1  #sleep 5 first seconds..
        ugm_helper.send_start_blinking(self.conn)
        self.ready()
        LOGGER.info("BCIAnalysisServer init finished!")