Skip to content

Commit 8dfbfc9

Browse files
authored
Merge branch 'master' into fix-broken-example
2 parents 5962a8a + b2a358a commit 8dfbfc9

26 files changed

+350
-181
lines changed

.github/workflows/caches_cron_job.yml

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,57 @@ on:
1010

1111
jobs:
1212

13-
create-conda-env-cache-if-missing:
14-
name: Caching conda env
15-
runs-on: "ubuntu-latest"
16-
strategy:
17-
fail-fast: true
18-
defaults:
19-
# by default run in bash mode (required for conda usage)
20-
run:
21-
shell: bash -l {0}
22-
steps:
23-
- uses: actions/checkout@v3
24-
25-
- name: Get current year-month
26-
id: date
27-
run: |
28-
echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT
29-
30-
- name: Get current dependencies hash
31-
id: dependencies
32-
run: |
33-
echo "hash=${{hashFiles('**/pyproject.toml', '**/environment_testing.yml')}}" >> $GITHUB_OUTPUT
34-
35-
- uses: actions/cache@v3
36-
# the cache for python package is reset:
37-
# * every month
38-
# * when package dependencies change
39-
id: cache-conda-env
40-
with:
41-
path: /usr/share/miniconda/envs/neo-test-env
42-
key: ${{ runner.os }}-conda-env-${{ steps.dependencies.outputs.hash }}-${{ steps.date.outputs.date }}
43-
44-
- name: Cache found?
45-
run: echo "Cache-hit == ${{steps.cache-conda-env.outputs.cache-hit == 'true'}}"
46-
47-
# activate environment if not restored from cache
48-
- uses: conda-incubator/[email protected]
49-
if: steps.cache-conda-env.outputs.cache-hit != 'true'
50-
with:
51-
activate-environment: neo-test-env
52-
environment-file: environment_testing.yml
53-
python-version: 3.9
54-
55-
- name: Create the conda environment to be cached
56-
if: steps.cache-conda-env.outputs.cache-hit != 'true'
57-
# create conda env, configure git and install pip, neo and test dependencies from master
58-
# for PRs that change dependencies, this environment will be updated in the test workflow
59-
run: |
60-
git config --global user.email "neo_ci@fake_mail.com"
61-
git config --global user.name "neo CI"
62-
python -m pip install -U pip # Official recommended way
63-
pip install --upgrade -e .[test]
13+
# create-conda-env-cache-if-missing:
14+
# name: Caching conda env
15+
# runs-on: "ubuntu-latest"
16+
# strategy:
17+
# fail-fast: true
18+
# defaults:
19+
# # by default run in bash mode (required for conda usage)
20+
# run:
21+
# shell: bash -l {0}
22+
# steps:
23+
# - uses: actions/checkout@v3
24+
25+
# - name: Get current year-month
26+
# id: date
27+
# run: |
28+
# echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT
29+
30+
# - name: Get current dependencies hash
31+
# id: dependencies
32+
# run: |
33+
# echo "hash=${{hashFiles('**/pyproject.toml', '**/environment_testing.yml')}}" >> $GITHUB_OUTPUT
34+
35+
# - uses: actions/cache@v3
36+
# # the cache for python package is reset:
37+
# # * every month
38+
# # * when package dependencies change
39+
# id: cache-conda-env
40+
# with:
41+
# path: /usr/share/miniconda/envs/neo-test-env
42+
# key: ${{ runner.os }}-conda-env-${{ steps.dependencies.outputs.hash }}-${{ steps.date.outputs.date }}
43+
44+
# - name: Cache found?
45+
# run: echo "Cache-hit == ${{steps.cache-conda-env.outputs.cache-hit == 'true'}}"
46+
47+
# # activate environment if not restored from cache
48+
# - uses: conda-incubator/[email protected]
49+
# if: steps.cache-conda-env.outputs.cache-hit != 'true'
50+
# with:
51+
# activate-environment: neo-test-env
52+
# environment-file: environment_testing.yml
53+
# python-version: 3.9
54+
55+
# - name: Create the conda environment to be cached
56+
# if: steps.cache-conda-env.outputs.cache-hit != 'true'
57+
# # create conda env, configure git and install pip, neo and test dependencies from master
58+
# # for PRs that change dependencies, this environment will be updated in the test workflow
59+
# run: |
60+
# git config --global user.email "neo_ci@fake_mail.com"
61+
# git config --global user.name "neo CI"
62+
# python -m pip install -U pip # Official recommended way
63+
# pip install --upgrade -e .[test]
6464

