26 parser = argparse.ArgumentParser(description=
'Plot spike times')
29 parser.add_argument(
"files", metavar=
"files", nargs=
'+', help=
"files to plot")
32 parser.add_argument(
"-s", type=str, help=
"Name of the simulator", default=
"")
33 parser.add_argument(
"-p", help=
"Save as png instead of pdf",
34 default=
False, action=
"store_true")
36 args = parser.parse_args()
39 import matplotlib.pyplot
as plt
40 from matplotlib.ticker
import MaxNLocator
43 from dim_labels
import *
49 for ith, trial
in enumerate(spikes):
50 plt.vlines(trial, ith + .5, ith + 1.5, color=
"#000000", lw=0.5)
51 ax.set_ylim(.5, len(spikes) + .5)
53 ax.set_title(
"Spike Times")
55 ax.set_title(
"Spike Times for " + SIMULATOR_LABELS[simulator])
56 ax.set_xlabel(DIM_LABELS[
"time"])
57 ax.set_ylabel(DIM_LABELS[
"neuron id"])
59 ax.yaxis.set_major_locator(MaxNLocator(integer=
True))
64 for target_file
in args.files:
67 with open(target_file)
as file:
70 for entry
in line.split(
","):
72 data2.append(
float(entry))
80 fig.savefig(target_file.split(
".csv")[0] +
".png", format=
'png',
81 dpi=600, bbox_inches=
'tight')
83 fig.savefig(target_file.split(
".csv")[0] +
".pdf", format=
'pdf',
def raster_plot(spikes, simulator)