Skip to content

Commit e5e0a31

Browse files
authored
Merge branch 'NeuralEnsemble:master' into core-docstrings
2 parents a6fbbc4 + e9b57b0 commit e5e0a31

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1529
-967
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
}

doc/source/contributing.rst

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,28 @@ The first time this is run, all of the Neo test files will be downloaded to your
208208
so the run time can be an hour or more.
209209
For subsequent runs, the files are already there, so the tests will run much faster.
210210

211+
Because Neo downloads datasets this can lead to issues in the course of offline development or
212+
for packaging Neo (e.g. for a Linux distribution). In order to not download datasets and to skip
213+
tests which require downloaded datasets the environment variable :code:`NEO_TESTS_NO_NETWORK` can
214+
be set to any truthy value (e.g. :code:`'True'``).
215+
216+
For macOS/Linux this can be done by doing:
217+
218+
.. code-block:: bash
219+
220+
NEO_TESTS_NO_NETWORK='True' pytest .
221+
222+
For Windows this can be done by doing:
223+
224+
.. code-block:: bat
225+
226+
set NEO_TESTS_NO_NETWORK=true
227+
228+
pytest .
229+
230+
This can also be done with a conda environment variable if developing in a conda env. To configure these
231+
see the docs at `conda env vars documentation`_.
232+
211233
It is often helpful to run only parts of the test suite. To test only the :mod:`neo.core` module,
212234
which is much quicker than testing :mod:`neo.io`, run::
213235

@@ -465,4 +487,5 @@ Making a release
465487
.. _PyPI: https://pypi.org/project/neo
466488
.. _`continuous integration server`: https://github.com/NeuralEnsemble/python-neo/actions
467489
.. _`Read the Docs`: https://neo.readthedocs.io/en/latest/
468-
.. _`docs configuration page`: https://readthedocs.org/projects/neo/
490+
.. _`docs configuration page`: https://readthedocs.org/projects/neo/
491+
.. _`conda env vars documentation`: https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#activating-an-environment

environment_testing.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ name: neo-test-env
22
channels:
33
- conda-forge
44
dependencies:
5+
- python=3.9
56
- datalad
67
- pip

examples/generated_data.py

Lines changed: 0 additions & 128 deletions
This file was deleted.

examples/imageseq.py

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,21 @@
33
===========================
44
55
"""
6-
6+
###########################################################
7+
# Import our packages
78
import os
89
from urllib.request import urlretrieve
910
import zipfile
1011
import matplotlib.pyplot as plt
1112
from neo.io import get_io
1213

13-
14+
#############################################################
15+
# Then download some data
1416
# Downloaded from Human Brain Project Collaboratory
1517
# Digital Reconstruction of Neocortical Microcircuitry (nmc-portal)
1618
# http://microcircuits.epfl.ch/#/animal/8ecde7d1-b2d2-11e4-b949-6003088da632
19+
20+
1721
datafile_url = "https://microcircuits.epfl.ch/data/released_data/B95.zip"
1822
filename_zip = "B95.zip"
1923
filename = "grouped_ephys/B95/B95_Ch0_IDRest_107.ibw"
@@ -23,9 +27,14 @@
2327
zip_ref.extract(path=".", member=filename) # extract file to dir
2428
zip_ref.close()
2529

26-
30+
######################################################
31+
# Once we have our data we can use `get_io` to find an
32+
# io (Igor in this case). Then we read the analogsignals
33+
# Finally we will make some nice plots
2734
reader = get_io(filename)
2835
signal = reader.read_analogsignal()
2936
plt.plot(signal.times, signal)
3037
plt.xlabel(signal.sampling_period.dimensionality)
3138
plt.ylabel(signal.dimensionality)
39+
40+
plt.show()

examples/plot_imageseq.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
"""
2+
ImageSequences
3+
==============
4+
5+
"""
6+
7+
##########################################################
8+
# Let's import some packages
9+
10+
from neo.core import ImageSequence
11+
from neo.core import RectangularRegionOfInterest, CircularRegionOfInterest, PolygonRegionOfInterest
12+
import matplotlib.pyplot as plt
13+
import quantities as pq
14+
15+
import random
16+
17+
18+
############################################################
19+
# Now we need to generate some data
20+
# We will just make a nice box and then we can attach this
21+
# ImageSequence to a variety of ROIs
22+
# our ImageSequence will be 50 frames of 100x100 pixel images
23+
24+
l = []
25+
for frame in range(50):
26+
l.append([])
27+
for y in range(100):
28+
l[frame].append([])
29+
for x in range(100):
30+
l[frame][y].append(random.randint(0, 50))
31+
32+
#####################################################################
33+
# we then make our image sequence and pull out our results from the
34+
# image_seq
35+
36+
image_seq = ImageSequence(l, sampling_rate=500 * pq.Hz, spatial_scale="m", units="V")
37+
38+
result = image_seq.signal_from_region(
39+
CircularRegionOfInterest(image_seq,50, 50, 25),
40+
CircularRegionOfInterest(image_seq, 10, 10, 5),
41+
PolygonRegionOfInterest(image_seq,(50, 25), (50, 45), (14, 65), (90, 80)),
42+
)
43+
44+
###############################################################
45+
# It is easy to plot our results using matplotlib
46+
47+
for i in range(len(result)):
48+
plt.figure()
49+
plt.plot(result[i].times, result[i])
50+
plt.xlabel("seconde")
51+
plt.ylabel("valeur")
52+
plt.tight_layout()
53+
plt.show()

0 commit comments

Comments
 (0)