Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: restyling of Kirchhoff operator #528

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
platform: [ ubuntu-latest, macos-latest ]
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10"]

runs-on: ${{ matrix.platform }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codacy-coverage-reporter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ sphinx:
python:
install:
- requirements: requirements-dev.txt
- method: setuptools
- method: pip
path: .
8 changes: 4 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
versionSpec: '3.8'
architecture: 'x64'

- script: |
Expand All @@ -65,7 +65,7 @@ jobs:
displayName: 'Install prerequisites and library'

- script: |
python setup.py test
pytest
condition: succeededOrFailed()
displayName: 'Run tests'

Expand All @@ -84,7 +84,7 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
versionSpec: '3.8'
architecture: 'x64'

- script: |
Expand All @@ -94,6 +94,6 @@ jobs:
displayName: 'Install prerequisites and library'

- script: |
python setup.py test
pytest
condition: succeededOrFailed()
displayName: 'Run tests'
607 changes: 147 additions & 460 deletions pylops/waveeqprocessing/kirchhoff.py

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
18 changes: 2 additions & 16 deletions pytests/test_kirchhoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def test_kirchhoff3d(par):
)
def test_kirchhoff2d_trav_vs_travsrcrec(par):
"""Compare 2D Kirchhoff operator forward and adjoint when using trav (original behavior)
or trav_src and trav_rec (new reccomended behaviour)"""
or trav_src and trav_rec (new reccommended behaviour)"""

# new behaviour
Dop = Kirchhoff(
Expand All @@ -311,21 +311,7 @@ def test_kirchhoff2d_trav_vs_travsrcrec(par):
) + Dop.trav_recs.reshape(PAR["nx"] * PAR["nz"], 1, PAR["nrx"])
trav = trav.reshape(PAR["nx"] * PAR["nz"], PAR["nsx"] * PAR["nrx"])
if par["dynamic"]:
dist = Dop.dist_srcs.reshape(
PAR["nx"] * PAR["nz"], PAR["nsx"], 1
) + Dop.dist_recs.reshape(PAR["nx"] * PAR["nz"], 1, PAR["nrx"])
dist = dist.reshape(PAR["nx"] * PAR["nz"], PAR["nsx"] * PAR["nrx"])

cosangle = np.cos(Dop.angle_srcs).reshape(
PAR["nx"] * PAR["nz"], PAR["nsx"], 1
) + np.cos(Dop.angle_recs).reshape(PAR["nx"] * PAR["nz"], 1, PAR["nrx"])
cosangle = cosangle.reshape(PAR["nx"] * PAR["nz"], PAR["nsx"] * PAR["nrx"])

epsdist = 1e-2
amp = 1 / (dist + epsdist * np.max(dist))

amp *= np.abs(cosangle)
amp /= v0
amp = (Dop.amp_srcs, Dop.amp_recs)

D1op = Kirchhoff(
z,
Expand Down
54 changes: 53 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
[metadata]
name = pylops
fullname = PyLops
description = Python library implementing linear operators to allow solving large-scale optimization problems
long_description = file: README.md
long_description_content_type = text/markdown
author = The PyLops Development Team
author_email = [email protected]
maintainer = "Matteo Ravasi"
maintainer_email = [email protected]
license = LGPL-3.0 License
license_file = LICENSE.md
platform = any
keywords = algebra, inverse problems, large-scale optimization
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
Intended Audience :: Science/Research
Intended Audience :: Education
License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3),
Natural Language :: English
Operating System :: OS Independent
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Topic :: Scientific/Engineering : Mathematics
url = https://github.com/pylops/pylops

project_urls =
Documentation = https://pylops.readthedocs.io/
Release Notes = https://github.com/pylops/pylops/releases
Bug Tracker = https://github.com/pylops/pylops/issues
Source Code = https://github.com/pylops/pylops

[options]
zip_safe = True
include_package_data = True
packages = find:
python_requires = >=3.8
install_requires =
numpy >= 1.21.0
scipy >= 1.4.0

[options.extras_require]
advanced =
llvmlite
numba
pyfftw
PyWavelets
scikit-fmm
spgl1

[aliases]
test=pytest

Expand All @@ -11,7 +64,6 @@ per-file-ignores =
__init__.py: F401, F403, F405
max-line-length = 88


# mypy global options
[mypy]
plugins = numpy.typing.mypy_plugin
Expand Down
54 changes: 0 additions & 54 deletions setup.py

This file was deleted.