Skip to content

Commit

Permalink
Merge pull request #77 from cokelaer/add_python39
Browse files Browse the repository at this point in the history
Fixing deprecated function of Scipy.
  • Loading branch information
cokelaer authored Mar 22, 2022
2 parents 636b74a + 524b8b2 commit 53af0f2
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 37 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ jobs:
strategy:
max-parallel: 5
matrix:
python: [3.6, 3.7, 3.8]
python: [3.7, 3.8,3.9]
fail-fast: false

steps:
- uses: actions/checkout@v2
Expand All @@ -23,17 +24,12 @@ jobs:
python-version: ${{ matrix.python }}
- name: Install the package itself
run: |
pip install .
pip install .[testing]
- name: Test with pytest
run: |
pip install easydev
pip install pytest
pip install pytest-cov
pip install coverage
pytest --cov-report term --cov=spectrum
- name: coveralls
- name: coveralls
run: |
pip install coveralls
coveralls --service=github
Expand Down
14 changes: 14 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ Contributions

Please see `github <http://github.com/cokelaer/spectrum>`_ for any issues/bugs/comments/contributions.

Changelog (summary)
===================

========== ==========================================================
release description
========== ==========================================================
0.8.1 * move CI to github actions
* include python 3.9 support
* include PR from tikuma-lshhsc contributor to speedup
eigenfre module
* fix deprecated warnings
========== ==========================================================



Some notebooks (external contributions)
-------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions doc/ChangeLog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ ChangeLog Summary
Version 0.8 (2020)
------------------

* 0.8.1: Jul 2021

* move CI to github actions
* include PR from tikuma-lshhsc contributor to speedup eigenfre module
* fix deprecated warnings

* 0.8.0: Nov 2020

* Fixed documentation related to https://github.com/cokelaer/spectrum/issues/57
Expand Down
11 changes: 0 additions & 11 deletions requirements-dev.txt

This file was deleted.

1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
easydev
numpy
scipy
matplotlib
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ upload_dir=doc/build/html/
[upload_sphinx]
upload-dir = doc/build/html

[aliases]
test=pytest

[tool:pytest]


#[tool:pytest]
# do not use --cov because it interfers with travis command
addopts= --durations=10 --verbose --cov spectrum --cov-report term-missing
#addopts= --durations=10 --verbose --cov spectrum --cov-report term-missing

21 changes: 17 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

_MAJOR = 0
_MINOR = 8
_MICRO = 0
_MICRO = 1
version = '%d.%d.%d' % (_MAJOR, _MINOR, _MICRO)
release = '%d.%d' % (_MAJOR, _MINOR)

Expand Down Expand Up @@ -35,10 +35,23 @@
# Dependencies
install_requires=open("requirements.txt").read(),
extras_require={
'plot': ['matplotlib']
'plot': ['matplotlib'],
"testing": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-timeout",
"pytest-runner",
"coveralls",
],
"doc": [
'sphinx',
'sphinx_rtd_theme'
]

},
# specific packages for testing
tests_require = open('requirements-dev.txt').read().split(),


package_data = {
'spectrum.data' : ['*'],
Expand Down
20 changes: 12 additions & 8 deletions src/spectrum/mtm.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,11 @@ def dpss(N, NW=None, k=None):
if k is None:
k = min(round(2*NW),N)
k = int(max(k,1))
from numpy import dot, zeros, arange, sqrt
mtspeclib.multitap.restype = None

lam = zeros(k, dtype=float)
tapers = zeros(k*N, dtype=float)
tapsum = zeros(k, dtype=float)
lam = np.zeros(k, dtype=float)
tapers = np.zeros(k*N, dtype=float)
tapsum = np.zeros(k, dtype=float)

res = mtspeclib.multitap(
c_int(N),
Expand All @@ -341,7 +340,7 @@ def dpss(N, NW=None, k=None):
)

# normalisation by sqtr(N). It is required to have normalised windows
tapers = tapers.reshape(k,N).transpose() / sqrt(N)
tapers = tapers.reshape(k,N).transpose() / np.sqrt(N)

for i in range(k):
# By convention (Percival and Walden, 1993 pg 379)
Expand All @@ -362,11 +361,11 @@ def dpss(N, NW=None, k=None):

# The values returned in lam are not exacly the same as in the following methods.
acvs = _autocov(tapers.transpose(), debias=False) * N
nidx = arange(N)
nidx = np.arange(N)
W = float(NW)/N
r = 4*W*np.sinc(2*W*nidx)
r[0] = 2*W
eigvals = dot(acvs, r)
eigvals = np.dot(acvs, r)

#return (tapers, lam)
return [tapers, eigvals]
Expand Down Expand Up @@ -540,8 +539,13 @@ def _fftconvolve(in1, in2, mode="full", axis=None):
"""
#Locally import stuff only required for this:
from scipy.fftpack import fftn, fft, ifftn, ifft
from scipy.signal.signaltools import _centered
from numpy import array, product
try:
from scipy.signal._signaltools import _centered
except ModuleNotFoundError:
from scipy.signal.signaltools import _centered




s1 = array(in1.shape)
Expand Down
2 changes: 0 additions & 2 deletions test/pytest.ini

This file was deleted.

0 comments on commit 53af0f2

Please sign in to comment.