forked from NeuralEnsemble/python-neo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimageseq.py
More file actions
31 lines (24 loc) · 963 Bytes
/
Copy pathimageseq.py
File metadata and controls
31 lines (24 loc) · 963 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from neo.core import ImageSequence
from neo.core import RectangularRegionOfInterest, CircularRegionOfInterest, PolygonRegionOfInterest
import matplotlib.pyplot as plt
import quantities as pq
import random
# generate data
l = []
for frame in range(50):
l.append([])
for y in range(100):
l[frame].append([])
for x in range(100):
l[frame][y].append(random.randint(0, 50))
image_seq = ImageSequence(l, sampling_rate=500 * pq.Hz, spatial_scale='m', units='V')
result = image_seq.signal_from_region(CircularRegionOfInterest(50, 50, 25),
CircularRegionOfInterest(10, 10, 5),
PolygonRegionOfInterest((50, 25), (50, 45), (14, 65),
(90, 80)))
for i in range(len(result)):
plt.figure()
plt.plot(result[i].times, result[i])
plt.xlabel("seconde")
plt.ylabel("valeur")
plt.show()