Skip to content

Commit e4540d0

Browse files
authored
Merge pull request #50 from paudetseis/updates
- Minor update to fix numpy deprecation of np.float() to float - Updated documentation for installation with python<=3.10 - Fixed GH actions for deployment - New version v0.2.2
2 parents 686bb3d + d2f2f64 commit e4540d0

File tree

5 files changed

+59
-70
lines changed

5 files changed

+59
-70
lines changed

.github/test_conda_env.yml

+1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ dependencies:
77
- fortran-compiler
88
# see obspy issue #2912, can be removed after obspy release 1.3.0
99
- 'numpy<1.22'
10+
- 'setuptools=60'
1011

.github/workflows/tests.yml

+33-9
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,33 @@
11
name: tests
2+
3+
# Controls when the action will run.
24
on:
35
push:
6+
branches: [ master ]
47
pull_request:
5-
branches:
6-
# only branches from forks which have the form 'user:branch-name'
7-
- '**:**'
8+
branches: [ master ]
9+
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
813
jobs:
914
run_tests:
1015
strategy:
1116
fail-fast: false
1217
matrix:
1318
os: [ubuntu-latest]
14-
python: ['3.7', '3.8', '3.9', '3.10']
15-
include:
16-
- os: macos-latest
17-
python: '3.10'
19+
python: ['3.10']
20+
# include:
21+
# - os: macos-latest
22+
# python: '3.10'
1823
runs-on: ${{ matrix.os }}
1924
defaults:
2025
run:
2126
shell: bash -l {0}
2227
steps:
23-
- uses: actions/checkout@v2
28+
- uses: actions/checkout@v4
2429
- name: Setup conda
25-
uses: conda-incubator/setup-miniconda@v2
30+
uses: conda-incubator/setup-miniconda@v3
2631
with:
2732
python-version: ${{ matrix.python }}
2833
environment-file: .github/test_conda_env.yml
@@ -32,6 +37,7 @@ jobs:
3237
conda list
3338
- name: install package
3439
run: |
40+
conda install libstdcxx-ng
3541
pip install -v --no-deps .
3642
- name: run test suite
3743
run: |
@@ -40,3 +46,21 @@ jobs:
4046
coverage xml -o ../coverage.xml
4147
- name: upload coverage
4248
uses: codecov/codecov-action@v1
49+
- name: Make docs
50+
if: matrix.python == '3.10'
51+
shell: bash -l {0}
52+
run: |
53+
cd docs
54+
pip install sphinx
55+
pip install sphinx_rtd_theme
56+
make html
57+
touch _build/html/.nojekyll
58+
cd ..
59+
- name: Deploy 🚀
60+
if: matrix.python == '3.10'
61+
uses: JamesIves/[email protected]
62+
with:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
BRANCH: gh-pages # The branch the action should deploy to.
65+
FOLDER: docs/_build/html # The folder the action should deploy.
66+
CLEAN: true # Automatically remove deleted files from the deploy branch

docs/conf.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
# add these directories to sys.path here. If the directory is relative to the
1111
# documentation root, use os.path.abspath to make it absolute, like shown here.
1212
#
13-
# import os
14-
# import sys
15-
# sys.path.insert(0, os.path.abspath('.'))
13+
import os
14+
import sys
15+
sys.path.insert(0, os.path.abspath('../.'))
1616

1717

1818
# -- Project information -----------------------------------------------------

telewavesim/__init__.py