6565
create-data-cache-if-missing:
6666
name: Caching data env

.github/workflows/io-test.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,25 @@ jobs:
7676
# restore-key hits should result in `cache-hit` == 'false'
7777
#if: steps.cache-conda-env.outputs.cache-hit != 'true'
7878
run: |
79-
conda install datalad pip numpy=${{ matrix.numpy-version }} -c conda-forge
79+
conda install pip numpy=${{ matrix.numpy-version }} -c conda-forge
8080
# this command is for updating cache. We are resting removal.
8181
# conda env update --name neo-test-env-${{ matrix.python-version }} --file environment_testing.yml --prune
8282

83+
- name: Install git-annex
84+
# this is the trick from the spikeinterface repo for getting git-annex to work with datalad
85+
shell: bash
86+
run: |
87+
pip install datalad-installer
88+
wget https://downloads.kitenet.net/git-annex/linux/current/git-annex-standalone-amd64.tar.gz
89+
mkdir /home/runner/work/installation
90+
mv git-annex-standalone-amd64.tar.gz /home/runner/work/installation/
91+
workdir=$(pwd)
92+
cd /home/runner/work/installation
93+
tar xvzf git-annex-standalone-amd64.tar.gz
94+
echo "$(pwd)/git-annex.linux" >> $GITHUB_PATH
95+
cd $workdir
96+
git config --global filter.annex.process "git-annex filter-process" # recommended for efficiency
97+
8398
- name: Configure git
8499
run: |
85100
git config --global user.email "neo_ci@fake_mail.com"

doc/source/authors.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ and may not be the current affiliation of a contributor.
9090
* Xin Niu
9191
* Nikhil Chandra [40]
9292
* Luigi Petrucco [42]
93+
* Tommaso Lambresa [43]
94+
* Nina Kudryashova [37]
95+
* Rémi Proville [44]
9396

94-
1. Centre de Recherche en Neuroscience de Lyon, CNRS UMR5292 - INSERM U1028 - Universite Claude Bernard Lyon 1
97+
1. Centre de Recherche en Neuroscience de Lyon, CNRS UMR5292 - INSERM U1028 - Université Claude Bernard Lyon 1
9598
2. Unité de Neuroscience, Information et Complexité, CNRS UPR 3293, Gif-sur-Yvette, France
9699
3. University of California, Berkeley
97100
4. Laboratoire de Neurosciences Intégratives et Adaptatives, CNRS UMR 6149 - Université de Provence, Marseille, France
@@ -133,6 +136,8 @@ and may not be the current affiliation of a contributor.
133136
40. Plexon Inc.
134137
41. Paris Brain Institute
135138
42. Istituto Italiano di Tecnologia (IIT), Italy
139+
43. University of Genoa, Italy
140+
44. AquiNeuro, SAS
136141

137142

138143

neo/io/__init__.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
.. autoclass:: neo.io.MaxwellIO
168168
169169
.. autoattribute:: extensions
170-
170+
171171
.. autoclass:: neo.io.MedIO
172172
173173
.. autoattribute:: extensions
@@ -280,24 +280,17 @@
280280

281281
import pathlib
282282
from collections import Counter
283+
import importlib.util
283284

284-
# try to import the neuroshare library.
285+
# check if neuroshare library exists
285286
# if it is present, use the neuroshareapiio to load neuroshare files
286287
# if it is not present, use the neurosharectypesio to load files
287-
try:
288-
import neuroshare as ns
289-
except ModuleNotFoundError as err:
290-
from neo.io.neurosharectypesio import NeurosharectypesIO as NeuroshareIO
291288

292-
# print("\n neuroshare library not found, loading data with ctypes" )
293-
# print("\n to use the API be sure to install the library found at:")
294-
# print("\n www.http://pythonhosted.org/neuroshare/")
295-
296-
else:
289+
neuroshare_spec = importlib.util.find_spec("neuroshare")
290+
if neuroshare_spec is not None:
297291
from neo.io.neuroshareapiio import NeuroshareapiIO as NeuroshareIO
298-
299-
# print("neuroshare library successfully imported")
300-
# print("\n loading with API...")
292+
else:
293+
from neo.io.neurosharectypesio import NeurosharectypesIO as NeuroshareIO
301294

