示例#1
0
 def initPanel(self):
     _logger.info('initPanel')
     self.addHandler()
     g_statsCollector.eventHandlers += self.onEvent
     g_statsCollector.start()
     g_statsCollector.updateArenaInfo()
     clientStatus = g_statsCollector.clientStatus
     self.__panels = []
     self.__keyHandlers = {}
     for paneldef in self.__config.get('panelDefs', []):
         if paneldef['channel'] == 'indicator':
             panel = StatsIndicator(paneldef, clientStatus)
             if 'events' in paneldef:
                 self.__eventHandlers += panel.onEvent
             else:
                 self.__intervalHandlers += panel.update
             if 'toggleKey' in paneldef['style']:
                 keyName = paneldef['style']['toggleKey']
                 keyId = getattr(Keys, keyName)
                 if keyId not in self.__keyHandlers:
                     self.__keyHandlers[keyId] = Event()
                 self.__keyHandlers[keyId] += panel.toggle
         elif paneldef['channel'] == 'status':
             panel = StatsLogger(paneldef, clientStatus)
             self.__intervalHandlers += panel.update
         elif paneldef['channel'] == 'event':
             panel = EventLogger(paneldef, clientStatus)
             self.__eventHandlers += panel.onEvent
         self.__panels.append(panel)
     session = dependency.instance(IBattleSessionProvider)
     ctrl = session.shared.crosshair
     self.changeView(ctrl.getViewID())
     self.updateScreenPosition()
     self.updateCrosshairPosition()
示例#2
0
 def __init__(self, nParticipant, from_file = False):
     self.nParticipant = nParticipant
     self.events = EventLogger()
     self.ratings = ParticipantRatings(self.nParticipant)
     self.featureVectors = {}  #  {1:{'Fp1_theta': 2453476, 'Fp1_slow_alpha': 482418, ... , 'avgSkinRes': 69'}}
     self.featureDF = pd.DataFrame  #  use special function
     self.Y = {}
     for trial in range(1,41):
         self.featureVectors[trial] = {}
         self.Y[trial] = 0
     #  seed and variables for splitting data
     self.randomSeed = random.randint(1, 1000000)
     self.X_train = {}
     self.X_test = {}
     self.X_validation = {}
     self.Y_train = {}
     self.Y_test = {}
     self.Y_validation = {}
     #  if we not use precomputed feature from file - compute it from raw signals
     if not from_file:
         self.ratings = ParticipantRatings(self.nParticipant)
         self.physSignalsFeatures = ParticipantSignalsFeatures(self.nParticipant)
         self.physSignalsFeatures.computeFeatures(range(1, 41), range(1, 33), BANDS, FREQ, 0, 8063,
                                                  ASYM_ELECTRODE_PAIRS, ASYM_BANDS)
     else:
         self.loadFeatureVectorsFromCSV()
         self.convertFeatureVectorsToDataFrame()
示例#3
0
 def __init__(self, nParticipant, from_file = False):
     self.nParticipant = nParticipant
     self.events = EventLogger()
     self.ratings = ParticipantRatings(self.nParticipant)
     self.featureVectors = {}  #
     self.featureDF = pd.DataFrame  # use special function
     self.Y = {}
     for trial in range(1, 41):
         self.featureVectors[trial] = {}
         self.Y[trial] = 0
     #  seed and variables for splitting data
     self.randomSeed = random.randint(1, 1000000)
     self.X_train = {}
     self.X_test = {}
     self.X_validation = {}
     self.Y_train = {}
     self.Y_test = {}
     self.Y_validation = {}
     #  if we not use precomputed feature from file - compute it from raw signals
     if not from_file:
         self.featureVectors = self.unpackEEGDataToVectors()
     else:
         self.loadFeatureVectorsFromCSV()
         self.convertFeatureVectorsToDataFrame()