4 Make some plots from simulation output 8 import matplotlib.pyplot
as plt
12 plot data from Numpy*Saver files 17 fp = numpy.load(filename)
18 frame = fp[
'frame__0'].T
19 channels = fp[
'channels__0']
20 chd = channels[1:] - channels[:-1]
21 chjumps = [0] + list(numpy.where(chd>1)[0]) + [channels.size-1]
22 indjumps =
zip(chjumps[:-1], chjumps[1:])
24 njumps = len(indjumps)
25 fig, axes = plt.subplots(nrows=njumps, ncols=1)
29 for ax, (ind1, ind2)
in zip(axes, indjumps):
30 ch1 = channels[ind1+1]
33 extent = (tick1, tick2, ch2, ch1)
35 print (
"array ind: [%4d,%4d] channels: [%4d,%4d] %d" % (ind1,ind2, ch1, ch2, ind2-ind1+1))
36 im = ax.imshow(frame[ind1+1:ind2,tick1:tick2],aspect=
'auto')
37 plt.colorbar(im, ax=ax)
42 if '__main__' == __name__:
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
def numpy_saver(filename, outfile)