302295
from neo.io.alphaomegaio import AlphaOmegaIO
303296
from neo.io.asciiimageio import AsciiImageIO

neo/io/baseio.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@
1313

1414
from __future__ import annotations
1515
from pathlib import Path
16-
17-
try:
18-
from collections.abc import Sequence
19-
except ImportError:
20-
from collections import Sequence
16+
from collections.abc import Sequence
2117
import logging
2218

2319
from neo import logging_handler

neo/io/neomatlabio.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ def write_block(self, bl, **kargs):
281281
"""
282282
Arguments:
283283
bl: the block to be saved
284+
kargs: extra keyword arguments broadcasted to scipy.io.savemat
285+
284286
"""
285287
import scipy.io
286288

@@ -307,7 +309,7 @@ def write_block(self, bl, **kargs):
307309
else:
308310
group_structure[container_name].append(id(child_obj))
309311

310-
scipy.io.savemat(self.filename, {"block": bl_struct}, oned_as="row")
312+
scipy.io.savemat(self.filename, {"block": bl_struct}, oned_as="row", **kargs)
311313

312314
def _get_matlab_value(self, ob, attrname):
313315
units = None

neo/io/nixio.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
from uuid import uuid4
2828
import warnings
2929
from packaging.version import Version
30+
import importlib.util
31+
import importlib.metadata
3032

3133
import quantities as pq
3234
import numpy as np
@@ -122,17 +124,15 @@ def dt_from_nix(nixdt, annotype):
122124

123125

124126
def check_nix_version():
125-
try:
126-
import nixio
127-
except ImportError:
128-
raise Exception(
127+
nixio_spec = importlib.util.find_spec("nixio")
128+
if nixio_spec is None:
129+
raise ImportError(
129130
"Failed to import NIX. "
130131
"The NixIO requires the Python package for NIX "
131132
"(nixio on PyPi). Try `pip install nixio`."
132133
)
133134

134-
# nixio version numbers have a 'v' prefix which breaks the comparison
135-
nixverstr = nixio.__version__.lstrip("v")
135+
nixverstr = importlib.metadata.version("nixio")
136136
try:
137137
nixver = Version(nixverstr)
138138
except ValueError:

neo/io/stimfitio.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
08 Feb 2014, C. Schmidt-Hieber, University College London
2727
"""
2828

29+
import importlib.util
30+
2931
import numpy as np
3032
import quantities as pq
3133

@@ -92,7 +94,9 @@ def __init__(self, filename=None):
9294
"""
9395
# We need this module, so try importing now so that it fails on
9496
# instantiation rather than read_block
95-
import stfio # noqa
97+
stfio_spec = importlib.util.find_spec("stfio")
98+
if stfio_spec is None:
99+
raise ImportError("stfio must be installed to use StimfitIO")
96100

97101
BaseIO.__init__(self)
98102

neo/rawio/axonrawio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
strings section:
2424
[uModifierNameIndex, uCreatorNameIndex, uProtocolPathIndex, lFileComment, lADCCChannelNames, lADCUnitsIndex
2525
lDACChannelNameIndex, lDACUnitIndex, lDACFilePath, nLeakSubtractADC]
26-
['', 'Clampex', '', 'C:/path/protocol.pro', 'some comment', 'IN 0', 'mV', 'IN 1', 'mV', 'Cmd 0', 'pA',
26+
['', 'Clampex', '', 'C:/path/protocol.pro', 'some comment', 'IN 0', 'mV', 'IN 1', 'mV', 'Cmd 0', 'pA',
2727
'Cmd 1', 'pA', 'Cmd 2', 'mV', 'Cmd 3', 'mV']
2828
2929
Information on abf 1 and 2 formats is available here:

neo/rawio/blackrockrawio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ def __read_nsx_dataheader_variant_b(
979979
# use of `int` avoids overflow problem
980980
data_size = int(dh["nb_data_points"]) * int(self.__nsx_basic_header[nsx_nb]["channel_count"]) * 2
981981
# define new offset (to possible next data block)
982-
offset = data_header[index]["offset_to_data_block"] + data_size
982+
offset = int(data_header[index]["offset_to_data_block"]) + data_size
983983

984984
index += 1
985985

0 commit comments

Comments
 (0)