Skip to content

Commit

Permalink
build: separate import paths for old and new scipy
Browse files Browse the repository at this point in the history
fixes #13
  • Loading branch information
sho-87 committed Oct 18, 2024
1 parent 6982eb9 commit 10b0faf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions sensormotion/pa.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
import numpy as np
import sensormotion.signal

from scipy.integrate import simps, trapz
try:
# For SciPy 1.14+
from scipy.integrate import simpson, trapezoid
except ImportError:
# For SciPy < 1.14
from scipy.integrate import simps as simpson, trapz as trapezoid


def convert_counts(
Expand Down Expand Up @@ -128,9 +133,9 @@ def convert_counts(
cur_time = time[lower:upper]

if integrate == "simpson":
counts[i] = simps(cur_signal, cur_time)
counts[i] = simpson(cur_signal, cur_time)
elif integrate == "trapezoid":
counts[i] = trapz(cur_signal, cur_time)
counts[i] = trapezoid(cur_signal, cur_time)

# plot counts
if plot:
Expand Down
2 changes: 1 addition & 1 deletion sensormotion/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.4"
__version__ = "1.1.5"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def readme():
"Tracker": "https://github.com/sho-87/sensormotion/issues",
},
author="Simon Ho",
author_email="simonho213@gmail.com",
author_email="simonho.ubc@gmail.com",
license="MIT",
packages=find_packages(),
python_requires=">=3",
Expand Down

0 comments on commit 10b0faf

Please sign in to comment.