repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
pylops
pylops-master/examples/plot_nonstatfilter.py
""" Non-stationary Filter Estimation ================================ This example shows how to use the :py:class:`pylops.signalprocessing.NonStationaryFilters1D` and :py:class:`pylops.signalprocessing.NonStationaryFilters2D` operators to perform non-stationary filter estimation that when convolved with an input signal...
4,246
30.459259
98
py
pylops
pylops-master/examples/plot_zero.py
""" Zero ==== This example shows how to use the :py:class:`pylops.basicoperators.Zero` operator. This operators simply zeroes the data in forward mode and the model in adjoint mode. """ import matplotlib.gridspec as pltgs import matplotlib.pyplot as plt import numpy as np import pylops plt.close("all") ############...
2,981
26.611111
88
py
pylops
pylops-master/examples/plot_nonstatconvolve.py
""" Non-stationary Convolution ========================== This example shows how to use the :py:class:`pylops.signalprocessing.NonStationaryConvolve1D` and :py:class:`pylops.signalprocessing.NonStationaryConvolve2D` operators to perform non-stationary convolution between two signals. Similar to their stationary counte...
3,979
28.924812
99
py
pylops
pylops-master/examples/plot_tvreg.py
r""" Total Variation (TV) Regularization =================================== This set of examples shows how to add Total Variation (TV) regularization to an inverse problem in order to enforce blockiness in the reconstructed model. To do so we will use the generalizated Split Bregman iterations by means of :func:`pyl...
6,483
29.729858
79
py
pylops
pylops-master/examples/plot_conj.py
""" Conj ==== This example shows how to use the :py:class:`pylops.basicoperators.Conj` operator. This operator returns the complex conjugate in both forward and adjoint modes (it is self adjoint). """ import matplotlib.pyplot as plt import numpy as np import pylops plt.close("all") #################################...
1,064
24.357143
79
py
pylops
pylops-master/examples/plot_wavs.py
""" Wavelets ======== This example shows how to use the different wavelets available PyLops. """ import matplotlib.pyplot as plt import numpy as np import pylops plt.close("all") ############################################################################### # Let's start with defining a time axis and creating the F...
1,771
29.551724
82
py
pylops
pylops-master/examples/plot_seismicevents.py
""" Synthetic seismic ================= This example shows how to use the :py:mod:`pylops.utils.seismicevents` module to quickly create synthetic seismic data to be used for toy examples and tests. """ import matplotlib.pyplot as plt import numpy as np import pylops plt.close("all") ################################...
4,391
25.457831
83
py
pylops
pylops-master/examples/plot_identity.py
""" Identity ======== This example shows how to use the :py:class:`pylops.Identity` operator to transfer model into data and viceversa. """ import matplotlib.gridspec as pltgs import matplotlib.pyplot as plt import numpy as np import pylops plt.close("all") ###########################################################...
2,896
26.330189
90
py
pylops
pylops-master/examples/plot_derivative.py
""" Derivatives =========== This example shows how to use the suite of derivative operators, namely :py:class:`pylops.FirstDerivative`, :py:class:`pylops.SecondDerivative`, :py:class:`pylops.Laplacian` and :py:class:`pylops.Gradient`, :py:class:`pylops.FirstDirectionalDerivative` and :py:class:`pylops.SecondDirectional...
9,276
34.544061
81
py
pylops
pylops-master/examples/plot_transpose.py
r""" Transpose ========= This example shows how to use the :py:class:`pylops.Transpose` operator. For arrays that are 2-dimensional in nature this operator simply transposes rows and columns. For multi-dimensional arrays, this operator can be used to permute dimensions """ import matplotlib.pyplot as plt import numpy a...
1,643
33.25
79
py
pylops
pylops-master/examples/plot_sliding.py
r""" 1D, 2D and 3D Sliding ===================== This example shows how to use the :py:class:`pylops.signalprocessing.Sliding1D`, :py:class:`pylops.signalprocessing.Sliding2D` and :py:class:`pylops.signalprocessing.Sliding3D` operators to perform repeated transforms over small strides of a 1-, 2- or 3-dimensional arra...
11,470
30.34153
87
py
pylops
pylops-master/examples/plot_ista.py
r""" MP, OMP, ISTA and FISTA ======================= This example shows how to use the :py:class:`pylops.optimization.sparsity.omp`, :py:class:`pylops.optimization.sparsity.irls`, :py:class:`pylops.optimization.sparsity.ista`, and :py:class:`pylops.optimization.sparsity.fista` solvers. These solvers can be used when ...
5,619
30.222222
85
py
pylops
pylops-master/examples/plot_convolve.py
""" Convolution =========== This example shows how to use the :py:class:`pylops.signalprocessing.Convolve1D`, :py:class:`pylops.signalprocessing.Convolve2D` and :py:class:`pylops.signalprocessing.ConvolveND` operators to perform convolution between two signals. Such operators can be used in the forward model of severa...
6,196
34.411429
86
py
pylops
pylops-master/examples/plot_l1l1.py
r""" L1-L1 IRLS ========== This example shows how to use the :py:class:`pylops.optimization.sparsity.irls` solver to solve problems in the form: .. math:: J = \left\| \mathbf{y}-\mathbf{Ax}\right\|_{1} + \epsilon \left\|\mathbf{x}\right\|_{1} This can be easily achieved by recasting the problem into this...
2,945
26.027523
103
py
pylops
pylops-master/examples/plot_shift.py
r""" Shift ===== This example shows how to use the :py:class:`pylops.signalprocessing.Shift` operator to apply fractional delay to an input signal. Whilst this operator acts on 1D signals it can also be applied on any multi-dimensional signal on a specific direction of it. """ import matplotlib.pyplot as plt import n...
3,478
28.483051
87
py
pylops
pylops-master/examples/plot_spread.py
r""" Spread How-to ================ This example focuses on the :py:class:`pylops.basicoperators.Spread` operator, which is a highly versatile operator in PyLops to perform spreading/stacking operations in a vectorized manner (or efficiently via Numba-jitted ``for`` loops). The :py:class:`pylops.basicoperators.Spread`...
7,574
32.223684
106
py
pylops
pylops-master/examples/plot_chirpradon.py
r""" Chirp Radon Transform ===================== This example shows how to use the :py:class:`pylops.signalprocessing.ChirpRadon2D` and :py:class:`pylops.signalprocessing.ChirpRadon3D` operators to apply the linear Radon Transform to 2-dimensional or 3-dimensional signals, respectively. When working with the linear Ra...
5,674
25.273148
85
py
pylops
pylops-master/examples/plot_slopeest.py
r""" Slope estimation via Structure Tensor algorithm =============================================== This example shows how to estimate local slopes or local dips of a two-dimensional array using :py:func:`pylops.utils.signalprocessing.slope_estimate` and :py:func:`pylops.utils.signalprocessing.dip_estimate`. Knowing...
10,546
35.49481
88
py
pylops
pylops-master/examples/plot_linearregr.py
r""" Linear Regression ================= This example shows how to use the :py:class:`pylops.LinearRegression` operator to perform *Linear regression analysis*. In short, linear regression is the problem of finding the best fitting coefficients, namely intercept :math:`\mathbf{x_0}` and gradient :math:`\mathbf{x_1}`,...
6,329
29.878049
79
py
pylops
pylops-master/examples/plot_blending.py
""" Blending ======== This example shows how to use the :py:class:`pylops.waveeqprocessing.blending.Blending` operator to blend seismic data to mimic state-of-the-art simultaneous shooting acquisition systems. """ import matplotlib.pyplot as plt import numpy as np import scipy as sp import pylops plt.close("all") np....
7,398
23.5
87
py
pylops
pylops-master/examples/plot_fft.py
""" Fourier Transform ================= This example shows how to use the :py:class:`pylops.signalprocessing.FFT`, :py:class:`pylops.signalprocessing.FFT2D` and :py:class:`pylops.signalprocessing.FFTND` operators to apply the Fourier Transform to the model and the inverse Fourier Transform to the data. """ import matpl...
5,786
31.329609
88
py
pylops
pylops-master/examples/plot_restriction.py
""" Restriction and Interpolation ============================= This example shows how to use the :py:class:`pylops.Restriction` operator to sample a certain input vector at desired locations ``iava``. Moreover, we go one step further and use the :py:class:`pylops.signalprocessing.Interp` operator to show how we can a...
3,699
31.45614
79
py
pylops
pylops-master/examples/plot_real.py
""" Real ==== This example shows how to use the :py:class:`pylops.basicoperators.Real` operator. This operator returns the real part of the data in forward and adjoint mode, but the forward output will be a real number, while the adjoint output will be a complex number with a zero-valued imaginary part. """ import mat...
1,194
26.790698
79
py
pylops
pylops-master/examples/plot_seislet.py
""" Seislet transform ================= This example shows how to use the :py:class:`pylops.signalprocessing.Seislet` operator. This operator the forward, adjoint and inverse Seislet transform that is a modification of the well-know Wavelet transform where local slopes are used in the prediction and update steps to fur...
8,773
37.31441
88
py
pylops
pylops-master/examples/plot_nmo.py
r""" Normal Moveout (NMO) Correction =============================== This example shows how to create your own operator for performing normal moveout (NMO) correction to a seismic record. We will perform classic NMO using an operator created from scratch, as well as using the :py:class:`pylops.Spread` operator. """ fr...
16,337
37.71564
85
py
pylops
pylops-master/examples/plot_dct.py
""" Discrete Cosine Transform ========================= This example shows how to use the :py:class:`pylops.signalprocessing.DCT` operator. This operator performs the Discrete Cosine Transform on a (single or multi-dimensional) input array. """ import matplotlib.pyplot as plt import numpy as np import pylops plt.cl...
2,648
29.802326
87
py
pylops
pylops-master/examples/plot_imag.py
""" Imag ==== This example shows how to use the :py:class:`pylops.basicoperators.Imag` operator. This operator returns the imaginary part of the data as a real value in forward mode, and the real part of the model as an imaginary value in adjoint mode (with zero real part). """ import matplotlib.pyplot as plt import n...
1,169
26.209302
79
py
pylops
pylops-master/examples/plot_causalintegration.py
r""" Causal Integration ================== This example shows how to use the :py:class:`pylops.CausalIntegration` operator to integrate an input signal (in forward mode) and to apply a smooth, regularized derivative (in inverse mode). This is a very interesting by-product of this operator which may result very useful ...
6,401
34.966292
86
py
pylops
pylops-master/examples/plot_smoothing2d.py
""" 2D Smoothing ============ This example shows how to use the :py:class:`pylops.Smoothing2D` operator to smooth a multi-dimensional input signal along two given axes. """ import matplotlib.pyplot as plt import numpy as np import pylops plt.close("all") ############################################################...
1,462
30.12766
86
py
pylops
pylops-master/examples/plot_phaseshift.py
""" PhaseShift operator ==================== This example shows how to use the :class:`pylops.waveeqprocessing.PhaseShift` operator to perform frequency-wavenumber shift of an input multi-dimensional signal. Such a procedure is applied in a variety of disciplines including geophysics, medical imaging and non-destructiv...
5,968
27.15566
81
py
pylops
pylops-master/examples/plot_describe.py
r""" Describe ======== This example focuses on the usage of the :func:`pylops.utils.describe.describe` method, which allows expressing any PyLops operator into its equivalent mathematical representation. This is done with the aid of `sympy <https://docs.sympy.org>`_, a Python library for symbolic computing """ import ...
2,071
28.183099
143
py
pylops
pylops-master/examples/plot_sum.py
""" Sum === This example shows how to use the :py:class:`pylops.Sum` operator to stack values along an axis of a multi-dimensional array """ import matplotlib.gridspec as pltgs import matplotlib.pyplot as plt import numpy as np import pylops plt.close("all") ##########################################################...
1,955
30.548387
79
py
pylops
pylops-master/examples/plot_cgls.py
r""" CGLS and LSQR Solvers ===================== This example shows how to use the :py:func:`pylops.optimization.leastsquares.cgls` and :py:func:`pylops.optimization.leastsquares.lsqr` PyLops solvers to minimize the following cost function: .. math:: J = \| \mathbf{y} - \mathbf{Ax} \|_2^2 + \epsilon \| \math...
2,394
26.848837
84
py
pylops
pylops-master/examples/plot_multiproc.py
""" Operators with Multiprocessing ============================== This example shows how perform a scalability test for one of PyLops operators that uses ``multiprocessing`` to spawn multiple processes. Operators that support such feature are :class:`pylops.basicoperators.VStack`, :class:`pylops.basicoperators.HStack`,...
2,365
37.786885
82
py
pylops
pylops-master/examples/plot_wavelet.py
""" Wavelet transform ================= This example shows how to use the :py:class:`pylops.DWT` and :py:class:`pylops.DWT2D` operators to perform 1- and 2-dimensional DWT. """ import matplotlib.pyplot as plt import numpy as np import pylops plt.close("all") ##########################################################...
2,101
29.028571
86
py
pylops
pylops-master/examples/plot_regr.py
r""" Polynomial Regression ===================== This example shows how to use the :py:class:`pylops.Regression` operator to perform *Polynomial regression analysis*. In short, polynomial regression is the problem of finding the best fitting coefficients for the following equation: .. math:: y_i = \sum_{...
4,506
27.891026
80
py
pylops
pylops-master/examples/plot_wavest.py
r""" Wavelet estimation ================== This example shows how to use the :py:class:`pylops.avo.prestack.PrestackWaveletModelling` to estimate a wavelet from pre-stack seismic data. This problem can be written in mathematical form as: .. math:: \mathbf{d}= \mathbf{G} \mathbf{w} where :math:`\mathbf{G}` is...
6,524
32.290816
93
py
pylops
pylops-master/examples/plot_radon.py
r""" Radon Transform =============== This example shows how to use the :py:class:`pylops.signalprocessing.Radon2D` and :py:class:`pylops.signalprocessing.Radon3D` operators to apply the Radon Transform to 2-dimensional or 3-dimensional signals, respectively. In our implementation both linear, parabolic and hyperbolic p...
8,846
27.631068
86
py
pylops
pylops-master/examples/plot_matrixmult.py
r""" Matrix Multiplication ===================== This example shows how to use the :py:class:`pylops.MatrixMult` operator to perform *Matrix inversion* of the following linear system. .. math:: \mathbf{y}= \mathbf{A} \mathbf{x} You will see that since this operator is a simple overloading to a :py:func:`num...
6,598
29.550926
85
py
pylops
pylops-master/examples/plot_patching.py
r""" Patching ======== This example shows how to use the :py:class:`pylops.signalprocessing.Patch2D` and :py:class:`pylops.signalprocessing.Patch3D` operators to perform repeated transforms over small patches of a 2-dimensional or 3-dimensional array. The transforms that we apply in this example are the :py:class:`pylo...
7,252
29.220833
87
py
pylops
pylops-master/examples/plot_pad.py
""" Padding ======= This example shows how to use the :py:class:`pylops.Pad` operator to zero-pad a model """ import matplotlib.pyplot as plt import numpy as np import pylops plt.close("all") ############################################################################### # Let's define a pad operator ``Pop`` for one...
1,387
25.188679
79
py
pylops
pylops-master/examples/plot_avo.py
r""" AVO modelling =================== This example shows how to create pre-stack angle gathers using the :py:class:`pylops.avo.avo.AVOLinearModelling` operator. """ import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable from scipy.signal import filtfilt ...
5,038
29.72561
87
py
pylops
pylops-master/examples/plot_roll.py
""" Roll ==== This example shows how to use the :py:class:`pylops.Roll` operator. This operator simply shifts elements of multi-dimensional array along a specified direction a chosen number of samples. """ import matplotlib.pyplot as plt import numpy as np import pylops plt.close("all") ############################...
1,554
25.810345
79
py
pylops
pylops-master/examples/plot_mdc.py
""" Multi-Dimensional Convolution ============================= This example shows how to use the :py:class:`pylops.waveeqprocessing.MDC` operator to convolve a 3D kernel with an input seismic data. The resulting data is a blurred version of the input data and the problem of removing such blurring is reffered to as *Mu...
4,199
24.609756
88
py
pylops
pylops-master/examples/plot_stacking.py
""" Operators concatenation ======================= This example shows how to use 'stacking' operators such as :py:class:`pylops.VStack`, :py:class:`pylops.HStack`, :py:class:`pylops.Block`, :py:class:`pylops.BlockDiag`, and :py:class:`pylops.Kronecker`. These operators allow for different combinations of multiple li...
10,054
32.741611
84
py
pylops
pylops-master/examples/plot_prestack.py
r""" Pre-stack modelling =================== This example shows how to create pre-stack angle gathers using the :py:class:`pylops.avo.prestack.PrestackLinearModelling` operator. """ import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable from scipy.signal ...
4,344
31.185185
84
py
pylops
pylops-master/examples/plot_bilinear.py
""" Bilinear Interpolation ====================== This example shows how to use the :py:class:`pylops.signalprocessing.Bilinar` operator to perform bilinear interpolation to a 2-dimensional input vector. """ import matplotlib.pyplot as plt import numpy as np from scipy import misc import pylops plt.close("all") np.ra...
1,982
32.05
84
py
pylops
pylops-master/examples/plot_diagonal.py
r""" Diagonal ======== This example shows how to use the :py:class:`pylops.Diagonal` operator to perform *Element-wise multiplication* between the input vector and a vector :math:`\mathbf{d}`. In other words, the operator acts as a diagonal operator :math:`\mathbf{D}` whose elements along the diagonal are the element...
3,237
27.156522
98
py
pylops
pylops-master/docs/source/conf.py
# -*- coding: utf-8 -*- import sys import os import datetime from sphinx_gallery.sorting import ExampleTitleSortKey from pylops import __version__ # Sphinx needs to be able to import the package to use autodoc and get the version number sys.path.insert(0, os.path.abspath("../../pylops")) extensions = [ "sphinx.ex...
4,717
28.304348
89
py
pylops
pylops-master/pytests/test_fredholm.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from scipy.sparse.linalg import lsqr from pylops.signalprocessing import Fredholm1 from pylops.utils import dottest par1 = { "nsl": 3, "ny": 6, "nx": 4, "nz": 5, "usematmul": True, "saveGt": True, "imag": ...
2,240
20.970588
96
py
pylops
pylops-master/pytests/test_solver.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from scipy.sparse.linalg import lsqr as sp_lsqr from pylops.basicoperators import MatrixMult from pylops.optimization.basic import cg, cgls, lsqr par1 = { "ny": 11, "nx": 11, "imag": 0, "x0": False, "dtype": "floa...
4,695
25.382022
88
py
pylops
pylops-master/pytests/test_pad.py
import numpy as np import pytest from numpy.testing import assert_array_equal from pylops.basicoperators import Pad from pylops.utils import dottest par1 = {"ny": 11, "nx": 11, "pad": ((0, 2), (4, 5)), "dtype": "float64"} # square par2 = {"ny": 21, "nx": 11, "pad": ((3, 1), (0, 3)), "dtype": "float64"} # rectangula...
1,645
30.653846
87
py
pylops
pylops-master/pytests/test_sparsity.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pylops.basicoperators import FirstDerivative, Identity, MatrixMult from pylops.optimization.sparsity import fista, irls, ista, omp, spgl1, splitbregman par1 = { "ny": 11, "nx": 11, "imag": 0, "x0": False, "dt...
10,449
24
87
py
pylops
pylops-master/pytests/test_memoizeoperator.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pylops import MemoizeOperator from pylops.basicoperators import MatrixMult, VStack par1 = {"ny": 11, "nx": 11, "imag": 0, "dtype": "float32"} # square real par1j = {"ny": 11, "nx": 11, "imag": 1j, "dtype": "complex64"} # squar...
2,334
30.986301
80
py
pylops
pylops-master/pytests/test_combine.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from scipy.sparse import random as sp_random from scipy.sparse.linalg import lsqr from pylops.basicoperators import Block, BlockDiag, HStack, MatrixMult, Real, VStack from pylops.utils import dottest par1 = {"ny": 101, "nx": 101, "im...
14,453
37.339523
88
py
pylops
pylops-master/pytests/test_smoothing.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from scipy.sparse.linalg import lsqr from pylops.basicoperators import Smoothing1D, Smoothing2D from pylops.utils import dottest par1 = {"nz": 10, "ny": 30, "nx": 20, "axis": 0} # even, first direction par2 = {"nz": 11, "ny": 51, "n...
4,926
34.702899
96
py
pylops
pylops-master/pytests/test_dwts.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from scipy.sparse.linalg import lsqr from pylops.signalprocessing import DWT, DWT2D from pylops.utils import dottest par1 = {"ny": 7, "nx": 9, "nt": 10, "imag": 0, "dtype": "float32"} # real par2 = {"ny": 7, "nx": 9, "nt": 10, "imag...
4,860
34.742647
87
py
pylops
pylops-master/pytests/test_sliding.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pylops.basicoperators import MatrixMult from pylops.signalprocessing import Sliding1D, Sliding2D, Sliding3D from pylops.signalprocessing.sliding1d import sliding1d_design from pylops.signalprocessing.sliding2d import sliding2d_de...
4,013
25.064935
88
py
pylops
pylops-master/pytests/test_signalutils.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pylops.utils.signalprocessing import convmtx, nonstationary_convmtx par1 = {"nt": 51, "imag": 0, "dtype": "float32"} # real par2 = {"nt": 51, "imag": 1j, "dtype": "complex64"} # complex np.random.seed(10) @pytest.mark.param...
1,370
25.882353
75
py
pylops
pylops-master/pytests/test_twoway.py
import devito import numpy as np from pylops.utils import dottest from pylops.waveeqprocessing.twoway import AcousticWave2D devito.configuration["log-level"] = "ERROR" par = { "ny": 10, "nx": 12, "nz": 20, "tn": 500, "dy": 3, "dx": 1, "dz": 2, "nr": 8, "ns": 2, } v0 = 2 y = np.a...
1,034
18.166667
86
py
pylops
pylops-master/pytests/test_patching.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pylops.basicoperators import MatrixMult from pylops.signalprocessing import Patch2D, Patch3D from pylops.signalprocessing.patch2d import patch2d_design from pylops.signalprocessing.patch3d import patch3d_design from pylops.utils ...
5,060
25.222798
83
py
pylops
pylops-master/pytests/test_linearoperator.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal, assert_array_equal from scipy.sparse.linalg import LinearOperator as spLinearOperator import pylops from pylops import LinearOperator from pylops.basicoperators import ( Diagonal, FirstDerivative, HStack, MatrixMult, ...
11,395
29.883469
87
py
pylops
pylops-master/pytests/test_functionoperator.py
""" test_functionoperator.py Test module for FunctionOperator. Tests 32 and 64 bit float and complex number by wrapping a matrix multiplication as a FunctionOperator. Also provides a good starting point for new tests. """ import itertools import numpy as np import pytest from numpy.testing import assert_array_almost_...
3,293
28.150442
85
py
pylops
pylops-master/pytests/test_chirpradon.py
import pytest from numpy.testing import assert_array_almost_equal from pylops.optimization.sparsity import fista from pylops.signalprocessing import ChirpRadon2D, ChirpRadon3D from pylops.utils import dottest from pylops.utils.seismicevents import linear2d, linear3d, makeaxis from pylops.utils.wavelets import ricker ...
3,206
21.117241
85
py
pylops
pylops-master/pytests/test_leastsquares.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pylops.basicoperators import Diagonal, HStack, Identity, MatrixMult, Smoothing1D from pylops.optimization.leastsquares import ( normal_equations_inversion, preconditioned_inversion, regularized_inversion, ) par1 = { ...
7,592
29.616935
85
py
pylops
pylops-master/pytests/test_basicoperators.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal, assert_array_equal from scipy.sparse import rand from scipy.sparse.linalg import lsqr from pylops.basicoperators import ( Conj, Flip, Identity, Imag, LinearRegression, MatrixMult, Real, Regression, ...
18,151
31.588869
91
py
pylops
pylops-master/pytests/test_kronecker.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal, assert_array_equal from scipy.sparse.linalg import lsqr from pylops.basicoperators import FirstDerivative, Identity, Kronecker, MatrixMult from pylops.utils import dottest par1 = {"ny": 11, "nx": 11, "imag": 0, "dtype": "float64"} ...
2,270
37.491525
89
py
pylops
pylops-master/pytests/test_interpolation.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pylops.signalprocessing import Bilinear, Interp from pylops.utils import dottest par1 = { "ny": 21, "nx": 11, "nt": 20, "imag": 0, "dtype": "float64", "kind": "nearest", } # real, nearest par2 = { "n...
12,425
26.30989
88
py
pylops
pylops-master/pytests/test_lsm.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pylops.utils.wavelets import ricker from pylops.waveeqprocessing.lsm import LSM PAR = { "ny": 10, "nx": 12, "nz": 20, "nt": 50, "dy": 3, "dx": 1, "dz": 2, "dt": 0.004, "nsy": 4, "nry": 8, ...
2,867
27.969697
82
py
pylops
pylops-master/pytests/test_marchenko.py
import numpy as np import pytest from scipy.signal import convolve from pylops.waveeqprocessing.marchenko import Marchenko # Test data inputfile = "testdata/marchenko/input.npz" # Parameters vel = 2400.0 # velocity toff = 0.045 # direct arrival time shift nsmooth = 10 # time window smoothing nfmax = 1000 # max f...
5,231
28.066667
87
py
pylops
pylops-master/pytests/test_directwave.py
import numpy as np from numpy.testing import assert_array_almost_equal from scipy.signal import convolve from pylops.waveeqprocessing.marchenko import directwave # Test data inputfile2d = "testdata/marchenko/input.npz" inputfile3d = "testdata/marchenko/direct3D.npz" # Parameters vel = 2400.0 # velocity def test_d...
2,266
24.188889
80
py
pylops
pylops-master/pytests/test_waveeqprocessing.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pylops.utils import dottest from pylops.utils.seismicevents import linear2d, linear3d, makeaxis from pylops.utils.wavelets import ricker from pylops.waveeqprocessing.mdd import MDC, MDD PAR = { "ox": 0, "dx": 2, "nx"...
6,650
25.604
85
py
pylops
pylops-master/pytests/test_convolve.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from scipy.signal.windows import triang from scipy.sparse.linalg import lsqr from pylops.signalprocessing import Convolve1D, Convolve2D, ConvolveND from pylops.utils import dottest # filters nfilt = (5, 6, 5) h1 = triang(nfilt[0], sy...
7,491
26.645756
93
py
pylops
pylops-master/pytests/test_wavelets.py
import numpy as np import pytest from pylops.utils.wavelets import gaussian, klauder, ormsby, ricker par1 = {"nt": 21, "dt": 0.004} # odd samples par2 = {"nt": 20, "dt": 0.004} # even samples @pytest.mark.parametrize("par", [(par1), (par2)]) def test_gaussian(par): """Create gaussian wavelet and check size an...
1,923
36
87
py
pylops
pylops-master/pytests/test_avo.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from scipy.signal import filtfilt from scipy.sparse.linalg import lsqr from pylops.avo.avo import ( akirichards, approx_zoeppritz_pp, fatti, zoeppritz_element, zoeppritz_pp, zoeppritz_scattering, ) from pylops....
4,526
32.533333
88
py
pylops
pylops-master/pytests/test_seismicevents.py
import numpy as np import pytest from numpy.testing import assert_array_equal from pylops.utils.seismicevents import ( hyperbolic2d, hyperbolic3d, linear2d, linear3d, makeaxis, parabolic2d, ) from pylops.utils.wavelets import ricker # Wavelet wav = ricker(np.arange(41) * 0.004, f0=10)[0] par1...
6,630
23.742537
80
py
pylops
pylops-master/pytests/test_dct.py
import numpy as np import pytest from pylops.signalprocessing import DCT from pylops.utils import dottest par1 = {"ny": 11, "nx": 11, "imag": 0, "dtype": "float64"} par2 = {"ny": 11, "nx": 21, "imag": 0, "dtype": "float64"} par3 = {"ny": 21, "nx": 21, "imag": 0, "dtype": "float64"} @pytest.mark.parametrize("par", [...
2,438
29.4875
86
py
pylops
pylops-master/pytests/test_seismicinterpolation.py
# import multiprocessing import numpy as np import pytest from pylops.basicoperators import Restriction from pylops.utils.seismicevents import linear2d, linear3d, makeaxis from pylops.utils.wavelets import ricker from pylops.waveeqprocessing.seismicinterpolation import SeismicInterpolation np.random.seed(5) # avoid...
4,790
23.823834
85
py
pylops
pylops-master/pytests/test_blending.py
import numpy as np import pytest from pylops.utils import dottest from pylops.waveeqprocessing import BlendingContinuous, BlendingGroup, BlendingHalf par = {"nt": 101, "ns": 50, "nr": 20, "dtype": "float64"} d = np.random.normal(0, 1, (par["ns"], par["nr"], par["nt"])) dt = 0.004 @pytest.mark.parametrize("par", [(...
2,175
24.011494
83
py
pylops
pylops-master/pytests/test_prestack.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from scipy.signal import filtfilt from pylops.avo.prestack import ( PrestackInversion, PrestackLinearModelling, PrestackWaveletModelling, _linearizations, ) from pylops.utils import dottest from pylops.utils.wavelets i...
9,847
24.512953
88
py
pylops
pylops-master/pytests/test_seislet.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pylops.basicoperators import FunctionOperator from pylops.signalprocessing import Seislet from pylops.signalprocessing.seislet import _predict_haar, _predict_lin, _predict_trace from pylops.utils import dottest par1 = { "nx"...
3,456
27.808333
88
py
pylops
pylops-master/pytests/test_poststack.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from scipy.signal import filtfilt from pylops.avo.poststack import PoststackInversion, PoststackLinearModelling from pylops.utils import dottest from pylops.utils.wavelets import ricker np.random.seed(10) # params dt0 = 0.004 ntwav ...
6,020
28.370732
88
py
pylops
pylops-master/pytests/test_causalintegration.py
import itertools import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pylops.basicoperators import CausalIntegration, FirstDerivative from pylops.utils import dottest par1 = { "nt": 20, "nx": 101, "dt": 1.0, "imag": 0, "dtype": "float64", } # even samples, re...
4,999
27.248588
86
py
pylops
pylops-master/pytests/test_ffts.py
import itertools import numpy as np import pytest from numpy.testing import assert_array_almost_equal from scipy.sparse.linalg import lsqr from pylops.signalprocessing import FFT, FFT2D, FFTND from pylops.utils import dottest # Utility function def _choose_random_axes(ndim, n_choices=2): """Chooses `n_choices` ...
45,216
29.801771
109
py
pylops
pylops-master/pytests/test_eigs.py
import numpy as np import pytest from pylops.basicoperators import MatrixMult from pylops.optimization.eigs import power_iteration par1 = {"n": 21, "imag": 0, "dtype": "float32"} # square, real par2 = {"n": 21, "imag": 1j, "dtype": "complex64"} # square, complex @pytest.mark.parametrize("par", [(par1), (par2)]) d...
981
27.882353
82
py
pylops
pylops-master/pytests/test_oneway.py
import numpy as np import pytest from pylops.basicoperators import Identity from pylops.utils import dottest from pylops.utils.seismicevents import hyperbolic2d, makeaxis from pylops.utils.wavelets import ricker from pylops.waveeqprocessing.oneway import Deghosting, PhaseShift np.random.seed(10) parmod = { "ox":...
3,008
26.108108
87
py
pylops
pylops-master/pytests/test_transpose.py
import numpy as np import pytest from numpy.testing import assert_equal from pylops.basicoperators import Transpose from pylops.utils import dottest par1 = {"ny": 21, "nx": 11, "nt": 20, "imag": 0, "dtype": "float64"} # real par2 = {"ny": 21, "nx": 11, "nt": 20, "imag": 1j, "dtype": "complex128"} # complex np.rand...
1,640
28.303571
83
py
pylops
pylops-master/pytests/test_metrics.py
import numpy as np import pytest from pylops.utils.metrics import mae, mse, psnr, snr par1 = {"nx": 11, "dtype": "float64"} # float64 par2 = {"nx": 11, "dtype": "float32"} # float32 @pytest.mark.parametrize("par", [(par1), (par2)]) def test_mae(par): """Check MAE with same vector and vector of zeros""" xr...
1,435
24.642857
57
py
pylops
pylops-master/pytests/test_tapers.py
import numpy as np import pytest from numpy.testing import assert_array_equal from pylops.utils.tapers import taper2d, taper3d par1 = { "nt": 21, "nspat": (11, 13), "ntap": (3, 5), "tapertype": "hanning", } # hanning, odd samples and taper par2 = { "nt": 20, "nspat": (12, 16), "ntap": (4,...
2,076
29.101449
81
py
pylops
pylops-master/pytests/test_radon.py
import multiprocessing import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pylops.optimization.sparsity import fista from pylops.signalprocessing import Radon2D, Radon3D from pylops.utils import dottest par1 = { "nt": 11, "nhx": 21, "nhy": 10, "npx": 21, "npy...
5,828
23.389121
82
py
pylops
pylops-master/pytests/test_describe.py
import numpy as np from pylops.basicoperators import BlockDiag, Diagonal, HStack, MatrixMult from pylops.utils.describe import describe def test_describe(): """Testing the describe method. As it is is difficult to verify that the output is correct, at this point we merely test that no error arises when a...
827
21.378378
77
py
pylops
pylops-master/pytests/test_estimators.py
import numpy as np import pytest from numpy.testing import assert_almost_equal from pylops.basicoperators import MatrixMult SAMPLERS = ["gaussian", "rayleigh", "rademacher", "unitvector"] DTYPES = ["float32", "float64"] pars_hutchinson = [ {"n": 100, "dtype": dtype, "sampler": sampler} for dtype in DTYPES ...
2,702
26.03
63
py
pylops
pylops-master/pytests/test_nonstatconvolve.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from scipy.signal.windows import triang from scipy.sparse.linalg import lsqr from pylops.signalprocessing import ( Convolve1D, Convolve2D, NonStationaryConvolve1D, NonStationaryConvolve2D, NonStationaryFilters1D, ...
8,753
30.489209
93
py
pylops
pylops-master/pytests/test_derivative.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal, assert_array_equal from pylops.basicoperators import ( FirstDerivative, FirstDirectionalDerivative, Gradient, Laplacian, SecondDerivative, SecondDirectionalDerivative, ) from pylops.utils import dottest par1 ...
21,044
27.248322
88
py
pylops
pylops-master/pytests/test_torchoperator.py
import numpy as np import pytest import torch from numpy.testing import assert_array_equal from pylops import MatrixMult, TorchOperator par1 = {"ny": 11, "nx": 11, "dtype": np.float32} # square par2 = {"ny": 21, "nx": 11, "dtype": np.float32} # overdetermined np.random.seed(0) @pytest.mark.parametrize("par", [(p...
2,110
29.157143
88
py
pylops
pylops-master/pytests/test_diagonal.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from scipy.sparse.linalg import lsqr as sp_lsqr from pylops.basicoperators import Diagonal from pylops.optimization.basic import lsqr from pylops.utils import dottest par1 = {"ny": 21, "nx": 11, "nt": 20, "imag": 0, "dtype": "float32...
4,591
36.950413
104
py
pylops
pylops-master/pytests/test_wavedecomposition.py
import numpy as np import pytest from pylops.utils.seismicevents import hyperbolic2d, hyperbolic3d, makeaxis from pylops.utils.wavelets import ricker from pylops.waveeqprocessing.wavedecomposition import ( PressureToVelocity, UpDownComposition2D, UpDownComposition3D, WavefieldDecomposition, ) # params...
5,596
27.125628
87
py
pylops
pylops-master/pytests/test_shift.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from scipy.sparse.linalg import lsqr from pylops.signalprocessing import Shift from pylops.utils import dottest from pylops.utils.wavelets import gaussian par1 = {"nt": 41, "nx": 41, "ny": 11, "imag": 0, "dtype": "float64"} # square...
4,466
28.196078
97
py
pylops
pylops-master/pytests/test_restriction.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pylops.basicoperators import Restriction from pylops.utils import dottest par1 = { "ny": 21, "nx": 11, "nt": 20, "imag": 0, "dtype": "float64", "inplace": "True", } # real, inplace par2 = { "ny": 21,...
6,129
28.190476
87
py
pylops
pylops-master/pytests/test_kirchhoff.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from pylops.utils import dottest from pylops.utils.wavelets import ricker from pylops.waveeqprocessing.kirchhoff import Kirchhoff PAR = { "ny": 3, "nx": 12, "nz": 20, "nt": 50, "dy": 3, "dx": 1, "dz": 2, ...
10,879
25.280193
92
py