Skip to content

Commit 9708828

Browse files
Merge pull request #978 from samuelgarcia/gh_actions_and_datalad
Continue github actions.
2 parents cc22b0f + 5c2b419 commit 9708828

File tree

8 files changed

+37
-38
lines changed

8 files changed

+37
-38
lines changed

.github/workflows/full-test.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Full spikeinterface tests
1+
name: neo.io and neo.rawio tests
22

33
on:
44
pull_request:
@@ -18,14 +18,17 @@ jobs:
1818
- uses: actions/checkout@v2
1919
with:
2020
python-version: 3.8
21-
- name: Which python
22-
run: |
23-
which python
21+
- name: Get current year-month
22+
id: date
23+
run: echo "::set-output name=date::$(date+'%Y-%m')"
2424
- uses: actions/cache@v2
25+
# the cache for python package is reset:
26+
# * every month
27+
# * when requirements/requirements_testing change
2528
id: cache-venv
2629
with:
27-
path: ./test_env
28-
key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements_testing.txt') }}
30+
path: ~/test_env
31+
key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements_testing.txt') }}-${{ steps.date.outputs.date }}
2932
restore-keys: |
3033
${{ runner.os }}-venv-
3134
- name: Install dependencies
@@ -36,26 +39,27 @@ jobs:
3639
git config --global user.email "neo_ci@fake_mail.com"
3740
git config --global user.name "neo CI"
3841
# create an environement and install everything
39-
python -m venv test_env
40-
source ./test_env/bin/activate
42+
python -m venv ~/test_env
43+
source ~/test_env/bin/activate
4144
python -m pip install --upgrade pip
4245
pip install -r requirements.txt
4346
pip install -r requirements_testing.txt
4447
pip install -e .
48+
- name: Get ephy_testing_data current head hash
49+
# the key depend on the last comit repo https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git
50+
id: vars
51+
run: |
52+
echo "::set-output name=HASH_EPHY_DATASET::$(git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1)"
4553
- uses: actions/cache@v2
4654
id: cache-datasets
47-
env:
48-
# the key depend on the last comit repo https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git
49-
HASH_EPHY_DATASET: git ls-remote https://gin.g-node.org/NeuralEnsemble/ephy_testing_data.git HEAD | cut -f1
5055
with:
5156
path: ~/ephy_testing_data
52-
key: ${{ runner.os }}-datasets-${{ env.HASH_EPHY_DATASET }}
57+
key: ${{ runner.os }}-datasets-${{ steps.vars.outputs.HASH_EPHY_DATASET }}
5358
restore-keys: |
5459
${{ runner.os }}-datasets
5560
- name: Test with pytest
5661
run: |
57-
source ./test_env/bin/activate
58-
# onbly rawiotest is tested at the moment
62+
source ~/test_env/bin/activate
63+
# only neo.rawio and neo.io
5964
pytest --cov=neo neo/test/rawiotest
60-
# TODO uncomment this soon
61-
# pytest --cov=neo neo/test/iotest
65+
pytest --cov=neo neo/test/iotest

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ before_install:
3030
- pip install "numpy==$NUMPY_VERSION"
3131
install:
3232
- pip install -r requirements.txt
33+
- pip install nose
3334
- pip install coveralls
3435
- pip install .
3536
- pip install pillow

