def on_stop(): if not REAL_ROBOT: code = checkoff.generate_code(globals()) if isinstance(code, bytes): code = code.decode() print("Hex Code for Tutor:\n%s" % code, file=sys.stderr) p = PlotWindow() p.plot(robot.probMeasures) p.axes[0].set_ylim([0.0, 1.0])
def on_stop(): if not REAL_ROBOT: code = checkoff.generate_code(globals()) if isinstance(code, bytes): code = code.decode() print("Hex Code for Tutor:\n%s" % code, file=sys.stderr) p = PlotWindow() p.plot(robot.probMeasures) p.axes[0].set_ylim([0.0,1.0])
def plot(self, data): t_samples, probe_samples = [], [] for t, solution in data.items(): # ensure that the probes are in the solved circuits assert self._probe_plus in solution, ('+probe is disconnected from ' 'circuit') assert self._probe_minus in solution, ('-probe is disconnected from ' 'circuit') t_samples.append(t) probe_samples.append( solution[self._probe_plus] - solution[self._probe_minus]) probe_plot = PlotWindow('Probe voltage difference') probe_plot.stem(t_samples, probe_samples)
def plot(self, data): # motor angle angle_plot = PlotWindow('Motor %s angle' % self._motor.label) angle_plot.stem(T_SAMPLES, self._motor.angle_samples[:-1]) # motor speed speed_plot = PlotWindow('Motor %s speed' % self._motor.label) speed_plot.stem(T_SAMPLES, self._motor.speed_samples[:-1])
def plot(self, data): t_samples, probe_samples = [], [] for t, solution in data.items(): # ensure that the probes are in the solved circuits assert self._probe_plus in solution, ( '+probe is disconnected from ' 'circuit') assert self._probe_minus in solution, ( '-probe is disconnected from ' 'circuit') t_samples.append(t) probe_samples.append(solution[self._probe_plus] - solution[self._probe_minus]) probe_plot = PlotWindow('Probe voltage difference') probe_plot.stem(t_samples, probe_samples)
def myPlot(s,title,y0,y1): if nSamples>1: samps = [s.sample(x) for x in xrange(nSamples)] yy0 = min(samps) yy1 = max(samps) if float(yy1-y0)/float(y1-y0+.001)>0.9: y1 = yy1 if float(y1-yy0)/float(y1-y0+.001)>0.9: y0 = yy0 p = PlotWindow(title) p.stem(range(nSamples),samps) p.axis([0,nSamples,y0,y1]) add_window(p) warning = str(title)+':' for nn in range(nSamples): warning += '{0:6.2f}'.format(s.sample(nn)) warn(warning)
def plot(self, data): # motor if self._head_connector.motor_present: self._head_connector.motor.label = self._head_connector.motor_label Motor_Plotter(self._head_connector.motor).plot(data) # lamp distance signal if self._head_connector.lamp_distance_signal: distance_plot = PlotWindow('Lamp %s distance' % self._head_connector.photo_label) distance_plot.stem( T_SAMPLES, self._head_connector.lamp_distance_signal.samples( 0, T, NUM_SAMPLES)) # lamp angle signal if self._head_connector.lamp_angle_signal: angle_plot = PlotWindow('Lamp %s angle' % self._head_connector.photo_label) angle_plot.stem( T_SAMPLES, self._head_connector.lamp_angle_signal.samples( 0, T, NUM_SAMPLES))
def plot(self, data): # motor if self._head_connector.motor_present: self._head_connector.motor.label = self._head_connector.motor_label Motor_Plotter(self._head_connector.motor).plot(data) # lamp distance signal if self._head_connector.lamp_distance_signal: distance_plot = PlotWindow('Lamp %s distance' % self._head_connector.photo_label) distance_plot.stem(T_SAMPLES, self._head_connector.lamp_distance_signal.samples(0, T, NUM_SAMPLES)) # lamp angle signal if self._head_connector.lamp_angle_signal: angle_plot = PlotWindow('Lamp %s angle' % self._head_connector.photo_label) angle_plot.stem(T_SAMPLES, self._head_connector.lamp_angle_signal.samples( 0, T, NUM_SAMPLES))
def myPlot(s, title, y0, y1): if nSamples > 1: samps = [s.sample(x) for x in xrange(nSamples)] yy0 = min(samps) yy1 = max(samps) if float(yy1 - y0) / float(y1 - y0 + .001) > 0.9: y1 = yy1 if float(y1 - yy0) / float(y1 - y0 + .001) > 0.9: y0 = yy0 p = PlotWindow(title) p.stem(range(nSamples), samps) p.axis([0, nSamples, y0, y1]) add_window(p) warning = str(title) + ':' for nn in range(nSamples): warning += '{0:6.2f}'.format(s.sample(nn)) warn(warning)
def plot(self, data): alpha_plot = PlotWindow('Pot %s alpha' % self._pot.label) alpha_plot.stem(T_SAMPLES, self._pot.signal.samples(0, T, NUM_SAMPLES))
def brainStop(): p = PlotWindow() p.plot(robot.distance) # plot the list of distances
def brainStop(): p = PlotWindow('Slime Trail') soarWorld.plotSoarWorld(PATH_TO_WORLD,p) #show the soar world p.plot(robot.slimeX,robot.slimeY) #plot the recorded slime trail data
def brainStop(): p = PlotWindow() p.plot(robot.probMeasures) p.axes[0].set_ylim([0.0,1.0])
def brainStop(): p = PlotWindow('Slime Trail') soarWorld.plotSoarWorld(PATH_TO_WORLD, p) #show the soar world p.plot(robot.slimeX, robot.slimeY) #plot the recorded slime trail data
def stemplot(response): PlotWindow().stem(range(len(response)), response)
def brainStop(): p = PlotWindow() p.plot(robot.distance)