Skip to content

Commit

Permalink
Merge pull request #176 from SpikeInterface/numpy-support
Browse files Browse the repository at this point in the history
Fixes for numpy 2.0
  • Loading branch information
alejoe91 authored Feb 12, 2025
2 parents 38ba7b4 + 814c01b commit 209cee6
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.10"]
python-version: ["3.10", "3.12"]
steps:
- uses: actions/checkout@v2
- uses: s-weigand/setup-conda@v1
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Which conda/python
- name: Which python
run: |
conda --version
python --version
- name: Install dependencies
run: |
pip install .[templates,test]
pip install "zarr<3.0.0"
- name: pip list
run: |
pip list
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: s-weigand/setup-conda@v1
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"
- name: Which python
run: |
conda --version
python --version
- name: Install dependencies
run: |
pip install .[templates,test]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "MEArec"
version = "1.9.1"
version = "1.9.2"
authors = [
{ name="Alessio Buccino", email="[email protected]" },
]
Expand Down
4 changes: 4 additions & 0 deletions readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
version: 2

sphinx:
# Path to your Sphinx configuration file.
configuration: docs/conf.py

build:
os: ubuntu-22.04
tools:
Expand Down
5 changes: 3 additions & 2 deletions src/MEArec/generators/spiketraingenerator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from copy import deepcopy

import elephant.spike_train_generation as stg
import elephant.statistics as stat
import neo
import numpy as np
import quantities as pq
Expand Down Expand Up @@ -129,6 +127,9 @@ def generate_spikes(self):
Generate spike trains based on default_params of the SpikeTrainGenerator class.
self.spiketrains contains the newly generated spike trains
"""
import elephant.spike_train_generation as stg
import elephant.statistics as stat

if not self._has_spiketrains:
self.spiketrains = []
idx = 0
Expand Down
3 changes: 2 additions & 1 deletion src/MEArec/tests/test_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from copy import deepcopy
from pathlib import Path

import elephant.statistics as stat
import numpy as np
import yaml
from click.testing import CliRunner
Expand Down Expand Up @@ -198,6 +197,8 @@ def test_gen_templates_beta_distr(self):
assert tempgen_drift_beta.templates.shape[0] == self.tempgen_drift.templates.shape[0]

def test_gen_spiketrains(self):
import elephant.statistics as stat

print("Test spike train generation")
rec_params = mr.get_default_recordings_params()
sp_params = rec_params["spiketrains"]
Expand Down
2 changes: 1 addition & 1 deletion src/MEArec/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ def clean_dict(d):
def _clean_numpy_scalar(v):
if isinstance(v, np.bool_):
v = bool(v)
if isinstance(v, np.float_):
if isinstance(v, np.float64):
v = float(v)
if isinstance(v, np.int_):
v = int(v)
Expand Down

0 comments on commit 209cee6

Please sign in to comment.