+18-54
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,6 @@
5252
Installation
5353
------------
5454
55-
Dependencies
56-
++++++++++++
57-
58-
The current version works well with **Python>3.5**.
59-
Also, the following packages are required:
60-
61-
- `gfortran <https://gcc.gnu.org/wiki/GFortran>`_ (or any Fortran compiler)
62-
- `obspy <https://github.com/obspy/obspy/wiki>`_
63-
64-
By default, both ``numpy`` and ``matplotlib`` are installed as dependencies
65-
of ``obspy``.
66-
6755
Conda environment
6856
+++++++++++++++++
6957
@@ -73,46 +61,22 @@
7361
7462
.. sourcecode:: bash
7563
76-
conda create -n tws python=3.7 obspy -c conda-forge
64+
conda create -n tws -c conda-forge "python=3.10" "numpy<1.22" "setuptools=60" obspy fortran-compiler
7765
7866
Activate the newly created environment:
7967
8068
.. sourcecode:: bash
8169
8270
conda activate tws
8371
84-
Installing latest version from PyPi
85-
+++++++++++++++++++++++++++++++++++
86-
87-
Install the latest version from PyPi with the following command:
88-
89-
.. sourcecode:: bash
90-
91-
pip install telewavesim
92-
93-
Installing development version from source
94-
++++++++++++++++++++++++++++++++++++++++++
95-
96-
- Clone the repository:
97-
98-
.. sourcecode:: bash
99-
100-
git clone https://github.com/paudetseis/Telewavesim.git
101-
cd Telewavesim
72+
Installing development branch from GitHub
73+
+++++++++++++++++++++++++++++++++++++++++
10274
103-
- Install using ``pip``:
75+
Install the latest version from the GitHub repository with the following command:
10476
10577
.. sourcecode:: bash
10678
107-
pip install .
108-
109-
Possible installation pitfalls with conda
110-
+++++++++++++++++++++++++++++++++++++++++
111-
112-
Using ``conda`` it might be necessary to use the fortran compiler provided with
113-
conda-forge. Add ``fortran-compiler`` package to the
114-
above ``conda`` environment calls.
115-
On Linux it might further be necessary to install the ``lapack`` conda package.
79+
pip install telewavesim@git+https://github.com/paudetseis/telewavesim
11680
11781
Testing
11882
+++++++
@@ -404,20 +368,20 @@
404368
405369
"""
406370

407-
try:
408-
from . import rmat_f
409-
except:
410-
from numpy.distutils.system_info import get_info as _get_info
411-
import os as _os
412-
from ctypes import cdll as _cdll
371+
# try:
372+
# from . import rmat_f
373+
# except:
374+
# from numpy.distutils.system_info import get_info as _get_info
375+
# import os as _os
376+
# from ctypes import cdll as _cdll
413377

414-
_shared_libraries = []
378+
# _shared_libraries = []
415379

416-
for path in _get_info('lapack')['library_dirs']:
417-
for lib in _os.listdir(path):
418-
if lib.startswith('lib'):
419-
_slib = _cdll.LoadLibrary("{}/{}".format(path, lib))
420-
_shared_libraries.append(_slib)
380+
# for path in _get_info('lapack')['library_dirs']:
381+
# for lib in _os.listdir(path):
382+
# if lib.startswith('lib'):
383+
# _slib = _cdll.LoadLibrary("{}/{}".format(path, lib))
384+
# _shared_libraries.append(_slib)
421385

422386

423-
__version__ = '0.2.1'
387+
__version__ = '0.2.2'

telewavesim/utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -534,13 +534,13 @@ def stack_all(st1, st2, pws=False):
534534
weight2 += np.exp(1j*phase2)
535535

536536
# Normalize
537-
tmp1 = tmp1/np.float(len(st1))
538-
tmp2 = tmp2/np.float(len(st2))
537+
tmp1 = tmp1/float(len(st1))
538+
tmp2 = tmp2/float(len(st2))
539539

540540
# Phase-weighting
541541
if pws:
542-
weight1 = weight1/np.float(len(st1))
543-
weight2 = weight2/np.float(len(st2))
542+
weight1 = weight1/float(len(st1))
543+
weight2 = weight2/float(len(st2))
544544
weight1 = np.real(abs(weight1))
545545
weight2 = np.real(abs(weight2))
546546
else:

0 commit comments

Comments
 (0)