#---------------------------------------------------------------------------- # Raster plot #---------------------------------------------------------------------------- labels = ['PY', 'IN', 'TC', 'RE'] y = [50, 150, 250, 350] fig_handle = pyplot.figure(figsize=(8, 4)) ax = fig_handle.add_subplot(111) ax.set_title('Raster plot') ax.set_xlabel('$t$ (ms)') # Note LaTeX ax.set_yticks([]) sp = spikeplot.SpikePlot(fig=fig_handle) sp.set_markerscale(2) sp.set_marker('.') PYspikes = spiketrain.netconvecs_to_listoflists(PYtimevec, PYidvec) sp.set_markercolor('black') sp.plot_spikes(PYspikes, draw=False, label='PY') INspikes = spiketrain.netconvecs_to_listoflists(INtimevec, INidvec) sp.set_markercolor('blue') sp.plot_spikes(INspikes, cell_offset=len(PYspikes), label='IN') TCspikes = spiketrain.netconvecs_to_listoflists(TCtimevec, TCidvec) sp.set_markercolor('red') sp.plot_spikes(TCspikes, cell_offset=len(PYspikes) + len(INspikes), label='TC') REspikes = spiketrain.netconvecs_to_listoflists(REtimevec, REidvec) sp.set_markercolor('green') sp.plot_spikes(REspikes, cell_offset=len(PYspikes) + len(INspikes) + len(TCspikes),
def get_spikes(self): """Get the spikes as a list of lists.""" return spiketrain.netconvecs_to_listoflists(self.t_vec, self.id_vec)
out_msg = mj2py.mujoco_msg() joint = out_msg.joint.add() joint.qpos = h.t out_msg_str = out_msg.SerializeToString() socket.send(out_msg_str) for b in range(int(sim_steps_per_frame)): h.fadvance() #print("Advancing...") #os.system('cls') print("Running ... %2.2f %% left" % (100*a/num_iterations)) spikes = spiketrain.netconvecs_to_listoflists(t_vec, id_vec) spikes = list(reversed(spikes)) tendon_names = [in_msg.tend[a].name for a in range(N)] tendon_names = list(reversed(tendon_names)) blank = [" "]; labels = blank + tendon_names # Plotting fig1, axarr1 = pyplot.subplots(N, sharex=True) fig1.set_size_inches(6,15) fig2, axarr2 = pyplot.subplots(N, sharex=True) fig2.set_size_inches(6,15) fig3, axarr3 = pyplot.subplots(N, sharex=True) fig3.set_size_inches(6,15)