Skip to content
Draft
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
4 changes: 0 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ The best way to get in touch with the core developers and maintainers is to
join the [PyLops slack channel](https://pylops.slack.com/) as well as
open new *Issues* directly from the GitHub repo.

Moreover, take a look at the [Roadmap](https://pylops.readthedocs.io/en/stable/roadmap.html)
page for a list of current ideas for improvements and additions to the PyLops library.


## Welcomed contributions

### Bug reports
Expand Down
26 changes: 25 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
PIP := $(shell command -v pip3 2> /dev/null || command which pip 2> /dev/null)
PYTHON := $(shell command -v python3 2> /dev/null || command which python 2> /dev/null)
UV := $(shell command -v uv 2> /dev/null || command which uv 2> /dev/null)
NOX := $(shell command -v nox 2> /dev/null || command which nox 2> /dev/null)

.PHONY: install dev-install dev-install_intel_mkl dev-install_gpu install_conda dev-install_conda dev-install_conda_intel_mkl dev-install_conda_arm tests tests_cpu_ongpu tests_gpu doc docupdate servedoc lint typeannot coverage
.PHONY: install dev-install dev-install_intel_mkl dev-install_gpu install_conda dev-install_conda dev-install_conda_intel_mkl dev-install_conda_arm
.PHONY: tests tests_cpu_ongpu tests_gpu doc docupdate servedoc lint typeannot coverage

pipcheck:
ifndef PIP
Expand All @@ -15,6 +18,18 @@ ifndef PYTHON
endif
@echo Using python: $(PYTHON)

uvcheck:
ifndef UV
$(error "Ensure uv is in your PATH")
endif
@echo Using uv: $(UV)

noxcheck:
ifndef NOX
$(error "Ensure nox is in your PATH")
endif
@echo Using nox: $(NOX)

install:
make pipcheck
$(PIP) install -r requirements.txt && $(PIP) install .
Expand Down Expand Up @@ -51,11 +66,20 @@ dev-install_conda_arm:
dev-install_conda_gpu:
conda env create -f environment-dev-gpu.yml && source ${CONDA_PREFIX}/etc/profile.d/conda.sh && conda activate pylops_gpu && pip install -e .

dev-install_uv:
make uvcheck
$(UV) sync --locked --all-extras --all-groups

tests:
# Run tests with CPU
make pythoncheck
pytest

tests_uv:
# Run tests with CPU
make uvcheck
$(UV) run pytest

tests_cpu_ongpu:
# Run tests with CPU on a system with GPU (and CuPy installed)
make pythoncheck
Expand Down
117 changes: 0 additions & 117 deletions docs/source/_static/style.css

This file was deleted.

20 changes: 11 additions & 9 deletions docs/source/adding.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.. _addingoperator:

Implementing new operators
==========================
|:paintbrush:| Implementing new operators
#########################################

Users are welcome to create new operators and add them to the PyLops library.

In this tutorial, we will go through the key steps in the definition of an operator, using a simplified version of the
Expand All @@ -10,7 +11,7 @@ to the model in forward mode and to the data in adjoint mode.


Creating the operator
---------------------
*********************
The first thing we need to do is to create a new file with the name of the operator we would like to implement.
Note that as the operator will be a class, we need to follow the UpperCaseCamelCase convention both for the class itself
and for the filename.
Expand Down Expand Up @@ -42,7 +43,7 @@ input parameters and a ``Notes`` section providing a mathematical explanation of
some of the core operators of PyLops to get a feeling of the level of details of the mathematical explanation.

Initialization (``__init__``)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
=============================

We then need to create the ``__init__`` where the input parameters are passed and saved as members of our class.
While the input parameters change from operator to operator, it is always required to create three members:
Expand Down Expand Up @@ -87,7 +88,7 @@ See the docs of :py:class:`pylops.LinearOperator` for more information about wha
attributes mean.

Forward mode (``_matvec``)
^^^^^^^^^^^^^^^^^^^^^^^^^^
==========================
We can then move onto writing the *forward mode* in the method ``_matvec``. In other words, we will need to write
the piece of code that will implement the following operation :math:`\mathbf{y} = \mathbf{A}\mathbf{x}`.
Such method is always composed of two inputs (the object itself ``self`` and the input model ``x``).
Expand All @@ -105,7 +106,7 @@ more details in the decorator documentation, by adding such decorator the input
a nd-array of shape ``dims``, fed to the actual code in ``_matvec`` and then flattened.

Adjoint mode (``_rmatvec``)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
===========================
Finally we need to implement the *adjoint mode* in the method ``_rmatvec``. In other words, we will need to write
the piece of code that will implement the following operation :math:`\mathbf{x} = \mathbf{A}^H\mathbf{y}`.
Such method is also composed of two inputs (the object itself ``self`` and the input data ``y``).
Expand All @@ -123,8 +124,9 @@ Similar to ``_matvec``, since version ``v2.0.0``, this method can also be decora
When doing so, the input ``x`` is initially reshaped into
a nd-array of shape ``dimsd``, fed to the actual code in ``_rmatvec`` and then flattened.


Testing the operator
--------------------
********************
Being able to write an operator is not yet a guarantee of the fact that the operator is correct, or in other words
that the adjoint code is actually the *adjoint* of the forward code. Luckily for us, a simple test can be performed
to check the validity of forward and adjoint operators, the so called *dot-test*.
Expand Down Expand Up @@ -170,7 +172,7 @@ model tested towards the input model.


Documenting the operator
------------------------
************************
Once the operator has been created, we can add it to the documentation of PyLops. To do so, simply add the name of
the operator within the ``index.rst`` file in ``docs/source/api`` directory.

Expand All @@ -180,7 +182,7 @@ can be used as template.


Final checklist
---------------
***************
Before submitting your new operator for review, use the following **checklist** to ensure that your code
adheres to the guidelines of PyLops:

Expand Down
7 changes: 4 additions & 3 deletions docs/source/addingsolver.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
.. _addingsolver:

Implementing new solvers
========================
|:fire:| Implementing new solvers
#################################

Users are welcome to create new solvers and add them to the PyLops library.

In this tutorial, we will go through the key steps in the definition of a solver, using a
sligthly simplified version of :py:class:`pylops.optimization.basic.CG` as an example.
sligthly simplified version of :py:class:`pylops.optimization.cls_basic.CG` as an example.

.. note::
In case the solver that you are planning to create falls within the category of proximal solvers,
Expand Down
4 changes: 2 additions & 2 deletions docs/source/api/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _api:

PyLops API
==========
|:wrench:| PyLops API
=====================

The Application Programming Interface (API) of PyLops can be loosely seen
as composed of a stack of three main layers:
Expand Down
4 changes: 2 additions & 2 deletions docs/source/api/others.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. _others:

|:nut_and_bolt:| PyLops Utilities
=================================

PyLops Utilities
================
Alongside with its *Linear Operators* and *Solvers*, PyLops contains also a number of auxiliary routines
performing universal tasks that are used by several operators or simply within one or more :ref:`tutorials` for
the preparation of input data and subsequent visualization of results.
Expand Down
4 changes: 2 additions & 2 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _changlog:

Changelog
=========
|:newspaper_roll:| Changelog
############################


Version 2.6.0
Expand Down
5 changes: 3 additions & 2 deletions docs/source/citing.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.. _citing:

How to cite
===========
|:pencil2:| How to cite
#######################

When using PyLops in scientific publications, please cite the following paper:

.. raw:: html
Expand Down
21 changes: 7 additions & 14 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
"matplotlib.sphinxext.plot_directive",
"numpydoc",
"nbsphinx",
"sphinx_design",
"sphinx_iconify",
"sphinx_gallery.gen_gallery",
"sphinxemoji.sphinxemoji",
# 'sphinx.ext.napoleon',
]

# intersphinx configuration
Expand Down Expand Up @@ -124,15 +125,12 @@
html_show_copyright = True

# Theme config
html_theme = "pydata_sphinx_theme"
html_theme = "shibuya"
html_theme_options = {
"accent_color": "teal",
"github_url": "https://github.com/PyLops/pylops",
# "logo_only": True,
# "display_version": True,
"logo": {
"image_light": "pylops_b.png",
"image_dark": "pylops.png",
}
"light_logo": "_static/pylops_b.png",
"dark_logo": "_static/pylops.png",
}
html_css_files = [
"css/custom.css",
Expand Down Expand Up @@ -160,9 +158,4 @@
"github_project": "PyLops",
"github_repo": "pylops",
"github_version": "master",
}


# Load the custom CSS files (needs sphinx >= 1.6 for this to work)
def setup(app):
app.add_css_file("style.css")
}
Loading
Loading