Exemple #1
0
 def __init__(self, retina=None):
   Projector.__init__(self, retina)
   
   # Neuron to monitor
   self.testRodIdx = 0
   self.testRod = self.target.rods.neurons[self.testRodIdx]
   self.logger.info("Test rod [{}]: {}".format(self.testRodIdx, self.testRod))
   
   # Plotting
   if self.do_plot:
     self.logger.info("Plotting is enabled")
     self.fig = figure()
     hold(True)
     self.ax = self.fig.gca()
     self.ax.set_ylim(action_potential_trough.mu - 0.01, action_potential_peak + 0.02)
     self.ax.set_title("Neuron")
     self.ax.set_xlabel("Time (s)")
     self.ax.set_ylabel("Membrane potential (V)")
Exemple #2
0
 def process(self, imageIn, timeNow):
   keepRunning, imageOut = Projector.process(self, imageIn, timeNow)
   self.testRod.p = 1.0  # make sure it updated every iteration
   if self.do_plot:
     self.testRod.plot()
     pause(0.01)
   print "{}\t{}\t{}\t{}\t{}\t{}".format(timeNow, self.testRod.response, self.testRod.potential, self.testRod.I_e, self.testRod.expDecayFactor, self.testRod.pixelValue)  # [debug, non-GUI]
   #print "{}\t{}\t{}\t{}".format(timeNow, self.testRod.potential, self.testRod.expDecayFactor, self.testRod.pixelValue)  # [debug, non-GUI, for BipolarCells]
   #cv2.circle(imageOut, (self.testRod.pixel[0], self.testRod.pixel[1]), 3, np.uint8([255, 0, 255]))
   imageOut[self.testRod.pixel[1], self.testRod.pixel[0]] = np.uint8([255, 0, 255])
   return keepRunning, imageOut
Exemple #3
0
 def onKeyPress(self, key, keyChar=None):
   if keyChar == '.':
     self.testRodIdx = (self.testRodIdx + 1) % len(self.target.rods.neurons)
     self.testRod = self.target.rods.neurons[self.testRodIdx]
     self.logger.info("[>] Test rod [{}]: {}".format(self.testRodIdx, self.testRod))
   elif keyChar == ',':
     self.testRodIdx = (self.testRodIdx - 1) % len(self.target.rods.neurons)
     self.testRod = self.target.rods.neurons[self.testRodIdx]
     self.logger.info("[<] Test rod [{}]: {}".format(self.testRodIdx, self.testRod))
   else:
     return Projector.onKeyPress(self, key, keyChar)
   return True