Skip to content

Commit caf3ecc

Browse files
committed
updates to gallery
1 parent 8ec58f7 commit caf3ecc

File tree

5 files changed

+29
-8
lines changed

5 files changed

+29
-8
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,8 @@ doc/*.plx
7676
doc/*.nev
7777
doc/*.ns5
7878
doc/*.nix
79-
doc/*.nwb
79+
doc/*.nwb
80+
*.plx
81+
*.smr
82+
B95.zip
83+
grouped_ephys

doc/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@
252252
)
253253

254254
sphinx_gallery_conf = {
255+
'only_warn_on_example_error': True, # helps with debugging broken examples
255256
"examples_dirs": "../../examples", # path to your example scripts
256257
"gallery_dirs": "examples", # path to where to save gallery generated output
257258
}

examples/igorio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@
2929
plt.plot(signal.times, signal)
3030
plt.xlabel(signal.sampling_period.dimensionality)
3131
plt.ylabel(signal.dimensionality)
32+
33+
plt.show()

examples/imageseq.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
image_seq = ImageSequence(l, sampling_rate=500 * pq.Hz, spatial_scale="m", units="V")
2525

2626
result = image_seq.signal_from_region(
27-
CircularRegionOfInterest(50, 50, 25),
28-
CircularRegionOfInterest(10, 10, 5),
29-
PolygonRegionOfInterest((50, 25), (50, 45), (14, 65), (90, 80)),
27+
CircularRegionOfInterest(image_seq,50, 50, 25),
28+
CircularRegionOfInterest(image_seq, 10, 10, 5),
29+
PolygonRegionOfInterest(image_seq,(50, 25), (50, 45), (14, 65), (90, 80)),
3030
)
3131

3232
for i in range(len(result)):

examples/roi_demo.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,24 @@
66

77
import matplotlib.pyplot as plt
88
import numpy as np
9-
from neo.core import CircularRegionOfInterest, RectangularRegionOfInterest, PolygonRegionOfInterest
9+
from neo.core import CircularRegionOfInterest, RectangularRegionOfInterest, PolygonRegionOfInterest, ImageSequence
1010
from numpy.random import rand
11+
import random
12+
import quantities as pq
1113

1214

15+
# First we create our image_sequence. Let's generate some data
16+
17+
l = []
18+
for frame in range(50):
19+
l.append([])
20+
for y in range(100):
21+
l[frame].append([])
22+
for x in range(100):
23+
l[frame][y].append(random.randint(0, 50))
24+
25+
image_seq = ImageSequence(l, sampling_rate=500 * pq.Hz, spatial_scale="m", units="V")
26+
1327
def plot_roi(roi, shape):
1428
img = rand(120, 100)
1529
pir = np.array(roi.pixels_in_region()).T
@@ -22,17 +36,17 @@ def plot_roi(roi, shape):
2236
ax.add_artist(shape)
2337

2438

25-
roi = CircularRegionOfInterest(x=50.3, y=50.8, radius=30.2)
39+
roi = CircularRegionOfInterest(image_sequence=image_seq, x=50.3, y=50.8, radius=30.2)
2640
shape = plt.Circle(roi.centre, roi.radius, color="r", fill=False)
2741
plt.subplot(1, 3, 1)
2842
plot_roi(roi, shape)
2943

30-
roi = RectangularRegionOfInterest(x=50.3, y=40.2, width=40.1, height=50.3)
44+
roi = RectangularRegionOfInterest(image_sequence=image_seq, x=50.3, y=40.2, width=40.1, height=50.3)
3145
shape = plt.Rectangle((roi.x - roi.width / 2.0, roi.y - roi.height / 2.0), roi.width, roi.height, color="r", fill=False)
3246
plt.subplot(1, 3, 2)
3347
plot_roi(roi, shape)
3448

35-
roi = PolygonRegionOfInterest((20.3, 30.2), (80.7, 30.1), (55.2, 59.4))
49+
roi = PolygonRegionOfInterest(image_seq, (20.3, 30.2), (80.7, 30.1), (55.2, 59.4))
3650
shape = plt.Polygon(np.array(roi.vertices), closed=True, color="r", fill=False)
3751
plt.subplot(1, 3, 3)
3852
plot_roi(roi, shape)

0 commit comments

Comments
 (0)