neo/io/kwikio.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,12 @@ def read_spiketrain(self, cluster_id, model,
198198
w = pq.Quantity(w, raw_data_units)
199199
else:
200200
w = None
201+
if model.duration > 0.:
202+
t_stop = model.duration
203+
else:
204+
t_stop = np.max(model.spike_times[idx])
201205
sptr = SpikeTrain(times=model.spike_times[idx],
202-
t_stop=model.duration, waveforms=w, units='s',
206+
t_stop=t_stop, waveforms=w, units='s',
203207
sampling_rate=model.sample_rate * pq.Hz,
204208
file_origin=self.filename,
205209
**{'cluster_id': cluster_id})

neo/test/iotest/common_io_test.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,6 @@ def able_to_write_or_read(self, writeread=False, readwrite=False):
176176

177177
return True
178178

179-
#~ def get_filename_path(self, filename):
180-
#~ '''
181-
#~ Get the path to a filename in the current temporary file directory
182-
#~ '''
183-
#~ return os.path.join(self.local_test_dir, filename)
184-
185179
def get_local_base_folder(self):
186180
return get_local_testing_data_folder()
187181

neo/test/iotest/test_nixio.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ def rquant(shape, unit, incr=False):
711711

712712
@classmethod
713713
def create_all_annotated(cls):
714-
times = cls.rquant(10, pq.s)
714+
times = cls.rquant(10, pq.s, incr=True)
715715
times_ann = {cls.rword(6): cls.rquant(10, pq.ms)}
716716
signal = cls.rquant((10, 10), pq.V)
717717
signal_ann = {cls.rword(6): cls.rquant(10, pq.uV)}
@@ -744,8 +744,8 @@ def create_all_annotated(cls):
744744
event.annotate(**cls.rdict(4))
745745
seg.events.append(event)
746746

747-
spiketrain = SpikeTrain(times=times, t_stop=pq.s, units=pq.s,
748-
array_annotations=times_ann)
747+
spiketrain = SpikeTrain(times=times, t_stop=10*pq.s,
748+
units=pq.s, array_annotations=times_ann)
749749
d = cls.rdict(6)
750750
d["quantity"] = pq.Quantity(10, "mV")
751751
d["qarray"] = pq.Quantity(range(10), "mA")
@@ -859,7 +859,7 @@ def test_signals_write(self):
859859
anotherblock.segments.append(seg)
860860
irsig = IrregularlySampledSignal(
861861
signal=np.random.random((20, 30)),
862-
times=self.rquant(20, pq.ms, True),
862+
times=self.rquant(20, pq.ms, incr=True),
863863
units=pq.A
864864
)
865865
seg.irregularlysampledsignals.append(irsig)
@@ -875,7 +875,7 @@ def test_signals_write(self):
875875
self.write_and_compare([block, anotherblock])
876876

877877
block.segments[0].irregularlysampledsignals.append(
878-
IrregularlySampledSignal(times=np.random.random(10),
878+
IrregularlySampledSignal(times=np.sort(np.random.random(10)),
879879
signal=np.random.random((10, 13)),
880880
units="mV", time_units="s",
881881
dtype=np.float,

neo/utils/datasets.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313

1414
global local_testing_data_folder
15-
if os.getenv('TESTING_DATA_FOLDER', default=None) is not None:
16-
local_testing_data_folder = Path(os.getenv('TESTING_DATA_FOLDER'))
15+
if os.getenv('EPHY_TESTING_DATA_FOLDER', default=None) is not None:
16+
local_testing_data_folder = Path(os.getenv('EPHY_TESTING_DATA_FOLDER'))
1717
else:
1818
# set in home
1919
local_testing_data_folder = Path.home() / 'ephy_testing_data'
@@ -52,6 +52,8 @@ def download_dataset(repo=None, remote_path=None, local_folder=None):
5252
local_path:
5353
The local path of the downloaded file or folder
5454
"""
55+
assert HAVE_DATALAD, 'You need to install datalad'
56+
5557
if repo is None:
5658
# Use gin NeuralEnsemble/ephy_testing_data
5759
repo = 'https://gin.g-node.org/NeuralEnsemble/ephy_testing_data'
@@ -72,10 +74,7 @@ def download_dataset(repo=None, remote_path=None, local_folder=None):
7274
return
7375

7476
dataset.get(remote_path)
75-
77+
7678
local_path = local_folder / remote_path
7779

7880
return local_path
79-
80-
81-

requirements.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
# essential
21
numpy>=1.13.0,!=1.16.0
32
quantities>=0.12.1
4-
# for running tests
5-
nose>=1.1.2

requirements_testing.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ h5py
66
igor
77
klusta
88
tqdm
9-
nixio>=1.5.0b2
9+
nixio>=1.5.0
1010
matplotlib
1111
ipython
1212
coverage

0 commit comments

Comments
 (0)