Skip to content

Commit 3868bca

Browse files
authored
Merge pull request #604 from PyLops/dev
Release v2.3.0
2 parents 98dc07f + c204095 commit 3868bca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+4814
-1289
lines changed

.github/workflows/build.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ jobs:
66
build:
77
strategy:
88
matrix:
9-
platform: [ ubuntu-latest, macos-latest ]
10-
python-version: ["3.8", "3.9", "3.10"]
9+
platform: [ ubuntu-latest, macos-13 ]
10+
python-version: ["3.9", "3.10", "3.11"]
1111

1212
runs-on: ${{ matrix.platform }}
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515
- name: Get history and tags for SCM versioning to work
1616
run: |
1717
git fetch --prune --unshallow
1818
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
1919
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v4
20+
uses: actions/setup-python@v5
2121
with:
2222
python-version: ${{ matrix.python-version }}
2323
- name: Install dependencies

.github/workflows/codacy-coverage-reporter.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ jobs:
99
strategy:
1010
matrix:
1111
platform: [ ubuntu-latest, ]
12-
python-version: ["3.8", ]
12+
python-version: ["3.9", ]
1313

1414
runs-on: ${{ matrix.platform }}
1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
17+
- name: Get history and tags for SCM versioning to work
18+
run: |
19+
git fetch --prune --unshallow
20+
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
1721
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v4
22+
uses: actions/setup-python@v5
1923
with:
2024
python-version: ${{ matrix.python-version }}
2125
- name: Install dependencies

.github/workflows/flake8.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
name: Lint
1111
steps:
1212
- name: Check out source repository
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414
- name: Set up Python environment
15-
uses: actions/setup-python@v4
15+
uses: actions/setup-python@v5
1616
with:
1717
python-version: "3.8"
1818
- name: flake8 Lint

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ sphinx:
1818
# Declare the Python requirements required to build your docs
1919
python:
2020
install:
21-
- requirements: requirements-dev.txt
21+
- requirements: requirements-doc.txt
2222
- method: pip
2323
path: .

