def plotMotorPotAlpha(outValues, parent): (subsample, nplot, naxis)=plotparams(Tsim, Tplot, len(outValues)) if subsample > 1: alpha = sig.ListSignalSampled([motorAngleAlpha(x[0][1]) for x in outValues],subsample) else: alpha = sig.ListSignal([motorAngleAlpha(x[0][1]) for x in outValues]) alpha.plot(end = nplot, color = 'red', parent = parent, newWindow = 'Motor pot alpha '+str(plotno), xmaxlabel = naxis) # bkph plotWindows.append(alpha._Signal__w)
def plotMotorVelocity(outValues, parent): (subsample, nplot, naxis)=plotparams(Tsim, Tplot, len(outValues)) if subsample > 1: vel = sig.ListSignalSampled([x[0][0] for x in outValues],subsample) else: vel = sig.ListSignal([x[0][0] for x in outValues]) vel.plot(end = nplot, color = 'red', parent = parent, newWindow = 'Motor rotational velocity '+str(plotno), xmaxlabel = naxis) # bkph plotWindows.append(vel._Signal__w)
def plotAnalogOutputs(inValues, parent): (subsample, nplot, naxis)=plotparams(Tsim, Tplot, len(inValues)) for source in ('analog',): if source in inValues[0]: if subsample > 1: inp = sig.ListSignalSampled([d[source] for d in inValues],subsample) else: inp = sig.ListSignal([d[source] for d in inValues]) inp.plot(end = nplot, color = 'blue', parent = parent, newWindow = '%s output voltage '%inp+str(plotno), xmaxlabel = naxis) # bkph plotWindows.append(inp._Signal__w)
def plotProbes(probes, sols, parent): if not probes: return (subsample, nplot, naxis)=plotparams(Tsim, Tplot, len(sols)) vals = [nodeVals(sol, probes) for sol in sols] if subsample > 1: probe = sig.ListSignalSampled([v[0] - v[1] for v in vals], subsample) else: probe = sig.ListSignal([v[0] - v[1] for v in vals]) probe.plot(end = nplot, color = 'green', parent = parent, newWindow = 'Probe voltage '+str(plotno), xmaxlabel = naxis) # bkph plotWindows.append(probe._Signal__w)
def plotAnalogInputs(inputs, sols, parent): if not inputs: return (subsample, nplot, naxis)=plotparams(Tsim, Tplot, len(sols)) vals = [nodeVals(sol, [n for (i, n) in inputs]) for sol in sols] for i, (pin, node) in enumerate(inputs): if subsample > 1: inp = sig.ListSignalSampled([v[i] for v in vals],subsample) else: inp = sig.ListSignal([v[i] for v in vals]) inp.plot(end = nplot, color = 'green', parent = parent, newWindow = 'Analog input %s voltage '%(pin+1)+str(plotno), xmaxlabel = naxis) # bkph plotWindows.append(inp._Signal__w)
def plotInputs(inValues, parent): (subsample, nplot, naxis)=plotparams(Tsim, Tplot, len(inValues)) for (inp, title) in (('pot1', 'pot1 alpha '), ('pot2', 'pot2 alpha '), ('lightAngle', 'light angle ')): if inp in inValues[0]: values = [d[inp] for d in inValues] if subsample > 1: inp = sig.ListSignalSampled(values,subsample) else: inp = sig.ListSignal(values) inp.plot(end = nplot, color = 'blue', parent = parent, newWindow = "Input "+title+str(plotno), xmaxlabel = naxis) # bkph plotWindows.append(inp._Signal__w)