imageseq.py 963 B

12345678910111213141516171819202122232425262728293031
  1. from neo.core import ImageSequence
  2. from neo.core import RectangularRegionOfInterest, CircularRegionOfInterest, PolygonRegionOfInterest
  3. import matplotlib.pyplot as plt
  4. import quantities as pq
  5. import random
  6. # generate data
  7. l = []
  8. for frame in range(50):
  9. l.append([])
  10. for y in range(100):
  11. l[frame].append([])
  12. for x in range(100):
  13. l[frame][y].append(random.randint(0, 50))
  14. image_seq = ImageSequence(l, sampling_rate=500 * pq.Hz, spatial_scale='m', units='V')
  15. result = image_seq.signal_from_region(CircularRegionOfInterest(50, 50, 25),
  16. CircularRegionOfInterest(10, 10, 5),
  17. PolygonRegionOfInterest((50, 25), (50, 45), (14, 65),
  18. (90, 80)))
  19. for i in range(len(result)):
  20. plt.figure()
  21. plt.plot(result[i].times, result[i])
  22. plt.xlabel("seconde")
  23. plt.ylabel("valeur")
  24. plt.show()