CHANGELOG.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
Changelog
2+
=========
3+
4+
# 2.3.0
5+
6+
* Added `pylops.JaxOperator`, `pylops.signalprocessing.DWTND`, and `pylops.signalprocessing.DTCWT` operators.
7+
* Added `updatesrc` method to `pylops.waveeqprocessing.AcousticWave2D`.
8+
* Added `verb` to `pylops.signalprocessing.Sliding1D.sliding1d_design`, `pylops.signalprocessing.Sliding2D.sliding2d_design`, `pylops.signalprocessing.Sliding3D.sliding3d_design`, `pylops.signalprocessing.Patch2D.patch2d_design`, and `pylops.signalprocessing.Patch3D.patch3d_design`.
9+
* Added `kwargs_fft` to `pylops.signalprocessing.FFTND`.
10+
* Added `cosinetaper` to `pylops.utils.tapers.cosinetaper`.
11+
* Added `kind` to `pylops.waveeqprocessing.Deghosting`.
12+
* Modified all methods in `pylops.utils.backend` to enable jax integration.
13+
* Modified implementations of `pylops.signalprocessing.Sliding1D`, `pylops.signalprocessing.Sliding2D`,
14+
`pylops.signalprocessing.Sliding3D`, `pylops.signalprocessing.Patch2D`, and
15+
`pylops.signalprocessing.Patch3D` to being directly implemented instead of relying on other PyLops operators. Added also `savetaper` parameter and an option to apply the operator `Op` simultaneously to all windows.
16+
* Modified `pylops.waveeqprocessing.AcousticWave2D._born_oneshot` and
17+
`pylops.waveeqprocessing.AcousticWave2D._born_allshots` to avoid recreating the devito solver for each shot (and enabling internal caching...)
18+
* Modified `dtype` of `pylops.signalprocessing.Shift` to be that of the input vector.
19+
* Modified `pylops.waveeqprocessing.BlendingContinuous` to use `matvec/rmatvec` instead of `@/.H @` for compatibility with pylops solvers.
20+
* Removed `cusignal` as optional dependency and `cupy`'s equivalent methods (since the library
21+
is now unmantained and merged into `cupy`).
22+
* Fixed ImportError of optional dependencies when installed but not correctly functioning (see [Issue #548](https://github.com/PyLops/pylops/issues/548))
23+
* Fixed bug in :py:func:`pylops.utils.deps.to_cupy_conditional` (see [Issue #579](https://github.com/PyLops/pylops/issues/579))
24+
* Fixed bug in the definition of `nttot` in :py:class:`pylops.waveeqprocessing.BlendingContinuous`
25+
* Fixed bug in :py:func:`pylops.utils.signalprocessing.dip_estimate` (see [Issue #572](https://github.com/PyLops/pylops/issues/572))
26+
27+
128
# 2.2.0
229

330
* Added `pylops.signalprocessing.NonStationaryConvolve3D` operator
@@ -287,7 +314,7 @@ To aid users in navigating the breaking changes, we provide the following docume
287314
``pylops.waveeqprocessing.UpDownComposition3Doperator``, and
288315
``pylops.waveeqprocessing.PhaseShift`` operators
289316
* Fix bug in ``pylops.basicoperators.Kronecker``
290-
(see [Issue #125](https://github.com/Statoil/pylops/issues/125))
317+
(see [Issue #125](https://github.com/PyLops/pylops/issues/125))
291318

292319
# 1.7.0
293320
* Added ``pylops.basicoperators.Gradient``,

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PIP := $(shell command -v pip3 2> /dev/null || command which pip 2> /dev/null)
22
PYTHON := $(shell command -v python3 2> /dev/null || command which python 2> /dev/null)
33

4-
.PHONY: install dev-install install_conda dev-install_conda tests doc docupdate
4+
.PHONY: install dev-install install_conda dev-install_conda tests doc docupdate servedoc lint typeannot coverage
55

66
pipcheck:
77
ifndef PIP
@@ -29,6 +29,9 @@ install_conda:
2929
dev-install_conda:
3030
conda env create -f environment-dev.yml && conda activate pylops && pip install -e .
3131

32+
dev-install_conda_arm:
33+
conda env create -f environment-dev-arm.yml && conda activate pylops && pip install -e .
34+
3235
tests:
3336
make pythoncheck
3437
pytest

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![PyPI version](https://badge.fury.io/py/pylops.svg)](https://badge.fury.io/py/pylops)
55
[![Anaconda-Server Badge](https://anaconda.org/conda-forge/pylops/badges/version.svg)](https://anaconda.org/conda-forge/pylops)
66
[![AzureDevOps Status](https://dev.azure.com/matteoravasi/PyLops/_apis/build/status/PyLops.pylops?branchName=dev)](https://dev.azure.com/matteoravasi/PyLops/_build/latest?definitionId=9&branchName=dev)
7-
[![GithubAction Status](https://github.com/mrava87/pylops/actions/workflows/build.yaml/badge.svg)](https://github.com/mrava87/pylops/actions/workflows/build.yaml)
7+
[![GithubAction Status](https://github.com/PyLops/pylops/actions/workflows/build.yaml/badge.svg?branch=dev)](https://github.com/PyLops/pylops/actions/workflows/build.yaml)
88
[![Documentation Status](https://readthedocs.org/projects/pylops/badge/?version=stable)](https://pylops.readthedocs.io/en/stable/?badge=stable)
99
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/17fd60b4266347d8890dd6b64f2c0807)](https://www.codacy.com/gh/PyLops/pylops/dashboard?utm_source=github.com&utm_medium=referral&utm_content=PyLops/pylops&utm_campaign=Badge_Grade)
1010
[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/17fd60b4266347d8890dd6b64f2c0807)](https://www.codacy.com/gh/PyLops/pylops/dashboard?utm_source=github.com&utm_medium=referral&utm_content=PyLops/pylops&utm_campaign=Badge_Coverage)
@@ -149,3 +149,6 @@ A list of video tutorials to learn more about PyLops:
149149
* Rohan Babbar, rohanbabbar04
150150
* Wei Zhang, ZhangWeiGeo
151151
* Fedor Goncharov, fedor-goncharov
152+
* Alex Rakowski, alex-rakowski
153+
* David Sollberger, solldavid
154+
* Gustavo Coelho, guaacoelho

azure-pipelines.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
# steps:
2727
# - task: UsePythonVersion@0
2828
# inputs:
29-
# versionSpec: '3.7'
29+
# versionSpec: '3.9'
3030
# architecture: 'x64'
3131
#
3232
# - script: |
@@ -55,7 +55,7 @@ jobs:
5555
steps:
5656
- task: UsePythonVersion@0
5757
inputs:
58-
versionSpec: '3.8'
58+
versionSpec: '3.9'
5959
architecture: 'x64'
6060

6161
- script: |
@@ -84,7 +84,7 @@ jobs:
8484
steps:
8585
- task: UsePythonVersion@0
8686
inputs:
87-
versionSpec: '3.8'
87+
versionSpec: '3.9'
8888
architecture: 'x64'
8989

9090
- script: |

docs/source/adding.rst

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Implementing new operators
44
==========================
55
Users are welcome to create new operators and add them to the PyLops library.
66

7-
In this tutorial, we will go through the key steps in the definition of an operator, using the
8-
:py:class:`pylops.Diagonal` as an example. This is a very simple operator that applies a diagonal matrix to the model
9-
in forward mode and to the data in adjoint mode.
7+
In this tutorial, we will go through the key steps in the definition of an operator, using a simplified version of the
8+
:py:class:`pylops.Diagonal` operator as an example. This is a very simple operator that applies a diagonal matrix
9+
to the model in forward mode and to the data in adjoint mode.
1010

1111

1212
Creating the operator
@@ -45,14 +45,17 @@ Initialization (``__init__``)
4545
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4646

4747
We then need to create the ``__init__`` where the input parameters are passed and saved as members of our class.
48-
While the input parameters change from operator to operator, it is always required to create three members, the first
49-
called ``shape`` with a tuple containing the dimensions of the operator in the data and model space, the second
50-
called ``dtype`` with the data type object (:obj:`np.dtype`) of the model and data, and the third
51-
called ``explicit`` with a boolean (``True`` or ``False``) identifying if the operator can be inverted by a direct
52-
solver or requires an iterative solver. This member is ``True`` if the operator has also a member ``A`` that contains
53-
the matrix to be inverted like for example in the :py:class:`pylops.MatrixMult` operator, and it will be ``False`` otherwise.
54-
In this case we have another member called ``d`` which is equal to the input vector containing the diagonal elements
55-
of the matrix we want to multiply to the model and data.
48+
While the input parameters change from operator to operator, it is always required to create three members:
49+
50+
- ``dtype``: data type object (of type :obj:`str` or :obj:`np.dtype`) of the model and data;
51+
- ``shape``: a tuple containing the dimensions of the operator in the data and model space;
52+
- ``explicit``: a boolean (``True`` or ``False``) identifying if the operator can be inverted by a direct solver or
53+
requires an iterative solver. This member is ``True`` if the operator has also a member ``A`` that contains
54+
the matrix to be inverted like for example in the :py:class:`pylops.MatrixMult` operator, and it will be
55+
``False`` otherwise.
56+
57+
In this specific case, we have another member called ``d`` which is equal to the input vector containing the diagonal
58+
elements of the matrix we want to multiply to the model and data.
5659

5760
.. code-block:: python
5861
@@ -62,7 +65,7 @@ of the matrix we want to multiply to the model and data.
6265
self.dtype = np.dtype(dtype)
6366
self.explicit = False
6467
65-
Alternatively, since version 2.0.0, the recommended way of initializing operators derived from the base
68+
Alternatively, since version ``v2.0.0``, the recommended way of initializing operators derived from the base
6669
:py:class:`pylops.LinearOperator` class is to invoke ``super`` to assign the required attributes:
6770

6871
.. code-block:: python
@@ -72,8 +75,14 @@ Alternatively, since version 2.0.0, the recommended way of initializing operator
7275
super().__init__(dtype=np.dtype(dtype), shape=(len(self.d), len(self.d)))
7376
7477
In this case, there is no need to declare ``explicit`` as it already defaults to ``False``.
75-
Since version 2.0.0, every :py:class:`pylops.LinearOperator` class is imbued with ``dims``,
76-
``dimsd``, ``clinear`` and ``explicit``, in addition to the required ``dtype`` and ``shape``.
78+
79+
Moreover, since version ``v2.0.0``, every :py:class:`pylops.LinearOperator` class is imbued with ``dims``,
80+
``dimsd``, and ``clinear`` in addition to the required ``dtype``, ``shape``, and ``explicit``. Note that
81+
``dims`` and ``dimsd`` can be defined in spite of ``shape``, which will be automatically assigned within the
82+
``super`` method: the main difference between ``dims``/``dimsd`` and ``shape`` is the the former variables can be
83+
used the define the n-dimensional nature of the input of an operator, whilst the latter variable refers to their overall
84+
shape when the input is flattened.
85+
7786
See the docs of :py:class:`pylops.LinearOperator` for more information about what these
7887
attributes mean.
7988

@@ -91,6 +100,10 @@ We will finally need to ``return`` the result of this operation:
91100
def _matvec(self, x):
92101
return self.d * x
93102
103+
Note that since version ``v2.0.0``, this method can be decorated by the decorator ``@reshaped``. As discussed in
104+
more details in the decorator documentation, by adding such decorator the input ``x`` is initially reshaped into
105+
a nd-array of shape ``dims``, fed to the actual code in ``_matvec`` and then flattened.
106+
94107
Adjoint mode (``_rmatvec``)
95108
^^^^^^^^^^^^^^^^^^^^^^^^^^^
96109
Finally we need to implement the *adjoint mode* in the method ``_rmatvec``. In other words, we will need to write
@@ -106,6 +119,10 @@ different from operator to operator):
106119
107120
And that's it, we have implemented our first linear operator!
108121

122+
Similar to ``_matvec``, since version ``v2.0.0``, this method can also be decorated by the decorator ``@reshaped``.
123+
When doing so, the input ``x`` is initially reshaped into
124+
a nd-array of shape ``dimsd``, fed to the actual code in ``_rmatvec`` and then flattened.
125+
109126
Testing the operator
110127
--------------------
111128
Being able to write an operator is not yet a guarantee of the fact that the operator is correct, or in other words

docs/source/api/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Templates
2929
FunctionOperator
3030
MemoizeOperator
3131
TorchOperator
32+
JaxOperator
3233

3334
Basic operators
3435
~~~~~~~~~~~~~~~
@@ -102,7 +103,9 @@ Signal processing
102103
Shift
103104
DWT
104105
DWT2D
106+
DWTND
105107
DCT
108+
DTCWT
106109
Seislet
107110
Radon2D
108111
Radon3D

0 commit comments

Comments
 (0)