From 7ddc7d53bdaad5ad4557ef91bf436fdcf503675a Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Wed, 31 Jan 2024 21:55:10 +0000 Subject: [PATCH] build based on 064de50 --- dev/about/index.html | 2 +- dev/abstract_vectors/index.html | 8 ++++---- dev/basics/index.html | 2 +- dev/data_structures/index.html | 10 +++++----- dev/helper/index.html | 6 +++--- dev/index.html | 2 +- dev/installation/index.html | 2 +- dev/inversion/index.html | 10 +++++----- dev/io/index.html | 2 +- dev/linear_operators/index.html | 10 +++++----- dev/preconditioners/index.html | 12 ++++++------ dev/pysource/index.html | 2 +- dev/search/index.html | 2 +- dev/tutorials/01_intro/index.html | 2 +- dev/tutorials/02_fwi_example_NLopt/index.html | 2 +- dev/tutorials/03_constrained_fwi/index.html | 2 +- .../04_judi_leading_edge_tutorial/index.html | 2 +- dev/tutorials/05_custom_misfit/index.html | 2 +- .../06_automatic_differentiation/index.html | 2 +- dev/tutorials/07_preconditionners/index.html | 2 +- dev/tutorials/imaging_conditions/index.html | 2 +- dev/tutorials/quickstart/index.html | 2 +- 22 files changed, 44 insertions(+), 44 deletions(-) diff --git a/dev/about/index.html b/dev/about/index.html index b292e6a17..4ed7df6a1 100644 --- a/dev/about/index.html +++ b/dev/about/index.html @@ -10,4 +10,4 @@ doi = {10.1190/geo2018-0174.1}, URL = {https://doi.org/10.1190/geo2018-0174.1}, eprint = {https://doi.org/10.1190/geo2018-0174.1} -}

Also visit the Devito homepage at https://www.devitoproject.org/publications for more information and references. If you need to cite a specific version of JUDI, you can find our citeable archives on Zenodo.

Contribution and community

We gladly welcome and encorage contributions from the community to improve our software and its usability. Feel free to:

Field examples

An example of using JUDI to invert field data is provided for the Viking Graben Line 12 which includes data preprocessing steps using Madagascar.

+}

Also visit the Devito homepage at https://www.devitoproject.org/publications for more information and references. If you need to cite a specific version of JUDI, you can find our citeable archives on Zenodo.

Contribution and community

We gladly welcome and encorage contributions from the community to improve our software and its usability. Feel free to:

Field examples

An example of using JUDI to invert field data is provided for the Viking Graben Line 12 which includes data preprocessing steps using Madagascar.

diff --git a/dev/abstract_vectors/index.html b/dev/abstract_vectors/index.html index 77893408b..0b581ccc1 100644 --- a/dev/abstract_vectors/index.html +++ b/dev/abstract_vectors/index.html @@ -5,7 +5,7 @@ seis_block = segy_read("test_file.segy") dobs = judiVector(seis_block; segy_depth_key="RecGroupElevation")

(4) Construct out-of-core data vector from SegyIO.SeisCon object (for large SEG-Y files):

using SegyIO
 seis_container = segy_scan("/path/to/data/directory","filenames",["GroupX","GroupY","RecGroupElevation","SourceDepth","dt"])
-dobs = judiVector(seis_container; segy_depth_key="RecGroupElevation")
source

Access fields (in-core data containers):

# Access i-th shot record
+dobs = judiVector(seis_container; segy_depth_key="RecGroupElevation")
source

Access fields (in-core data containers):

# Access i-th shot record
 x.data[i]
 
 # Extract judiVector for i-th shot
@@ -42,7 +42,7 @@
 y = x * α
 
 # Concatenate
-y = vcat(x, x)

judiWavefield

Abstract vector class for wavefields.

Construction:

JUDI.judiWavefieldType

judiWavefield nsrc::Integer dt::AbstractFloat data

Abstract vector for seismic wavefields.

Constructors

Construct wavefield vector from an info structure, a cell array of wavefields and the computational
time step dt:

judiWavefield(nsrc, dt, data)
source

Access fields:

# Access wavefield from i-th shot location
+y = vcat(x, x)

judiWavefield

Abstract vector class for wavefields.

Construction:

JUDI.judiWavefieldType

judiWavefield nsrc::Integer dt::AbstractFloat data

Abstract vector for seismic wavefields.

Constructors

Construct wavefield vector from an info structure, a cell array of wavefields and the computational
time step dt:

judiWavefield(nsrc, dt, data)
source

Access fields:

# Access wavefield from i-th shot location
 u.data[i]

Operations:

Supports some basic arithmetric operations:

# Size 
 size(u)
 
@@ -70,5 +70,5 @@
 # Info structure
 rhs.info

judiWeights

Abstract vector class for extended source weights. The weights for each shot location have the dimensions of the model (namely model.n).

Construction:

JUDI.judiWeightsMethod
judiWeights
     nsrc
-    weights

Abstract vector for weighting an extended source, which is injected at every grid point, as weighted by this vector. Constructors ============ Construct vector cell array of weights. The weights keyword
can also be a single (non-cell) array, in which case the weights are the same for all source positions: judiWeights(weights; nsrc=1)

source

Parameters:

Access fields:

# Access weights of i-th shot locatoin
-w.weights[i]

Operations:

Supports the same arithmetric operations as a judiVector.

+ weights

Abstract vector for weighting an extended source, which is injected at every grid point, as weighted by this vector. Constructors ============ Construct vector cell array of weights. The weights keyword
can also be a single (non-cell) array, in which case the weights are the same for all source positions: judiWeights(weights; nsrc=1)

source

Parameters:

Access fields:

# Access weights of i-th shot locatoin
+w.weights[i]

Operations:

Supports the same arithmetric operations as a judiVector.

diff --git a/dev/basics/index.html b/dev/basics/index.html index 90a4b6f11..a4b45db01 100644 --- a/dev/basics/index.html +++ b/dev/basics/index.html @@ -320,4 +320,4 @@ for j=1:nsrc J.options.frequencies[j] = select_frequencies(q_dist; fmin=0.003, fmax=0.04, nf=nfreq) end

Once the options.frequencies field is set, on-the-fly DFTs are used for both born modeling and RTM. To save computational cost, we can limit the number of DFTs that are performed. Rather than computing the DFT at every time step, we can define a subsampling factor as follows:

# Compute DFT every 4 time steps
-J.options.dft_subsampling_factor=4
+J.options.dft_subsampling_factor=4 diff --git a/dev/data_structures/index.html b/dev/data_structures/index.html index 24d5fb8f6..c70804403 100644 --- a/dev/data_structures/index.html +++ b/dev/data_structures/index.html @@ -11,8 +11,8 @@ PhysicalParameter(v::Array{T, N}, n::NTuple{N, T}, d::NTuple{N, T}, o::Tuple) where `v` is a vector or nd-array that is reshaped into shape `n` -PhysicalParameter(v::T, n::NTuple{N, T}, d::NTuple{N, T}, o::Tuple) Creates a constant (single number) PhyicalParametersource

Unless specified otherwise with the return_array option in Options, the result of a migration/FWIgradient(judiJacobian, fwi_objective, lsrtm_objective) will be wrapped into a PhysicalParameter. THis allow better handling of different model parts and a better representation of the dimensional array.

Model structure

Data structure for velocity models in JUDI.

JUDI.ModelFunction
Model(n, d, o, m; epsilon=nothing, delta=nothing, theta=nothing,
-        phi=nothing, rho=nothing, qp=nothing, vs=nothing, nb=40)

The parameters n, d, o and m are mandatory, whith nb and other physical parameters being optional input arguments.

where

m: velocity model in slowness squared (s^2/km^2)

epsilon: Epsilon thomsen parameter ( between -1 and 1)

delta: Delta thomsen parameter ( between -1 and 1 and delta < epsilon)

theta: Anisotopy dip in radian

phi: Anisotropy asymuth in radian

rho: density (g / m^3)

qp: P-wave attenuation for visco-acoustic models

vs: S-wave velocity for elastic models.

nb: Number of ABC points

source

Accessible fields include all of the above parameters p.n, p.d, p.o, p.data. Additionaly, arithmetic operation are all impemented such as addition, multiplication, broadcasting and indexing. Linear algebra operation are implemented as well but will return a standard Julia vector if the matrix used is external to JUDI.

Access fields:

Accessible fields include all of the above parameters, which can be accessed as follows:

# Access model
+PhysicalParameter(v::T, n::NTuple{N, T}, d::NTuple{N, T}, o::Tuple) Creates a constant (single number) PhyicalParameter
source

Unless specified otherwise with the return_array option in Options, the result of a migration/FWIgradient(judiJacobian, fwi_objective, lsrtm_objective) will be wrapped into a PhysicalParameter. THis allow better handling of different model parts and a better representation of the dimensional array.

Model structure

Data structure for velocity models in JUDI.

JUDI.ModelFunction
Model(n, d, o, m; epsilon=nothing, delta=nothing, theta=nothing,
+        phi=nothing, rho=nothing, qp=nothing, vs=nothing, nb=40)

The parameters n, d, o and m are mandatory, whith nb and other physical parameters being optional input arguments.

where

m: velocity model in slowness squared (s^2/km^2)

epsilon: Epsilon thomsen parameter ( between -1 and 1)

delta: Delta thomsen parameter ( between -1 and 1 and delta < epsilon)

theta: Anisotopy dip in radian

phi: Anisotropy asymuth in radian

rho: density (g / m^3)

qp: P-wave attenuation for visco-acoustic models

vs: S-wave velocity for elastic models.

nb: Number of ABC points

source

Accessible fields include all of the above parameters p.n, p.d, p.o, p.data. Additionaly, arithmetic operation are all impemented such as addition, multiplication, broadcasting and indexing. Linear algebra operation are implemented as well but will return a standard Julia vector if the matrix used is external to JUDI.

Access fields:

Accessible fields include all of the above parameters, which can be accessed as follows:

# Access model
 model.m
 
 # Access number of grid points
@@ -38,14 +38,14 @@
 src_geometry = Geometry(seis_block; key="source", segy_depth_key="SourceDepth")

Check the seis_block's header entries to findall out which keywords contain the depth coordinates. The source depth keyword is either SourceDepth or SourceSurfaceElevation. The receiver depth keyword is typically RecGroupElevation.

(4) Read source and receiver geometries from out-of-core SEG-Y files (for large data sets). Returns an out-of-core geometry object GeometryOOC without the source/receiver coordinates, but a lookup table instead:

using SegyIO
 seis_container = segy_scan("/path/to/data/directory","filenames",["GroupX","GroupY","RecGroupElevation","SourceDepth","dt"])
 rec_geometry = Geometry(seis_container; key="receiver", segy_depth_key="RecGroupElevation")
-src_geometry = Geometry(seis_container; key="source", segy_depth_key="SourceDepth")
source

From the optional arguments, you have to pass (at least) two of dt, nt and t. The third value is automatically determined and set from the two other values. a Geometry can be constructed in a number of different ways for in-core and out-of-core cases. Check our examples and the source for additional details while the documentation is being extended.

Access fields:

Accessible fields include all of the above parameters, which can be accessed as follows:

# Access cell arrays of x coordinates:
+src_geometry = Geometry(seis_container; key="source", segy_depth_key="SourceDepth")
source

From the optional arguments, you have to pass (at least) two of dt, nt and t. The third value is automatically determined and set from the two other values. a Geometry can be constructed in a number of different ways for in-core and out-of-core cases. Check our examples and the source for additional details while the documentation is being extended.

Access fields:

Accessible fields include all of the above parameters, which can be accessed as follows:

# Access cell arrays of x coordinates:
 geometry.xloc
 
 # Access x coordinates of the i-th source location
 geometry.xloc[i]
 
 # Access j-th receiver location (in x) of the i-th source location
-geometry.xloc[i][j]

Geometry utilities

A few utilities to manipulates geometries are provided as well.

JUDI.super_shot_geometryFunction
super_shot_geometry(Geometry)

Merge all the sub-geometries 1:get_nsrc(Geometry) into a single supershot geometry

source
JUDI.reciprocal_geomFunction
reciprocal_geom(sourceGeom, recGeom)

Applies reciprocity to the par of geometries sourceGeom and recGeom where each source becomes a receiver and each receiver becomes a source.

This method expects:

  • Both geometries to be In Core. If the geometries are OOC they will be converted to in core geometries
  • The metadata to be compatible. In details all the time sampling rates (dt) and recording times (t) must be the same
  • The source to be single point sources. This method will error if a simultaneous sources (multiple poisiton for a single source) are used.
source

Options structure

The options structure allows setting several modeling parameters.

JUDI.OptionsFunction
JUDIOptions
+geometry.xloc[i][j]

Geometry utilities

A few utilities to manipulates geometries are provided as well.

JUDI.super_shot_geometryFunction
super_shot_geometry(Geometry)

Merge all the sub-geometries 1:get_nsrc(Geometry) into a single supershot geometry

source
JUDI.reciprocal_geomFunction
reciprocal_geom(sourceGeom, recGeom)

Applies reciprocity to the par of geometries sourceGeom and recGeom where each source becomes a receiver and each receiver becomes a source.

This method expects:

  • Both geometries to be In Core. If the geometries are OOC they will be converted to in core geometries
  • The metadata to be compatible. In details all the time sampling rates (dt) and recording times (t) must be the same
  • The source to be single point sources. This method will error if a simultaneous sources (multiple poisiton for a single source) are used.
source

Options structure

The options structure allows setting several modeling parameters.

JUDI.OptionsFunction
JUDIOptions
     space_order::Integer
     free_surface::Bool
     limit_m::Bool
@@ -70,4 +70,4 @@
         num_checkpoints=nothing, checkpoints_maxmem=nothing,
         frequencies=[], isic=false,
         subsampling_factor=1, dft_subsampling_factor=1, return_array=false,
-        dt_comp=nothing, f0=0.015f0)
source

notes

Option has been renamed JUDIOptions as of JUDI version 4.0 to avoid potential (and exisiting) conflicts wiht other packages exporting an Options structure.

+ dt_comp=nothing, f0=0.015f0)source

notes

Option has been renamed JUDIOptions as of JUDI version 4.0 to avoid potential (and exisiting) conflicts wiht other packages exporting an Options structure.

diff --git a/dev/helper/index.html b/dev/helper/index.html index ee761a38a..8a0a32b03 100644 --- a/dev/helper/index.html +++ b/dev/helper/index.html @@ -1,9 +1,9 @@ -Helper Functions · JUDI documentation

Helper functions

JUDI provides numerous helper and utility functions need for seismic modeling and inversion.

Ricker wavelet

Create a 1D Ricker wavelet:

Missing docstring.

Missing docstring for ricker_wavelet(tmax, dt, f0; t0=nothing). Check Documenter's build log for details.

Compute CFL time stepping interval

Calculate the time stepping interval based on the CFL condition

calculate_dt

Compute number of computational time steps

Estimate the number of computational time steps. Required for calculating the dimensions of the matrix-free linear modeling operators:

JUDI.get_computational_ntFunction
get_computational_nt(srcGeometry, recGeoemtry, model; dt=nothing)

Estimate the number of computational time steps. Required for calculating the dimensions
of the matrix-free linear modeling operators. srcGeometry and recGeometry are source
and receiver geometries of type Geometry and model is the model structure of type
Model.

source
get_computational_nt(Geoemtry, model; dt=nothing)

Estimate the number of computational time steps. Required for calculating the dimensions
of the matrix-free linear modeling operators. srcGeometry and recGeometry are source
and receiver geometries of type Geometry and model is the model structure of type
Model.

source

Set up 3D acquisition grid

Helper function to create a regular acquisition grid for a 3D survey.

setup_3D_grid

Data interpolation

Time interpolation for source/receiver data using splines. For modeling, the data is interpolated automatically onto the computational time axis, so generally, these functions are not needed for users.

JUDI.time_resampleFunction
time_resample(data, geometry_in, dt_new)

Resample the input data with sinc interpolation from the current time sampling (geometrtyin) to the new time sampling `dtnew`.

Parameters

  • data: Data to be reampled. If data is a matrix, resamples each column.
  • geometry_in: Geometry on which data is defined.
  • dt_new: New time sampling rate to interpolate onto.
source
time_resample(data, dt_in, dt_new)

Resample the input data with sinc interpolation from the current time sampling dtin to the new time sampling `dtnew`.

Parameters

  • data: Data to be reampled. If data is a matrix, resamples each column.
  • dt_in: Time sampling of input
  • dt_new: New time sampling rate to interpolate onto.
source
time_resample(data, dt_in, geometry_in)

Resample the input data with sinc interpolation from the current time sampling (dtin) to the new time sampling `geometryout`.

Parameters

  • data: Data to be reampled. If data is a matrix, resamples each column.
  • geometry_out: Geometry on which data is to be interpolated.
  • dt_in: Time sampling rate of the data.
source

Generate and sample from frequency distribution

Create a probability distribution with the shape of the source spectrum from which we can draw random frequencies.

JUDI.generate_distributionFunction
generate_distribution(x; src_no=1)

Generates a probability distribution for the discrete input judiVector x.

Parameters

  • x: judiVector. Usualy a source with a single trace per source position.
  • src_no: Index of the source to select out of x
source
JUDI.select_frequenciesFunction
select_frequencies(q_dist; fmin=0f0, fmax=Inf, nf=1)

Selects nf frequencies based on the source distribution q_dist computed with generate_distribution.

Parameters

  • q_dist: Distribution to sample from.
  • f_min: Minimum acceptable frequency to sample (defaults to 0).
  • f_max: Maximum acceptable frequency to sample (defaults to Inf).
  • fd: Number of frequnecies to sample (defaults to 1).
source

We can draw random samples from dist by passing it values between 0 and 1:

# Draw a single random frequency
+Helper Functions · JUDI documentation

Helper functions

JUDI provides numerous helper and utility functions need for seismic modeling and inversion.

Ricker wavelet

Create a 1D Ricker wavelet:

Missing docstring.

Missing docstring for ricker_wavelet(tmax, dt, f0; t0=nothing). Check Documenter's build log for details.

Compute CFL time stepping interval

Calculate the time stepping interval based on the CFL condition

calculate_dt

Compute number of computational time steps

Estimate the number of computational time steps. Required for calculating the dimensions of the matrix-free linear modeling operators:

JUDI.get_computational_ntFunction
get_computational_nt(srcGeometry, recGeoemtry, model; dt=nothing)

Estimate the number of computational time steps. Required for calculating the dimensions
of the matrix-free linear modeling operators. srcGeometry and recGeometry are source
and receiver geometries of type Geometry and model is the model structure of type
Model.

source
get_computational_nt(Geoemtry, model; dt=nothing)

Estimate the number of computational time steps. Required for calculating the dimensions
of the matrix-free linear modeling operators. srcGeometry and recGeometry are source
and receiver geometries of type Geometry and model is the model structure of type
Model.

source

Set up 3D acquisition grid

Helper function to create a regular acquisition grid for a 3D survey.

setup_3D_grid

Data interpolation

Time interpolation for source/receiver data using splines. For modeling, the data is interpolated automatically onto the computational time axis, so generally, these functions are not needed for users.

JUDI.time_resampleFunction
time_resample(data, geometry_in, dt_new)

Resample the input data with sinc interpolation from the current time sampling (geometrtyin) to the new time sampling `dtnew`.

Parameters

  • data: Data to be reampled. If data is a matrix, resamples each column.
  • geometry_in: Geometry on which data is defined.
  • dt_new: New time sampling rate to interpolate onto.
source
time_resample(data, dt_in, dt_new)

Resample the input data with sinc interpolation from the current time sampling dtin to the new time sampling `dtnew`.

Parameters

  • data: Data to be reampled. If data is a matrix, resamples each column.
  • dt_in: Time sampling of input
  • dt_new: New time sampling rate to interpolate onto.
source
time_resample(data, dt_in, geometry_in)

Resample the input data with sinc interpolation from the current time sampling (dtin) to the new time sampling `geometryout`.

Parameters

  • data: Data to be reampled. If data is a matrix, resamples each column.
  • geometry_out: Geometry on which data is to be interpolated.
  • dt_in: Time sampling rate of the data.
source

Generate and sample from frequency distribution

Create a probability distribution with the shape of the source spectrum from which we can draw random frequencies.

JUDI.generate_distributionFunction
generate_distribution(x; src_no=1)

Generates a probability distribution for the discrete input judiVector x.

Parameters

  • x: judiVector. Usualy a source with a single trace per source position.
  • src_no: Index of the source to select out of x
source
JUDI.select_frequenciesFunction
select_frequencies(q_dist; fmin=0f0, fmax=Inf, nf=1)

Selects nf frequencies based on the source distribution q_dist computed with generate_distribution.

Parameters

  • q_dist: Distribution to sample from.
  • f_min: Minimum acceptable frequency to sample (defaults to 0).
  • f_max: Maximum acceptable frequency to sample (defaults to Inf).
  • fd: Number of frequnecies to sample (defaults to 1).
source

We can draw random samples from dist by passing it values between 0 and 1:

# Draw a single random frequency
 f = dist(rand(1))
 
 # Draw 10 random frequencies
-f = dist(rand(10))

Alternatively, we can use the function:

f = select_frequencies(dist; fmin=0f0, fmax=Inf, nf=1)

to draw nf number of frequencies for a given distribution dist in the frequency range of fmin to fmax (both in kHz).

Read data from out of core container

In the case where a judiVector is out of core (points to a segy file) it is possible to convert it or part of it into an in core judiVecor with the get_data function.

d_ic = get_data(d_ooc, inds)

where inds is either a single index, a list of index or a range of index.

Restrict model to acquisition

In practice, and in particular for marine data, the aperture of a single shot is much smaller than the full model size. We provide a function (automatically used when the option limit_m is set in Options) that limits the model to the acquisition area.

JUDI.limit_model_to_receiver_areaFunction
limit_model_to_receiver_area(srcGeometry, recGeometry, model, buffer; pert=nothing)

Crops the model to the area of the source an receiver with an extra buffer. This reduces the size of the problem when the model si large and the source and receiver located in a small part of the domain.

In the cartoon below, the full model will be cropped to the center area containg the source (o) receivers (x) and buffer area (*)

  • o Source position
  • x receiver positions
    • Extra buffer (grid spacing in that simple case)

| . . . . . . . . . . . . . . . . . . . . . |

| . . . . . . . . . . . . . . . . . . . . . |

| . . . . * * * * * * * * * * * * . . . . . |

| . . . . * x x x x x x x x x x * . . . . . |

| . . . . * x x x x x x x x x x * . . . . . |

| . . . . * x x x x x x x x x x * . . . . . |

| . . . . * x x x x x o x x x x * . . . . . |

| . . . . * x x x x x x x x x x * . . . . . |

| . . . . * x x x x x x x x x x * . . . . . |

| . . . . * x x x x x x x x x x * . . . . . |

| . . . . * * * * * * * * * * * * . . . . . |

| . . . . . . . . . . . . . . . . . . . . . |

| . . . . . . . . . . . . . . . . . . . . . |


Parameters

  • srcGeometry: Geometry of the source.
  • recGeometry: Geometry of the receivers.
  • model: Model to be croped.
  • buffer: Size of the buffer on each side.
  • pert: Model perturbation (optional) to be cropped as well.
source

We also provide it's complement that removes receivers outside of the computational domain if the dataset contains locations that are not wanted

JUDI.remove_out_of_bounds_receiversFunction
remove_out_of_bounds_receivers(recGeometry, model)

Removes receivers that are positionned outside the computational domain defined by the model.

Parameters

  • recGeometry: Geometry of receivers in which out of bounds will be removed.
  • model: Model defining the computational domain.
source
remove_out_of_bounds_receivers(recGeometry, recData, model)

Removes receivers that are positionned outside the computational domain defined by the model.

Parameters

  • recGeometry: Geometry of receivers in which out of bounds will be removed.
  • recData: Shot record for that geometry in which traces will be removed.
  • model: Model defining the computational domain.
source

Additional miscellanous utilities

JUDI.devito_modelFunction
devito_model(model, options;dm=nothing)

Creates a python side model strucutre for devito.

Parameters

  • model: JUDI Model structure.
  • options: JUDI Options structure.
  • dm: Squared slowness perturbation (optional), Array or PhysicalParameter.
source
JUDI.setup_gridFunction
setup_grid(geometry, n)

Sets up the coordinate arrays for Devito.

Parameters:

  • geometry: Geometry containing the coordinates
  • n: Domain size
source
JUDI.pad_sizesFunction
pad_sizes(model, options; so=nothing)

Computes ABC padding sizes according to the model's numbr of abc points and spatial order

Parameters

  • model: JUDI or Python side Model.
  • options: JUDI Options structure.
  • so: Space order (optional) defaults to options.space_order.
source
JUDI.pad_arrayFunction
pad_array(m, nb; mode=:border)

Pads to the input array with either copying the edge value (:border) or zeros (:zeros)

Parameters

  • m: Array to be padded.
  • nb: Size of padding. Array of tuple with one (nbleft, nbright) tuple per dimension.
  • mode: Padding mode (optional), defaults to :border.
source
JUDI.remove_paddingFunction
remove_padding(m, nb; true_adjoint=False)

Removes the padding from array m. This is the adjoint of pad_array.

Parameters

  • m: Array to remvove padding from.
  • nb: Size of padding. Array of tuple with one (nbleft, nbright) tuple per dimension.
  • true_adjoint: Unpadding mode, defaults to False. Will sum the padding to the edge point with true_adjoint=true

and should only be used this way for adjoint testing purpose.

source
JUDI.convertToCellFunction
convertToCell(x)

Convert an array x to a cell array (Array{Any,1}) with length(x) entries,
where the i-th cell contains the i-th entry of x.

Parameters

  • x: Array to be converted into and array of array
source
JUDI.process_input_dataFunction
process_input_data(input, geometry, nsrc)

Preprocesses input Array into an Array of Array for modeling

Parameters:

  • input: Input to preprocess.
  • geometry: Geometry containing physical parameters.
  • nsrc: Number of sources
source
process_input_data(input, model, nsrc)

Preprocesses input Array into an Array of Array for modeling

Parameters:

  • input: Input to preprocess.
  • model: Model containing physical parameters.
  • nsrc: Number of sources
source
Base.reshapeFunction
reshape(A, dims...) -> AbstractArray
+f = dist(rand(10))

Alternatively, we can use the function:

f = select_frequencies(dist; fmin=0f0, fmax=Inf, nf=1)

to draw nf number of frequencies for a given distribution dist in the frequency range of fmin to fmax (both in kHz).

Read data from out of core container

In the case where a judiVector is out of core (points to a segy file) it is possible to convert it or part of it into an in core judiVecor with the get_data function.

d_ic = get_data(d_ooc, inds)

where inds is either a single index, a list of index or a range of index.

Restrict model to acquisition

In practice, and in particular for marine data, the aperture of a single shot is much smaller than the full model size. We provide a function (automatically used when the option limit_m is set in Options) that limits the model to the acquisition area.

JUDI.limit_model_to_receiver_areaFunction
limit_model_to_receiver_area(srcGeometry, recGeometry, model, buffer; pert=nothing)

Crops the model to the area of the source an receiver with an extra buffer. This reduces the size of the problem when the model si large and the source and receiver located in a small part of the domain.

In the cartoon below, the full model will be cropped to the center area containg the source (o) receivers (x) and buffer area (*)

  • o Source position
  • x receiver positions
    • Extra buffer (grid spacing in that simple case)

| . . . . . . . . . . . . . . . . . . . . . |

| . . . . . . . . . . . . . . . . . . . . . |

| . . . . * * * * * * * * * * * * . . . . . |

| . . . . * x x x x x x x x x x * . . . . . |

| . . . . * x x x x x x x x x x * . . . . . |

| . . . . * x x x x x x x x x x * . . . . . |

| . . . . * x x x x x o x x x x * . . . . . |

| . . . . * x x x x x x x x x x * . . . . . |

| . . . . * x x x x x x x x x x * . . . . . |

| . . . . * x x x x x x x x x x * . . . . . |

| . . . . * * * * * * * * * * * * . . . . . |

| . . . . . . . . . . . . . . . . . . . . . |

| . . . . . . . . . . . . . . . . . . . . . |


Parameters

  • srcGeometry: Geometry of the source.
  • recGeometry: Geometry of the receivers.
  • model: Model to be croped.
  • buffer: Size of the buffer on each side.
  • pert: Model perturbation (optional) to be cropped as well.
source

We also provide it's complement that removes receivers outside of the computational domain if the dataset contains locations that are not wanted

JUDI.remove_out_of_bounds_receiversFunction
remove_out_of_bounds_receivers(recGeometry, model)

Removes receivers that are positionned outside the computational domain defined by the model.

Parameters

  • recGeometry: Geometry of receivers in which out of bounds will be removed.
  • model: Model defining the computational domain.
source
remove_out_of_bounds_receivers(recGeometry, recData, model)

Removes receivers that are positionned outside the computational domain defined by the model.

Parameters

  • recGeometry: Geometry of receivers in which out of bounds will be removed.
  • recData: Shot record for that geometry in which traces will be removed.
  • model: Model defining the computational domain.
source

Additional miscellanous utilities

JUDI.devito_modelFunction
devito_model(model, options;dm=nothing)

Creates a python side model strucutre for devito.

Parameters

  • model: JUDI Model structure.
  • options: JUDI Options structure.
  • dm: Squared slowness perturbation (optional), Array or PhysicalParameter.
source
JUDI.setup_gridFunction
setup_grid(geometry, n)

Sets up the coordinate arrays for Devito.

Parameters:

  • geometry: Geometry containing the coordinates
  • n: Domain size
source
JUDI.pad_sizesFunction
pad_sizes(model, options; so=nothing)

Computes ABC padding sizes according to the model's numbr of abc points and spatial order

Parameters

  • model: JUDI or Python side Model.
  • options: JUDI Options structure.
  • so: Space order (optional) defaults to options.space_order.
source
JUDI.pad_arrayFunction
pad_array(m, nb; mode=:border)

Pads to the input array with either copying the edge value (:border) or zeros (:zeros)

Parameters

  • m: Array to be padded.
  • nb: Size of padding. Array of tuple with one (nbleft, nbright) tuple per dimension.
  • mode: Padding mode (optional), defaults to :border.
source
JUDI.remove_paddingFunction
remove_padding(m, nb; true_adjoint=False)

Removes the padding from array m. This is the adjoint of pad_array.

Parameters

  • m: Array to remvove padding from.
  • nb: Size of padding. Array of tuple with one (nbleft, nbright) tuple per dimension.
  • true_adjoint: Unpadding mode, defaults to False. Will sum the padding to the edge point with true_adjoint=true

and should only be used this way for adjoint testing purpose.

source
JUDI.convertToCellFunction
convertToCell(x)

Convert an array x to a cell array (Array{Any,1}) with length(x) entries,
where the i-th cell contains the i-th entry of x.

Parameters

  • x: Array to be converted into and array of array
source
JUDI.process_input_dataFunction
process_input_data(input, geometry, nsrc)

Preprocesses input Array into an Array of Array for modeling

Parameters:

  • input: Input to preprocess.
  • geometry: Geometry containing physical parameters.
  • nsrc: Number of sources
source
process_input_data(input, model, nsrc)

Preprocesses input Array into an Array of Array for modeling

Parameters:

  • input: Input to preprocess.
  • model: Model containing physical parameters.
  • nsrc: Number of sources
source
Base.reshapeFunction
reshape(A, dims...) -> AbstractArray
 reshape(A, dims) -> AbstractArray

Return an array with the same data as A, but with different dimension sizes or number of dimensions. The two arrays share the same underlying data, so that the result is mutable if and only if A is mutable, and setting elements of one alters the values of the other.

The new dimensions may be specified either as a list of arguments or as a shape tuple. At most one dimension may be specified with a :, in which case its length is computed such that its product with all the specified dimensions is equal to the length of the original array A. The total number of elements must not change.

Examples

julia> A = Vector(1:16)
 16-element Vector{Int64}:
   1
@@ -38,4 +38,4 @@
 julia> reshape(1:6, 2, 3)
 2×3 reshape(::UnitRange{Int64}, 2, 3) with eltype Int64:
  1  3  5
- 2  4  6
source
JUDI.transducerFunction
transducer(q, d, r, theta)

Create the JUDI soure for a circular transducer Theta=0 points downward:

. . . . - - - . . . . . .

. . . . + + + . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

Theta=pi/2 points right:

. . . . - + . . . . . . .

. . . . - + . . . . . . .

. . . . - + . . . . . . .

. . . . . . . . . . . . .

2D only, to extend to 3D

source
JUDI.as_vecFunction
as_vec(x, ::Val{Bool})

Vectorizes output when return_array is set to true.

source
+ 2 4 6
source
JUDI.transducerFunction
transducer(q, d, r, theta)

Create the JUDI soure for a circular transducer Theta=0 points downward:

. . . . - - - . . . . . .

. . . . + + + . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

Theta=pi/2 points right:

. . . . - + . . . . . . .

. . . . - + . . . . . . .

. . . . - + . . . . . . .

. . . . . . . . . . . . .

2D only, to extend to 3D

source
JUDI.as_vecFunction
as_vec(x, ::Val{Bool})

Vectorizes output when return_array is set to true.

source
diff --git a/dev/index.html b/dev/index.html index ed4d3449e..8787e46f9 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Home · JUDI documentation

The Julia Devito Inversion framework (JUDI.jl)

JUDI is a framework for large-scale seismic modeling and inversion and designed to enable rapid translations of algorithms to fast and efficient code that scales to industry-size 3D problems. Wave equations in JUDI are solved with Devito, a Python domain-specific language for automated finite-difference (FD) computations.

Docs overview

This documentation provides an overview over JUDI's basic data structures and abstract operators:

  • Installation: Install guidlines for JUDI and compilers.

  • Getting Started: A few simple guided examples to get familiar with JUDI.

  • Data structures: Explains the Model, Geometry and Options data structures and how to set up acquisition geometries.

  • Abstract Vectors: Documents JUDI's abstract vector classes judiVector, judiWavefield, judiRHS, judiWeights and judiExtendedSource.

  • Linear Operators: Lists and explains JUDI's abstract linear operators judiModeling, judiJacobian, judiProjection and judiLRWF.

  • Input/Output: Read SEG-Y data and set up judiVectors for shot records and sources. Read velocity models.

  • Helper functions: API of functions that make your life easier.

  • Seismic Inversion: Inversion utility functions to avoid recomputation and memry overhead.

  • Seismic Preconditioners: Basic preconditioners for seismic imaging.

  • pysource package: API reference for the propagators implementation with Devito in python. The API is the backend of JUDI handled with PyCall.

+Home · JUDI documentation

The Julia Devito Inversion framework (JUDI.jl)

JUDI is a framework for large-scale seismic modeling and inversion and designed to enable rapid translations of algorithms to fast and efficient code that scales to industry-size 3D problems. Wave equations in JUDI are solved with Devito, a Python domain-specific language for automated finite-difference (FD) computations.

Docs overview

This documentation provides an overview over JUDI's basic data structures and abstract operators:

  • Installation: Install guidlines for JUDI and compilers.

  • Getting Started: A few simple guided examples to get familiar with JUDI.

  • Data structures: Explains the Model, Geometry and Options data structures and how to set up acquisition geometries.

  • Abstract Vectors: Documents JUDI's abstract vector classes judiVector, judiWavefield, judiRHS, judiWeights and judiExtendedSource.

  • Linear Operators: Lists and explains JUDI's abstract linear operators judiModeling, judiJacobian, judiProjection and judiLRWF.

  • Input/Output: Read SEG-Y data and set up judiVectors for shot records and sources. Read velocity models.

  • Helper functions: API of functions that make your life easier.

  • Seismic Inversion: Inversion utility functions to avoid recomputation and memry overhead.

  • Seismic Preconditioners: Basic preconditioners for seismic imaging.

  • pysource package: API reference for the propagators implementation with Devito in python. The API is the backend of JUDI handled with PyCall.

diff --git a/dev/installation/index.html b/dev/installation/index.html index 7e7faf7e1..cb86fd08f 100644 --- a/dev/installation/index.html +++ b/dev/installation/index.html @@ -2,4 +2,4 @@ Installation · JUDI documentation

Installation

JUDI is a linear algebra abstraction built on top of Devito. Because Devito is a just-in-time compiler, you will need to have a standard C compiler installed. by default most system come with a gcc compiler (except Windows where we recommend to use docker or WSL) which unfortunately isnt' very reliable. It is therefore recommended to install a proper compiler (gcc>=7, icc). For GPU offloading, you will then need to install a proper offloading compiler such as Nvidia's nvc or the latest version of clang (not Apple clang).

Standard installation

JUDI is registered and can be installed directly in julia REPL

] add JUDI

This will install JUDI, and the build will install the necessary dependencies including Devito.

Custom installation

In some case you may want to have your own installation of Devito you want JUDI to use in which case you should foloow these steps.

You can find installation instruction in our Wiki at Installation.

JUDI is a registered package and can therefore be easily installed from the General registry with ]add/dev JUDI

GPU

JUDI supports the computation of the wave equation on GPU via Devito's GPU offloading support.

NOTE: Only the wave equation part will be computed on GPU, the julia arrays will still be CPU arrays and CUDA.jl is not supported.

Compiler installation

To enable gpu support in JUDI, you will need to install one of Devito's supported offloading compilers. We strongly recommend checking the Wiki for installation steps and to reach out to the Devito community for GPU compiler related issues.

  • [x] nvc/pgcc. This is recommended and the simplest installation. You can install the compiler following Nvidia's installation instruction at HPC-sdk
  • [ ] aompcc. This is the AMD compiler that is necessary for running on AMD GPUs. This installation is not tested with JUDI and we recommend to reach out to Devito's team for installation guidelines.
  • [ ] openmp5/clang. This installation requires the compilation from source openmp, clang and llvm to install the latest version of openmp5 enabling gpu offloading. You can find instructions on this installation in Devito's Wiki

Setup

The only required setup for GPU support are the environment variables for Devito. For the currently supported nvc+openacc setup these are:

export DEVITO_LANGUAGE=openacc
 export DEVITO_ARCH=nvc
 export DEVITO_PLATFORM=nvidiaX

Running with Docker

If you do not want to install JUDI, you can run JUDI as a docker image. The first possibility is to run the docker container as a Jupyter notebook. JUDI provides two docker images for the latest JUDI release for Julia versions 1.6 (LTS) and 1.7 (latest stable version). The images names are mloubout/judi:JVER-latest where JVER is the Julia version. This docker images contain pre-installed compilers for CPUs (gcc-10) and Nvidia GPUs (nvc) via the nvidia HPC sdk. The environment is automatically set for [Devito] based on the hardware available.

Note: If you wish to use your gpu, you will need to install nvidia-docker and run docker run --gpus all in order to make the GPUs available at runtime from within the image.

To run JUDI via docker execute the following command in your terminal:

docker run -p 8888:8888 mloubout/judi:1.7-latest

This command downloads the image and launches a container. You will see a link that you can copy-paste to your browser to access the notebooks. Alternatively, you can run a bash session, in which you can start a regular interactive Julia session and run the example scripts. Download/start the container as a bash session with:

docker run -it mloubout/judi:1.7-latest /bin/bash

Inside the container, all examples are located in the directory /app/judi/examples/scripts.

Previous versions: As of version v2.6.7 of JUDI, we also ship version-tagged images as mloubout/judi:JVER-ver where ver is the version of JUDI wanted, for example the current JUDI version with Julia 1.7 is mloubout/judi:1.7-v2.6.7

Development version: Additionally, we provide two images corresponding to the latest development version of JUDI (latest state of the master branch). These images are called mloubout/judi:JVER-dev and can be used in a similar way.

Testing

A complete test suite is included with JUDI and is tested via GitHub Actions. You can also run the test locally via:

    julia --project -e 'using Pkg;Pkg.test(coverage=false)'

By default, only the JUDI base API will be tested, however the testing suite supports other modes controlled via the environemnt variable GROUP such as:

	GROUP=JUDI julia --project -e 'using Pkg;Pkg.test(coverage=false)'

The supported modes are:

  • JUDI : Only the base API (linear operators, vectors, ...)
  • ISO_OP : Isotropic acoustic operators
  • ISOOPFS : Isotropic acoustic operators with free surface
  • TTI_OP : Transverse tilted isotropic operators
  • TTIOPFS : Transverse tilted isotropic operators with free surface
  • filename : you can also provide just a filename (i.e GROUP=test_judiVector.jl) and only this one test file will be run. Single files with TTI or free surface are not currently supported as it relies on Base.ARGS for the setup.

Configure compiler and OpenMP

Devito uses just-in-time compilation for the underlying wave equation solves. The default compiler is intel, but can be changed to any other specified compiler such as gnu. Either run the following command from the command line or add it to your ~/.bashrc file:

export DEVITO_ARCH=gnu

Devito uses shared memory OpenMP parallelism for solving PDEs. OpenMP is disabled by default, but you can enable OpenMP and define the number of threads (per PDE solve) as follows:

export DEVITO_LANGUAGE=openmp  # Enable OpenMP. 
-export OMP_NUM_THREADS=4    # Number of OpenMP threads
+export OMP_NUM_THREADS=4 # Number of OpenMP threads diff --git a/dev/inversion/index.html b/dev/inversion/index.html index 905eb8c23..f6677abb3 100644 --- a/dev/inversion/index.html +++ b/dev/inversion/index.html @@ -3,7 +3,7 @@ d_syn = F*q r = judiJacobian(F, q)' * (d_syn - d_obs)

In this two lines, the forward modeling is performed twice: once to compute d_syn then once again to compute the Jacobian adjoint. In order to avoid this overhead for practical inversion, we provide utility function that directly comput the gradient and objective function (L2- misfit) of FWI, LSRTM and TWRI with minimum overhead.

FWI

JUDI.fwi_objectiveFunction
fwi_objective(model, source, dobs; options=Options())
 
-Evaluate the full-waveform-inversion (reduced state) objective function. Returns a tuple with function value and vectorized \

gradient. model is a Model structure with the current velocity model and source and dobs are the wavelets and
observed data of type judiVector.

Example

function_value, gradient = fwi_objective(model, source, dobs)
source

Example

JUDI is designed to let you set up objective functions that can be passed to standard packages for (gradient-based) optimization. The following example demonstrates how to perform FWI on the 2D Overthrust model using a spectral projected gradient algorithm from the minConf library, which is included in the software. A small test dataset (62 MB) and the model can be downloaded from this FTP server:

run(`wget ftp://slim.gatech.edu/data/SoftwareRelease/WaveformInversion.jl/2DFWI/overthrust_2D.segy`)
+Evaluate the full-waveform-inversion (reduced state) objective function. Returns a tuple with function value and vectorized \

gradient. model is a Model structure with the current velocity model and source and dobs are the wavelets and
observed data of type judiVector.

Example

function_value, gradient = fwi_objective(model, source, dobs)
source

Example

JUDI is designed to let you set up objective functions that can be passed to standard packages for (gradient-based) optimization. The following example demonstrates how to perform FWI on the 2D Overthrust model using a spectral projected gradient algorithm from the minConf library, which is included in the software. A small test dataset (62 MB) and the model can be downloaded from this FTP server:

run(`wget ftp://slim.gatech.edu/data/SoftwareRelease/WaveformInversion.jl/2DFWI/overthrust_2D.segy`)
 run(`wget ftp://slim.gatech.edu/data/SoftwareRelease/WaveformInversion.jl/2DFWI/overthrust_2D_initial_model.h5`)

The first step is to load the velocity model and the observed data into Julia, as well as setting up bound constraints for the inversion, which prevent too high or low velocities in the final result. Furthermore, we define an 8 Hertz Ricker wavelet as the source function:

using PyPlot, HDF5, SegyIO, JUDI, SlimOptim, Statistics, Random
 
 # Load starting model
@@ -50,7 +50,7 @@
 options = spg_options(verbose=3, maxIter=fevals, memory=3)
 res = spg(objective_function, vec(m0), ProjBound, options)

This example script can be run in parallel and requires roughly 220 MB of memory per source location. Execute the following code to generate figures of the initial model and the result, as well as the function values:

figure(); imshow(sqrt.(1./adjoint(m0))); title("Initial model")
 figure(); imshow(sqrt.(1./adjoint(reshape(x, model0.n)))); title("FWI")
-figure(); plot(fvals); title("Function value")

fwi

LSRTM

JUDI.lsrtm_objectiveFunction
lsrtm_objective(model, source, dobs, dm; options=Options(), nlind=false)

Evaluate the least-square migration objective function. Returns a tuple with function value and
gradient. model is a Model structure with the current velocity model and source and dobs are the wavelets and
observed data of type judiVector.

Example

function_value, gradient = lsrtm_objective(model, source, dobs, dm)
source

Example

JUDI includes matrix-free linear operators for modeling and linearized (Born) modeling, that let you write algorithms for migration that follow the mathematical notation of standard least squares problems. This example demonstrates how to use Julia Devito to perform least-squares reverse-time migration on the 2D Marmousi model. Start by downloading the test data set (1.1 GB) and the model:

run(`wget ftp://slim.gatech.edu/data/SoftwareRelease/Imaging.jl/2DLSRTM/marmousi_2D.segy`)
+figure(); plot(fvals); title("Function value")

fwi

LSRTM

JUDI.lsrtm_objectiveFunction
lsrtm_objective(model, source, dobs, dm; options=Options(), nlind=false)

Evaluate the least-square migration objective function. Returns a tuple with function value and
gradient. model is a Model structure with the current velocity model and source and dobs are the wavelets and
observed data of type judiVector.

Example

function_value, gradient = lsrtm_objective(model, source, dobs, dm)
source

Example

JUDI includes matrix-free linear operators for modeling and linearized (Born) modeling, that let you write algorithms for migration that follow the mathematical notation of standard least squares problems. This example demonstrates how to use Julia Devito to perform least-squares reverse-time migration on the 2D Marmousi model. Start by downloading the test data set (1.1 GB) and the model:

run(`wget ftp://slim.gatech.edu/data/SoftwareRelease/Imaging.jl/2DLSRTM/marmousi_2D.segy`)
 run(`wget ftp://slim.gatech.edu/data/SoftwareRelease/Imaging.jl/2DLSRTM/marmousi_migration_velocity.h5`)

Once again, load the starting model and the data and set up the source wavelet. For this example, we use a Ricker wavelet with 30 Hertz peak frequency.

using PyPlot, HDF5, JUDI, SegyIO, Random
 
 # Load smooth migration velocity model
@@ -98,13 +98,13 @@
 	fval[j] = .5f0*norm(r)^2
 	t = norm(r)^2/norm(g)^2
 	global x -= t*g
-end

lsrtm

TWRI

JUDI.twri_objectiveFunction
twri_objective(model, source, dobs; options=Options(), optionswri=TWRIOptions())

Evaluate the time domain Wavefield reconstruction inversion objective function. Returns a tuple with function value and gradient(s) w.r.t to m and/or y. model is a Model structure with the current velocity model and source and dobs are the wavelets and observed data of type judiVector.

Example

function_value, gradient_m, gradient_y = twri_objective(model, source, dobs; options=Options(), optionswri=TWRIOptions())
source
twri_objective(model, source, dobs; options=Options(), optionswri=TWRIOptions())

Evaluate the time domain Wavefield reconstruction inversion objective function. Returns a tuple with function value and
gradient(s) w.r.t to m and/or y. model is a Model structure with the current velocity model and source and dobs are the wavelets and
observed data of type judiVector. Example ======= functionvalue, gradient = fwiobjective(model, source, dobs)

source

and related TWRI options

JUDI.TWRIOptionsType
TWRIOptions
+end

lsrtm

TWRI

JUDI.twri_objectiveFunction
twri_objective(model, source, dobs; options=Options(), optionswri=TWRIOptions())

Evaluate the time domain Wavefield reconstruction inversion objective function. Returns a tuple with function value and gradient(s) w.r.t to m and/or y. model is a Model structure with the current velocity model and source and dobs are the wavelets and observed data of type judiVector.

Example

function_value, gradient_m, gradient_y = twri_objective(model, source, dobs; options=Options(), optionswri=TWRIOptions())
source
twri_objective(model, source, dobs; options=Options(), optionswri=TWRIOptions())

Evaluate the time domain Wavefield reconstruction inversion objective function. Returns a tuple with function value and
gradient(s) w.r.t to m and/or y. model is a Model structure with the current velocity model and source and dobs are the wavelets and
observed data of type judiVector. Example ======= functionvalue, gradient = fwiobjective(model, source, dobs)

source

and related TWRI options

JUDI.TWRIOptionsType
TWRIOptions
     grad_corr::Bool
     comp_alpha::Bool
     weight_fun
     eps
     params::Symbol
-    Invq::String

Options structure for TWRI.

grad_corr: Whether to add the gradient correction J'(m0, q)*∇_y

comp_alpha: Whether to compute optimal alpha (alpha=1 if not)

weight_fun: Whether to apply focusing/weighting function to F(m0)'*y and its norm

eps: Epsilon (noise level) value (default=0)

Invq: How to compute F'Y, either as full field or as a rank 1 approximation w(t)*q(x) using the source wavelet for w

param: Which gradient to compute. Choices are nothing (objective only), :m, :y or :all

Constructor

All arguments are optional keyword arguments with the following default values:

TWRIOptions(;gradcorr=false, compalpha=true, weight_fun=nothing, eps=0, params=:m)

source

Machine Learning

ChainRules.jl allows integrating JUDI modeling operators into convolutional neural networks for deep learning. For example, the following code snippet shows how to create a shallow CNN consisting of two convolutional layers with a nonlinear forward modeling layer in-between them. The integration of ChainRules and JUDI enables backpropagation through Flux' automatic differentiation tool, but calls the corresponding adjoint JUDI operators under the hood. For more details, please check out this tutorial.

# Jacobian
+    Invq::String

Options structure for TWRI.

grad_corr: Whether to add the gradient correction J'(m0, q)*∇_y

comp_alpha: Whether to compute optimal alpha (alpha=1 if not)

weight_fun: Whether to apply focusing/weighting function to F(m0)'*y and its norm

eps: Epsilon (noise level) value (default=0)

Invq: How to compute F'Y, either as full field or as a rank 1 approximation w(t)*q(x) using the source wavelet for w

param: Which gradient to compute. Choices are nothing (objective only), :m, :y or :all

Constructor

All arguments are optional keyword arguments with the following default values:

TWRIOptions(;gradcorr=false, compalpha=true, weight_fun=nothing, eps=0, params=:m)

source

Machine Learning

ChainRules.jl allows integrating JUDI modeling operators into convolutional neural networks for deep learning. For example, the following code snippet shows how to create a shallow CNN consisting of two convolutional layers with a nonlinear forward modeling layer in-between them. The integration of ChainRules and JUDI enables backpropagation through Flux' automatic differentiation tool, but calls the corresponding adjoint JUDI operators under the hood. For more details, please check out this tutorial.

# Jacobian
 W1 = judiJacobian(F0, q)
 b1 = randn(Float32, num_samples)
 
@@ -119,4 +119,4 @@
 # Compute gradient w/ Flux
 p = params(x, y, W1, b1, b2)
 gs = Tracker.gradient(() -> loss(x, y), p)
-gs[x]	# gradient w.r.t. to x

Integration with ChainRules allows implementing physics-augmented neural networks for seismic inversion, such as loop-unrolled seismic imaging algorithms. For example, the following results are a conventional RTM image, an LS-RTM image and a loop-unrolled LS-RTM image for a single simultaneous shot record.

flux

+gs[x] # gradient w.r.t. to x

Integration with ChainRules allows implementing physics-augmented neural networks for seismic inversion, such as loop-unrolled seismic imaging algorithms. For example, the following results are a conventional RTM image, an LS-RTM image and a loop-unrolled LS-RTM image for a single simultaneous shot record.

flux

diff --git a/dev/io/index.html b/dev/io/index.html index ff9e0a3a6..847fefae8 100644 --- a/dev/io/index.html +++ b/dev/io/index.html @@ -29,4 +29,4 @@ m = M["m"] # Set up a Model object -model = Model(n, d, o, m) +model = Model(n, d, o, m) diff --git a/dev/linear_operators/index.html b/dev/linear_operators/index.html index da888f04f..6db04fb59 100644 --- a/dev/linear_operators/index.html +++ b/dev/linear_operators/index.html @@ -1,6 +1,6 @@ Linear Operators · JUDI documentation

Linear Operators

JUDI is building on JOLI.jl to implement matrix-free linear operators. These operators represent the discretized wave-equations and sensitivit (Jacobian) for different acquisition schemes.

judiModeling

Seismic modeling operator for solving a wave equation for a given right-hand-side.

JUDI.judiModelingType
judiModeling(model; options=Options())
-judiModeling(model, src_geometry, rec_geometry; options=Options())

Create seismic modeling operator for a velocity model given as a Model structure. The function also takes the source and receiver geometries as additional input arguments, which creates a combined operator judiProjection*judiModeling*judiProjection'.

Example

Pr and Ps are projection operatos of type judiProjection and q is a data vector of type judiVector: F = judiModeling(model) dobs = PrFPs'q F = judiModeling(model, q.geometry, rec_geometry) dobs = Fq

source

Construction:

  • Construct a modeling operator without source/receiver projections:
F = judiModeling(model; options=opt)
  • Construct a modeling operator with source/receiver projections:
F = judiModeling(model, src_geometry, rec_geometry)
  • Construct a modeling operator from an existing operator without geometries and projection operators:
F = Pr*F*Ps'

where Ps and Pr are source/receiver projection operators of type judiProjection.

  • Construct a modeling operator for extended source modeling:
F = Pr*F*Pw'

where Pw is a judiLRWF (low-rank-wavefield) projection operator.

Accessible fields:

# Model structure
+judiModeling(model, src_geometry, rec_geometry; options=Options())

Create seismic modeling operator for a velocity model given as a Model structure. The function also takes the source and receiver geometries as additional input arguments, which creates a combined operator judiProjection*judiModeling*judiProjection'.

Example

Pr and Ps are projection operatos of type judiProjection and q is a data vector of type judiVector: F = judiModeling(model) dobs = PrFPs'q F = judiModeling(model, q.geometry, rec_geometry) dobs = Fq

source

Construction:

F = judiModeling(model; options=opt)
F = judiModeling(model, src_geometry, rec_geometry)
F = Pr*F*Ps'

where Ps and Pr are source/receiver projection operators of type judiProjection.

F = Pr*F*Pw'

where Pw is a judiLRWF (low-rank-wavefield) projection operator.

Accessible fields:

# Model structure
 F.model
 
 # Source injection (if available) and geometry
@@ -40,7 +40,7 @@
 d_obs = Pr*F*u
 
 # Adjoint modeling with full wavefield as source (F w/o geometries)
-q_ad = Ps*F*v

judiJacobian

Jacobian of a non-linear forward modeling operator. Corresponds to linearized Born modeling (forward mode) and reverse-time migration (adjoint mode).

JUDI.judiJacobianType
judiJacobian(F,q)

Create a linearized modeling operator from the non-linear modeling operator F and the source q. q can be either a judiVector (point source Jacobian) or a judiWeight for extended source modeling. F is a full modeling operator including source/receiver projections.

Examples

  1. F is a modeling operator without source/receiver projections: J = judiJacobian(PrFPs',q)
  2. F is the combined operator Pr*F*Ps': J = judiJacobian(F,q)
source

Construction:

J = judiJacobian(F, q)  # F w/ geometries
J = judiJacobian(Pr*F*Ps', q)   # F w/o geometries

where Ps and Pr are source/receiver projection operators of type judiProjection.

J = judiJacobian(Pr*F*Pw', w)

where Pw is a judiLRWF operator and w is a judiWeights vector (or 2D/3D Julia array).

Accessible fields::

# Model structure
+q_ad = Ps*F*v

judiJacobian

Jacobian of a non-linear forward modeling operator. Corresponds to linearized Born modeling (forward mode) and reverse-time migration (adjoint mode).

JUDI.judiJacobianType
judiJacobian(F,q)

Create a linearized modeling operator from the non-linear modeling operator F and the source q. q can be either a judiVector (point source Jacobian) or a judiWeight for extended source modeling. F is a full modeling operator including source/receiver projections.

Examples

  1. F is a modeling operator without source/receiver projections: J = judiJacobian(PrFPs',q)
  2. F is the combined operator Pr*F*Ps': J = judiJacobian(F,q)
source

Construction:

J = judiJacobian(F, q)  # F w/ geometries
J = judiJacobian(Pr*F*Ps', q)   # F w/o geometries

where Ps and Pr are source/receiver projection operators of type judiProjection.

J = judiJacobian(Pr*F*Pw', w)

where Pw is a judiLRWF operator and w is a judiWeights vector (or 2D/3D Julia array).

Accessible fields::

# Model structure
 J.model
 
 # Underlying propagator
@@ -65,16 +65,16 @@
 rtm = J'*d_lin
 
 # Matrix-free normal operator
-H = J'*J

judiProjection

Abstract linear operator for source/receiver projections. A (transposed) judiProjection operator symbolically injects the data with which it is multiplied during modeling. If multiplied with a forward modeling operator, it samples the wavefield at the specified source/receiver locations.

JUDI.judiProjectionType
judiProjection(geometry)

Projection operator for sources/receivers to restrict or inject data at specified locations.

Examples

F is a modeling operator of type judiModeling and q is a seismic source of type judiVector: Pr = judiProjection(rec_geometry) Ps = judiProjection(q.geometry) dobs = PrFPs'q qad = PsF'Pr'dobs

source

Accessible fields:

# Source/receiver geometry
+H = J'*J

judiProjection

Abstract linear operator for source/receiver projections. A (transposed) judiProjection operator symbolically injects the data with which it is multiplied during modeling. If multiplied with a forward modeling operator, it samples the wavefield at the specified source/receiver locations.

JUDI.judiProjectionType
judiProjection(geometry)

Projection operator for sources/receivers to restrict or inject data at specified locations.

Examples

F is a modeling operator of type judiModeling and q is a seismic source of type judiVector: Pr = judiProjection(rec_geometry) Ps = judiProjection(q.geometry) dobs = PrFPs'q qad = PsF'Pr'dobs

source

Accessible fields:

# Source/receiver geometry
 P.geometry

Usage:

# Multiply with judiVector to create a judiRHS
 rhs1 = Pr'*d_obs
 rhs2 = Ps'*q
 
 # Sample wavefield at source/receiver location during modeling
 d_obs = Pr*F*Ps'*q
-q_ad = Ps*F*Pr'*d_obs

judiLRWF

Abstract linear operator for sampling a seismic wavefield as a sum over all time steps, weighted by a time-varying wavelet. Its transpose injects a time-varying wavelet at every grid point in the model.

JUDI.judiWaveletType
judiWavelet(dt, wavelet)

Low-rank wavefield operator which injects a wavelet q at every point of the subsurface.

Examples

F is a modeling operator of type judiModeling and w is a weighting matrix of type judiWeights: Pr = judiProjection(recgeometry) Pw = judiWavelet(recgeometry.dt, q.data) # or judiLRWF(rec_geometry.dt, q.data) dobs = PrFPw'w dw = PwF'Pr'dobs

source

Accessible fields:

# Wavelet of i-th source location
+q_ad = Ps*F*Pr'*d_obs

judiLRWF

Abstract linear operator for sampling a seismic wavefield as a sum over all time steps, weighted by a time-varying wavelet. Its transpose injects a time-varying wavelet at every grid point in the model.

JUDI.judiWaveletType
judiWavelet(dt, wavelet)

Low-rank wavefield operator which injects a wavelet q at every point of the subsurface.

Examples

F is a modeling operator of type judiModeling and w is a weighting matrix of type judiWeights: Pr = judiProjection(recgeometry) Pw = judiWavelet(recgeometry.dt, q.data) # or judiLRWF(rec_geometry.dt, q.data) dobs = PrFPw'w dw = PwF'Pr'dobs

source

Accessible fields:

# Wavelet of i-th source location
 P.wavelet[i]

Usage:

# Multiply with a judiWeight vector to create a judiExtendedSource
 ex_src = Pw'*w
 
 # Sample wavefield as a sum over time, weighted by the source
-u_ex = Pw*F'*Pr'*d_obs
+u_ex = Pw*F'*Pr'*d_obs diff --git a/dev/preconditioners/index.html b/dev/preconditioners/index.html index e700cf3a7..29f51d97d 100644 --- a/dev/preconditioners/index.html +++ b/dev/preconditioners/index.html @@ -1,14 +1,14 @@ Preconditioners · JUDI documentation

Seismic Preconditioners

JUDI provides a selected number of preconditioners known to be beneficial to FWI and RTM. We welcome additional preconditionners from the community. Additionnaly, any JOLI operator can be used as a preconditiner in conbination with JUDI operator thanks to the fundamental interface between JUDI and JOLI.

Model domain preconditioners

Model space preconditioners acts on model size arrays such as the velocity model or the FWI/RTM gradient. These preconditioners are indepenedent of the number of sources and therefore should not be indexed.

Water column muting (top mute)

Create a linear operator for a 2D model topmute, i.e. for muting the water column:

JUDI.TopMuteType
TopMute{T, N, Nw}

Mute top of the model in N dimensions

Constructor

judiTopmute(model; taperwidht=10)
-judiTopmute(n, wb, taperwidth)   # Legacy
source

Usage:

# Forward
+judiTopmute(n, wb, taperwidth)   # Legacy
source

Usage:

# Forward
 m_mute = Mr*vec(m)
 
 # Adjoint
-m_mute = Mr'*vec(m)

As Mr is self adjoint, Mr is equal to Mr'.

legacy:

The legacy constructor judiTopmute(n, wb, taperwidth) is still available to construct a muting operator with user specified muting depth.

Model depth scaling

Create a 2D model depth scaling. This preconditionenr is the most simple form of inverse Hessain approximation compensating for illumination in the subsurface. We also describe below a more accurate diagonal approximation of the Hessian with the illlumination operator. Additionnaly, as a simple diagonal approximation, this operator is invertible and can be inverted with the standard julia inv function.

JUDI.DepthScalingType
DepthScaling{T, N, K}

Depth scaling operator in N dimensions scaling by depth^K.

Constructor

judiDepthScaling(model::AbstractModel; K=.5)
source

Usage:

# Forward
+m_mute = Mr'*vec(m)

As Mr is self adjoint, Mr is equal to Mr'.

legacy:

The legacy constructor judiTopmute(n, wb, taperwidth) is still available to construct a muting operator with user specified muting depth.

Model depth scaling

Create a 2D model depth scaling. This preconditionenr is the most simple form of inverse Hessain approximation compensating for illumination in the subsurface. We also describe below a more accurate diagonal approximation of the Hessian with the illlumination operator. Additionnaly, as a simple diagonal approximation, this operator is invertible and can be inverted with the standard julia inv function.

JUDI.DepthScalingType
DepthScaling{T, N, K}

Depth scaling operator in N dimensions scaling by depth^K.

Constructor

judiDepthScaling(model::AbstractModel; K=.5)
source

Usage:

# Forward
 m_mute = Mr*vec(m)
 
 # Adjoint
-m_mute = Mr'*vec(m)

Illumination

The illumination computed the energy of the wavefield along time for each grid point. This provides a first order diagonal approximation of the Hessian of FWI/LSRTM helping the ocnvergence and quality of an update.

JUDI.judiIlluminationType
judiIllumination(model; mode="u", k=1, recompute=true)

Arguments

  • model: JUDI Model structure

  • mode: Type of ilumination, choicees of ("u", "v", "uv")

  • k: Power of the illumination, real number

  • recompute: Flag whether to recompute the illumination at each new propagation (Defaults to true)

    judiIllumination(F; mode="u", k=1, recompute=true)

Arguments

  • F: JUDI propagator
  • mode: Type of ilumination, choicees of ("u", "v", "uv")
  • k: Power of the illumination, real positive number
  • recompute: Flag whether to recompute the illumination at each new propagation (Defaults to true)

Diagonal approximation of the FWI Hessian as the energy of the wavefield. The diagonal contains the sum over time of the wavefield chosen as mode.

Options for the mode are "u" for the forward wavefield illumination, "v" for the adjoint wavefield illumination, and "uv" for the pointwise product of the forward and adjoint wavefields illuminations. Additionally, the parameter "k" provides control on the scaling of the daiagonal raising it to the power k.

Example

I = judiIllumination(model)

Construct the diagonal operator such that I*x = x ./ |||u||_2^2

source

Usage:

# Forward
+m_mute = Mr'*vec(m)

Illumination

The illumination computed the energy of the wavefield along time for each grid point. This provides a first order diagonal approximation of the Hessian of FWI/LSRTM helping the ocnvergence and quality of an update.

JUDI.judiIlluminationType
judiIllumination(model; mode="u", k=1, recompute=true)

Arguments

  • model: JUDI Model structure

  • mode: Type of ilumination, choicees of ("u", "v", "uv")

  • k: Power of the illumination, real number

  • recompute: Flag whether to recompute the illumination at each new propagation (Defaults to true)

    judiIllumination(F; mode="u", k=1, recompute=true)

Arguments

  • F: JUDI propagator
  • mode: Type of ilumination, choicees of ("u", "v", "uv")
  • k: Power of the illumination, real positive number
  • recompute: Flag whether to recompute the illumination at each new propagation (Defaults to true)

Diagonal approximation of the FWI Hessian as the energy of the wavefield. The diagonal contains the sum over time of the wavefield chosen as mode.

Options for the mode are "u" for the forward wavefield illumination, "v" for the adjoint wavefield illumination, and "uv" for the pointwise product of the forward and adjoint wavefields illuminations. Additionally, the parameter "k" provides control on the scaling of the daiagonal raising it to the power k.

Example

I = judiIllumination(model)

Construct the diagonal operator such that I*x = x ./ |||u||_2^2

source

Usage:

# Forward
 m_mute = I*vec(m)
 
 # Adjoint
@@ -18,11 +18,11 @@
     vp::Vector{T}
     t0::Vector{T}
     taperwidth::Vector{Int64}
-end

Data mute linear operator a where {T, N}sociated with source srcGeom and receiver recGeom geometries used to compute the distance to the source for each trace in the data. Data mute preconditionner. Supports two modes (:reflection, :turning) that mute either the turning waves (standard direct wave mute) or mutes the reflections. A cosine tapr is applied with width taperwidth to avoid abrupt change and infinite frequency jumps in the data.

Constructors

judiDataMute(srcGeom, recGeom; vp=1500, t0=.1, mode=:reflection, taperwidth=floor(Int, 2/t0))

Construct the data mute operator from the source srcGeom and receiver recGeom geometries.

judiDataMute(q, d; vp=1500, t0=.1, mode=:reflection, taperwidth=floor(Int, 2/t0))

Construct the data mute operator from the judivector source q and judivector data d.

Parameters

The following optional paramet where {T, N}rs control the muting operator

source

Band pass filter

While not purely a preconditioner, because this operator acts on the data and is traditionally used fro frequency continuation in FWI, we implemented this operator as a source indexable linear operator as well. Additionally, the filtering function is available as a standalone julia function for general usage

JUDI.FrequencyFilterType
struct FrequencyFilter
+end

Data mute linear operator a where {T, N}sociated with source srcGeom and receiver recGeom geometries used to compute the distance to the source for each trace in the data. Data mute preconditionner. Supports two modes (:reflection, :turning) that mute either the turning waves (standard direct wave mute) or mutes the reflections. A cosine tapr is applied with width taperwidth to avoid abrupt change and infinite frequency jumps in the data.

Constructors

judiDataMute(srcGeom, recGeom; vp=1500, t0=.1, mode=:reflection, taperwidth=floor(Int, 2/t0))

Construct the data mute operator from the source srcGeom and receiver recGeom geometries.

judiDataMute(q, d; vp=1500, t0=.1, mode=:reflection, taperwidth=floor(Int, 2/t0))

Construct the data mute operator from the judivector source q and judivector data d.

Parameters

The following optional paramet where {T, N}rs control the muting operator

  • vp: P wave velocity of the direct wave (usually water velocity). Can be a constant or a Vector with one value per source position. Devfaults to 1500m/s
  • t0: Time shift in seconds (usually width of the wavelet). Defaults to $.1 sec$
  • mode: :reflection to keep the reflections and mute above the direct wave (i.e for RTM) :turning to keep the turning waves and mute below the direct wave (i.e for FWI)
  • taperwidth: Width of the cosine taper in number of samples. Defaults to 2 / t0
source

Band pass filter

While not purely a preconditioner, because this operator acts on the data and is traditionally used fro frequency continuation in FWI, we implemented this operator as a source indexable linear operator as well. Additionally, the filtering function is available as a standalone julia function for general usage

JUDI.FrequencyFilterType
struct FrequencyFilter
     recGeom

Bandpass filter linear operator. Filters the input judiVector or Vector

Constructor

judiFilter(geometry, fmin, fmax) 
-judiFilter(judiVector, fmin, fmax)
source
JUDI.filter_dataFunction
filter(Din, dt_in; fmin=0, fmax=25)

Performs a causal filtering [fmin, fmax] on the input data bases on its sampling rate dt. Automatically perfroms a lowpass if fmin=0 (default)

source

Data time derivative/intergraton

A TimeDifferential{K} is a linear operator that implements a time derivative (K>0) or time integration (K<0) of order K for any real K including fractional values.

JUDI.TimeDifferentialType
struct TimeDifferential
+judiFilter(judiVector, fmin, fmax)
source
JUDI.filter_dataFunction
filter(Din, dt_in; fmin=0, fmax=25)

Performs a causal filtering [fmin, fmax] on the input data bases on its sampling rate dt. Automatically perfroms a lowpass if fmin=0 (default)

source

Data time derivative/intergraton

A TimeDifferential{K} is a linear operator that implements a time derivative (K>0) or time integration (K<0) of order K for any real K including fractional values.

JUDI.TimeDifferentialType
struct TimeDifferential
     recGeom

Differential operator of order K to be applied along the time dimension. Applies the ilter w^k where k is the order. For example, the tinme derivative is TimeDifferential{1} and the time integration is TimeDifferential{-1}

Constructor

judiTimeIntegration(recGeom, order)
 judiTimeIntegration(judiVector, order)
 
 judiTimeDerivative(recGeom, order)
-judiTimeDerivative(judiVector, order)
source
+judiTimeDerivative(judiVector, order)source diff --git a/dev/pysource/index.html b/dev/pysource/index.html index 2810b8538..c1482b8cd 100644 --- a/dev/pysource/index.html +++ b/dev/pysource/index.html @@ -1,2 +1,2 @@ -Devito backend reference · JUDI documentation

pysource package

Submodules

FD_utils module

FDutils.Rmat(model)

Rotation matrix according to tilt and asymut.

  • Parameters: model (Model) – Model structure

FDutils.divs(func, sofact=1, side=-1)

GrDivergenceadient shifted by half a grid point, only to be used in combination with grads.

FDutils.grads(func, sofact=1, side=1)

Gradient shifted by half a grid point, only to be used in combination with divs.

FD_utils.laplacian(v, irho)

Laplacian with density div( 1/rho grad) (u)

FDutils.satti(u, v, model)

Tensor factorized SSA TTI wave equation spatial derivatives.

  • Parameters:
    • u (TimeFunction) – first TTI field
    • v (TimeFunction) – second TTI field
    • model (Model) – Model structure

FDutils.thomsenmat(model)

Diagonal Matrices with Thomsen parameters for vectorial temporaries computation.

  • Parameters: model (Model) – Model structure

checkpoint module

class checkpoint.CheckpointOperator(op, **kwargs)

Devito’s concrete implementation of the ABC pyrevolve.Operator. This class wraps devito.Operator so it conforms to the pyRevolve API. pyRevolve will call apply with arguments tstart and tend. Devito calls these arguments ts and te so the following dict is used to perform the translations between different names.

  • Parameters:
    • op (Operator) – devito.Operator object that this object will wrap.
    • args (dict) – If devito.Operator.apply() expects any arguments, they can be provided here to be cached. Any calls to CheckpointOperator.apply() will automatically include these cached arguments in the call to the underlying devito.Operator.apply().

apply(tstart, tend)

If the devito operator requires some extra arguments in the call to apply they can be stored in the args property of this object so pyRevolve calls pyRevolve.Operator.apply() without caring about these extra arguments while this method passes them on correctly to devito.Operator

targnames = {'tend': 'timeM', 'tstart': 'timem'}

class checkpoint.DevitoCheckpoint(objects)

Devito’s concrete implementation of the Checkpoint abstract base class provided by pyRevolve. Holds a list of symbol objects that hold data.

property dtype

data type

get_data(timestep)

returns the data (wavefield) for the time-step timestep

getdatalocation(timestep)

returns the data (wavefield) for the time-step timestep

load()

NotImplementedError

save()

NotImplementedError

property size

The memory consumption of the data contained in a checkpoint.

checkpoint.getsymboldata(symbol, timestep)

Return the symbol corresponding to the data at time-step timestep

geom_utils module

geomutils.geomexpr(model, u, srccoords=None, reccoords=None, wavelet=None, fw=True, nt=None)

Generates the source injection and receiver interpolation. This function is fully abstracted and does not care whether this is a forward or adjoint wave-equation. The source is the source term of the equation The receiver is the measurment term

Therefore, for the adjoint, this function has to be called as: srcrec(model, v, srccoords=rec_coords, …) because the data is the sources

  • Parameters:
    • model (Model) – Physical model
    • u (TimeFunction or tuple) – Wavefield to inject into and read from
    • src_coords (Array) – Physical coordinates of the sources
    • rec_coords (Array) – Physical coordinates of the receivers
    • wavelet (Array) – Data for the source
    • fw=True – Whether the direction is forward or backward in time
    • nt (int) – Number of time steps

geomutils.srcrec(model, u, srccoords=None, reccoords=None, wavelet=None, nt=None)

interface module

interface.Jadjoint(model, srccoords, wavelet, reccoords, recin, spaceorder=8, isresidual=False, checkpointing=False, ncheckpoints=None, tsub=1, returnobj=False, freqlist=[], dftsub=None, ic='as', illum=False, ws=None, f0=0.015, born_fwd=False, nlind=False, misfit=None, fw=True)

Jacobian (adjoint fo born modeling operator) operator on a shot record as a source (i.e data residual). Supports three modes: * Checkpinting * Frequency compression (on-the-fly DFT) * Standard zero lag cross correlation over time

  • Parameters:
    • model (Model) – Physical model
    • src_coords (Array) – Coordiantes of the source(s)
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • recin (Array) – Receiver data
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • checkpointing (Bool) – Whether or not to use checkpointing
    • n_checkpoints (Int) – Number of checkpoints for checkpointing
    • maxmem (Float) – Maximum memory to use for checkpointing
    • freq_list (List) – List of frequencies for on-the-fly DFT
    • dft_sub (Int) – Subsampling factor for on-the-fly DFT
    • ic (String) – Imaging conditions (“as”, “isic” or “fwi”), defaults to “as”
    • ws (Array) – Extended source spatial distribution
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation as base propagator
  • Returns: Adjoint jacobian on the input data (gradient)
  • Return type: Array

interface.Jadjointcheckpointing(model, srccoords, wavelet, reccoords, recin, spaceorder=8, isresidual=False, ncheckpoints=None, bornfwd=False, return_obj=False, ic='as', ws=None, nlind=False, f0=0.015, misfit=None, illum=False, fw=True)

Jacobian (adjoint fo born modeling operator) operator on a shot record as a source (i.e data residual). Outputs the gradient with Checkpointing.

  • Parameters:
    • model (Model) – Physical model
    • src_coords (Array) – Coordiantes of the source(s)
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • recin (Array) – Receiver data
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • checkpointing (Bool) – Whether or not to use checkpointing
    • n_checkpoints (Int) – Number of checkpoints for checkpointing
    • maxmem (Float) – Maximum memory to use for checkpointing
    • ic (String) – Imaging conditions (“as”, “isic” or “fwi”), defaults to “as”
    • ws (Array) – Extended source spatial distribution
    • is_residual (Bool) – Whether to treat the input as the residual or as the observed data
    • born_fwd (Bool) – Whether to use the forward or linearized forward modeling operator
    • nlind (Bool) – Whether to remove the non linear data from the input data. This option is only available in combination with born_fwd
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation as base propagator
  • Returns: Adjoint jacobian on the input data (gradient)
  • Return type: Array

interface.Jadjointfreq(model, srccoords, wavelet, reccoords, recin, spaceorder=8, freqlist=[], isresidual=False, returnobj=False, nlind=False, dftsub=None, ic='as', ws=None, bornfwd=False, f0=0.015, misfit=None, illum=False, fw=True)

Jacobian (adjoint fo born modeling operator) operator on a shot record as a source (i.e data residual). Outputs the gradient with Frequency compression (on-the-fly DFT).

  • Parameters:
    • model (Model) – Physical model
    • src_coords (Array) – Coordiantes of the source(s)
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • recin (Array) – Receiver data
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • freq_list (List) – List of frequencies for on-the-fly DFT
    • dft_sub (Int) – Subsampling factor for on-the-fly DFT
    • ic (String) – Imaging conditions (“as”, “isic” or “fwi”), defaults to “as”
    • ws (Array) – Extended source spatial distribution
    • is_residual (Bool) – Whether to treat the input as the residual or as the observed data
    • born_fwd (Bool) – Whether to use the forward or linearized forward modeling operator
    • nlind (Bool) – Whether to remove the non linear data from the input data. This option is only available in combination with born_fwd
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation as base propagator
  • Returns: Adjoint jacobian on the input data (gradient)
  • Return type: Array

interface.Jadjointstandard(model, srccoords, wavelet, reccoords, recin, spaceorder=8, isresidual=False, returnobj=False, bornfwd=False, illum=False, ic='as', ws=None, t_sub=1, nlind=False, f0=0.015, misfit=None, fw=True)

Adjoint Jacobian (adjoint fo born modeling operator) operator on a shot record as a source (i.e data residual). Outputs the gradient with standard zero lag cross correlation over time.

  • Parameters:
    • model (Model) – Physical model
    • src_coords (Array) – Coordiantes of the source(s)
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • recin (Array) – Receiver data
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • ic (String) – Imaging conditions (“as”, “isic” or “fwi”), defaults to “as”
    • ws (Array) – Extended source spatial distribution
    • is_residual (Bool) – Whether to treat the input as the residual or as the observed data
    • born_fwd (Bool) – Whether to use the forward or linearized forward modeling operator
    • nlind (Bool) – Whether to remove the non linear data from the input data. This option is only available in combination with born_fwd
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation as base propagator
  • Returns: Adjoint jacobian on the input data (gradient)
  • Return type: Array

interface.adjointw(model, reccoords, data, wavelet, space_order=8, f0=0.015, illum=False, fw=True)

Adjoint/backward modeling of a shot record (receivers as source) for an extended source setup Pw*F^T*Pr^T*d_obs.

  • Parameters:
    • model (Model) – Physical model
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • data (Array) – Shot gather
    • wavelet (Array) – Time signature of the forward source for stacking along time
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: spatial distribution
  • Return type: Array

interface.bornrec(model, srccoords, wavelet, reccoords, spaceorder=8, ic='as', f0=0.015, illum=False, fw=True)

Linearized (Born) modeling of a point source for a model perturbation (square slowness) dm.

  • Parameters:
    • model (Model) – Physical model
    • src_coords (Array) – Coordiantes of the source(s)
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • ic (String) – Imaging conditions (“as”, “isic” or “fwi”), defaults to “as”
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: Shot record
  • Return type: Array

interface.bornrecw(model, weight, wavelet, reccoords, spaceorder=8, ic='as', f0=0.015, illum=False, fw=True)

Linearized (Born) modeling of an extended source for a model perturbation (square slowness) dm with an extended source

  • Parameters:
    • model (Model) – Physical model
    • weight (Array) – Spatial distriubtion of the extended source
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • ic (String) – Imaging conditions (“as”, “isic” or “fwi”), defaults to “as”
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: Shot record
  • Return type: Array

interface.forwardnorec(model, srccoords, wavelet, spaceorder=8, f0=0.015, illum=False, fw=True)

Forward modeling of a point source without receiver.

  • Parameters:
    • model (Model) – Physical model
    • src_coords (Array) – Coordiantes of the source(s)
    • wavelet (Array) – Source signature
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: Wavefield
  • Return type: Array

interface.forwardrec(model, srccoords, wavelet, reccoords, spaceorder=8, f0=0.015, illum=False, fw=True)

Modeling of a point source with receivers Pr*F*Ps^T*q.

  • Parameters:
    • model (Model) – Physical model
    • src_coords (Array) – Coordiantes of the source(s)
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: Shot record
  • Return type: Array

interface.forwardrecw(model, weight, wavelet, reccoords, spaceorder=8, f0=0.015, illum=False, fw=True)

Forward modeling of an extended source with receivers Pr*F*Pw^T*w

  • Parameters:
    • model (Model) – Physical model
    • weights (Array) – Spatial distribution of the extended source.
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: Shot record
  • Return type: Array

interface.forwardwfsrc(model, u, reccoords, spaceorder=8, f0=0.015, illum=False, fw=True)

Forward modeling of a full wavefield source Pr*F*u.

  • Parameters:
    • model (Model) – Physical model
    • u (TimeFunction or Array) – Time-space dependent wavefield
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: Shot record
  • Return type: Array

interface.forwardwfsrcnorec(model, u, spaceorder=8, f0=0.015, illum=False, fw=True)

Forward modeling of a full wavefield source without receiver F*u.

  • Parameters:
    • model (Model) – Physical model
    • u (TimeFunction or Array) – Time-space dependent wavefield
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: Wavefield
  • Return type: Array

interface.wrifunc(model, srccoords, wavelet, reccoords, recin, yin, spaceorder=8, ic='as', ws=None, tsub=1, grad='m', gradcorr=False, alphaop=False, wfun=None, eps=0, freq_list=[], wfilt=None, f0=0.015)

Time domain wavefield reconstruction inversion wrapper

kernels module

kernels.SLS2ndorder(model, p, fw=True, q=None, f0=0.015)

Viscoacoustic 2nd SLS wave equation. https://library.seg.org/doi/10.1190/geo2013-0030.1

Bulk modulus moved to rhs. The adjoint equation is directly derived as the discrete adjoint of the forward PDE which leads to a slightly different formulation than in the paper.

  • Parameters:
    • model (Model) – Physical model
    • u1 (TimeFunction) – Pressure field
    • u2 (TimeFunction) – Attenuation Memory variable
    • fw (Bool) – Whether forward or backward in time propagation
    • q (TimeFunction or Expr) – Full time-space source as a tuple (one value for each component)
    • f0 (Peak frequency) –

kernels.acoustic_kernel(model, u, fw=True, q=None)

Acoustic wave equation time stepper

  • Parameters:
    • model (Model) – Physical model
    • u (TimeFunction or tuple) – wavefield (tuple if TTI)
    • fw (Bool) – Whether forward or backward in time propagation
    • q (TimeFunction or Expr) – Full time-space source

kernels.elastic_kernel(model, v, tau, fw=True, q=None)

Elastic wave equation time stepper

  • Parameters:
    • model (Model) – Physical model
    • v (VectorTimeFunction) – Particle Velocity
    • tau (TensorTimeFunction) – Stress tensor
    • fw (Bool) – Whether forward or backward in time propagation
    • q (TimeFunction or Expr) – Full time-space source as a tuple (one value for each component)

kernels.tti_kernel(model, u1, u2, fw=True, q=None)

TTI wave equation time stepper

  • Parameters:
    • model (Model) – Physical model
    • u1 (TimeFunction) – First component (pseudo-P) of the wavefield
    • u2 (TimeFunction) – First component (pseudo-P) of the wavefield
    • fw (Bool) – Whether forward or backward in time propagation
    • q (TimeFunction or Expr) – Full time-space source as a tuple (one value for each component)

kernels.wave_kernel(model, u, fw=True, q=None, f0=0.015)

Pde kernel corresponding the the model for the input wavefield

  • Parameters:
    • model (Model) – Physical model
    • u (TimeFunction or tuple) – wavefield (tuple if TTI or Viscoacoustic)
    • fw (Bool) – Whether forward or backward in time propagation
    • q (TimeFunction or Expr) – Full time-space source
    • f0 (Peak frequency) –

models module

class models.Model(origin, spacing, shape, space_order=8, nbl=40, dtype=<class 'numpy.float32'>, m=None, epsilon=None, delta=None, theta=None, phi=None, rho=None, b=None, qp=None, lam=None, mu=None, dm=None, fs=False, **kwargs)

The physical model used in seismic inversion : shape_pml = np.array(shape) + 2 * self.nbl processes.

  • Parameters:
    • origin (tuple of floats) – Origin of the model in m as a tuple in (x,y,z) order.
    • spacing (tuple of floats) – Grid size in m as a Tuple in (x,y,z) order.
    • shape (tuple of int) – Number of grid points size in (x,y,z) order.
    • space_order (int) – Order of the spatial stencil discretisation.
    • m (array_like or float) – Squared slownes in s^2/km^2
    • nbl (int , optional) – The number of absorbin layers for boundary damping.
    • dtype (np.float32 or np.float64) – Defaults to 32.
    • epsilon (array_like or float , optional) – Thomsen epsilon parameter (0<epsilon<1).
    • delta (array_like or float) – Thomsen delta parameter (0<delta<1), delta<epsilon.
    • theta (array_like or float) – Tilt angle in radian.
    • phi (array_like or float) – Asymuth angle in radian.
    • dt (Float) – User provided computational time-step

property critical_dt

Critical computational time step value from the CFL condition.

property dim

Spatial dimension of the problem and model domain.

property dm

Model perturbation for linearized modeling

property domain_size

Physical size of the domain as determined by shape and spacing

property dt

User provided dt

property dtype

Data type for all assocaited data objects.

property is_elastic

Whether the model is TTI or isotopic

property is_tti

Whether the model is TTI or isotopic

property is_viscoacoustic

Whether the model is TTI or isotopic

property m

Function holding the squared slowness in s^2/km^2.

property padsizes

property physical_parameters

List of physical parameteres

physical_params(**kwargs)

Return all set physical parameters and update to input values if provided

property space_dimensions

Spatial dimensions of the grid

property space_order

Spatial discretization order

property spacing

Grid spacing for all fields in the physical model.

property spacing_map

Map between spacing symbols and their values for each SpaceDimension.

property vp

Symbolic representation of the velocity vp = sqrt(1 / m)

property zero_thomsen

propagators module

propagators.adjoint(*args, **kwargs)

propagators.born(model, srccoords, rcvcoords, wavelet, spaceorder=8, save=False, qwf=None, returnop=False, ic='as', freqlist=None, dftsub=None, ws=None, t_sub=1, nlind=False, f0=0.015, illum=False, fw=True)

Low level propagator, to be used through interface.py Compute linearized wavefield U = J(m)* δ m and related quantities.

propagators.forward(model, srccoords, rcvcoords, wavelet, spaceorder=8, save=False, qwf=None, returnop=False, freqlist=None, dftsub=None, normwf=False, wfun=None, ws=None, wr=None, t_sub=1, f0=0.015, illum=False, fw=True, **kwargs)

Low level propagator, to be used through interface.py Compute forward wavefield u = A(m)^{-1}*f and related quantities (u(xrcv))

propagators.forwardgrad(model, srccoords, rcvcoords, wavelet, v, spaceorder=8, q=None, ws=None, ic='as', w=None, freq=None, f0=0.015, **kwargs)

Low level propagator, to be used through interface.py Compute forward wavefield u = A(m)^{-1}*f and related quantities (u(xrcv))

propagators.gradient(model, residual, rcvcoords, u, returnop=False, spaceorder=8, fw=True, w=None, freq=None, dftsub=None, ic='as', f0=0.015, save=True, illum=False)

Low level propagator, to be used through interface.py Compute the action of the adjoint Jacobian onto a residual J’* δ d.

sensitivity module

sensitivity.Loss(dsyn, dobs, dt, is_residual=False, misfit=None)

L2 loss and residual between the synthetic data dsyn and observed data dobs

  • Parameters:
    • dsyn (SparseTimeFunction or tuple) – Synthetic data or tuple (background, linearized) data
    • dobs (SparseTimeFunction) – Observed data
    • dt (float) – Time sampling rate
    • is_residual (bool) – Whether input dobs is already the data residual
    • misfit (function) – User provided function of the form: misifit(dsyn, dob) -> obj, adjoint_source

sensitivity.basic_src(model, u, **kwargs)

Basic source for linearized modeling

  • Parameters:
    • model (Model) – Model containing the perturbation dm
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)

sensitivity.crosscorrfreq(u, v, model, freq=None, dftsub=None, **kwargs)

Standard cross-correlation imaging condition with on-th-fly-dft

  • Parameters:
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)
    • v (TimeFunction or Tuple) – Adjoint wavefield (tuple of fields for TTI)
    • model (Model) – Model structure
    • freq (Array) – Array of frequencies for on-the-fly DFT
    • factor (int) – Subsampling factor for DFT

sensitivity.crosscorr_time(u, v, model, **kwargs)

Cross correlation of forward and adjoint wavefield

  • Parameters:
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)
    • v (TimeFunction or Tuple) – Adjoint wavefield (tuple of fields for TTI)
    • model (Model) – Model structure

sensitivity.func_name(freq=None, ic='as')

Get key for imaging condition/linearized source function

sensitivity.fwi_freq(*ar, **kw)

sensitivity.fwi_src(*ar, **kw)

sensitivity.fwi_time(*ar, **kw)

sensitivity.gradexpr(gradm, u, v, model, w=None, freq=None, dftsub=None, ic='as')

Gradient update stencil

  • Parameters:
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)
    • v (TimeFunction or Tuple) – Adjoint wavefield (tuple of fields for TTI)
    • model (Model) – Model structure
    • w (Float or Expr (**optional )) – Weight for the gradient expression (default=1)
    • freq (Array) – Array of frequencies for on-the-fly DFT
    • factor (int) – Subsampling factor for DFT
    • isic (Bool) – Whether or not to use inverse scattering imaging condition (not supported yet)

sensitivity.inner_grad(u, v)

Inner product of the gradient of two Function.

  • Parameters:
    • u (TimeFunction or Function) – First wavefield
    • v (TimeFunction or Function) – Second wavefield

sensitivity.isic_freq(u, v, model, **kwargs)

Inverse scattering imaging condition

  • Parameters:
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)
    • v (TimeFunction or Tuple) – Adjoint wavefield (tuple of fields for TTI)
    • model (Model) – Model structure

sensitivity.isic_src(model, u, **kwargs)

ISIC source for linearized modeling

  • Parameters:
    • model (Model) – Model containing the perturbation dm
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)

sensitivity.isic_time(u, v, model, **kwargs)

Inverse scattering imaging condition

  • Parameters:
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)
    • v (TimeFunction or Tuple) – Adjoint wavefield (tuple of fields for TTI)
    • model (Model) – Model structure

sensitivity.lin_src(model, u, ic='as')

Source for linearized modeling

  • Parameters:
    • model (Model) – Model containing the perturbation dm
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)
    • ic (String) – Imaging condition of which we compute the linearized source

sources module

class sources.PointSource(*args)

Symbolic data object for a set of sparse point sources

  • Parameters:
    • name (String) – Name of the symbol representing this source
    • grid (Grid) – Grid object defining the computational domain.
    • coordinates (Array) – Point coordinates for this source
    • data ( (**Optional ) Data) – values to initialise point data
    • ntime (Int (**Optional )) – Number of timesteps for which to allocate data
    • npoint (Int (**Optional )) –
    • source (Number of sparse points represented by this) –
    • dimension (Dimension (**Optional )) – object for representing the number of points in this source
    • Note
    • fully (either the dimensions ntime and npoint or the) –
    • provided. (initialised data array need to be) –

defaultassumptions *= {'commutative': True, 'complex': True, 'extendedreal': True, 'finite': True, 'hermitian': True, 'imaginary': False, 'infinite': False, 'real': True}*

is_commutative : bool | None = True

is_complex = True

isextendedreal : bool | None = True

is_finite = True

is_hermitian = True

is_imaginary = False

is_infinite = False

is_real : bool | None = True

sources.Receiver

alias of PointSource

class sources.RickerSource(*args)

Symbolic object that encapsulate a set of sources with a pre-defined Ricker wavelet: http://subsurfwiki.org/wiki/Ricker_wavelet name: Name for the resulting symbol grid: Grid object defining the computational domain. f0: Peak frequency for Ricker wavelet in kHz time: Discretized values of time in ms

defaultassumptions *= {'commutative': True, 'complex': True, 'extendedreal': True, 'finite': True, 'hermitian': True, 'imaginary': False, 'infinite': False, 'real': True}*

is_commutative : bool | None = True

is_complex = True

isextendedreal : bool | None = True

is_finite = True

is_hermitian = True

is_imaginary = False

is_infinite = False

is_real : bool | None = True

wavelet(timev)

class sources.TimeAxis(start=None, step=None, num=None, stop=None)

Data object to store the TimeAxis. Exactly three of the four key arguments must be prescribed. Because of remainder values it is not possible to create a TimeAxis that exactly adhears to the inputs therefore start, stop, step and num values should be taken from the TimeAxis object rather than relying upon the input values. The four possible cases are: * start is None: start = step*(1 - num) + stop * step is None: step = (stop - start)/(num - 1) * num is None: num = ceil((stop - start + step)/step) and because of remainder stop = step*(num - 1) + start * stop is None: stop = step*(num - 1) + start

  • Parameters:
    • start (float , optional) – Start of time axis.
    • step (float , optional) – Time interval.
    • num (int , optional) – Number of values (Note: this is the number of intervals + 1). Stop value is reset to correct for remainder.
    • stop (float , optional) – End time.

time_values

wave_utils module

Module contents

+Devito backend reference · JUDI documentation

pysource package

Submodules

FD_utils module

FDutils.Rmat(model)

Rotation matrix according to tilt and asymut.

  • Parameters: model (Model) – Model structure

FDutils.divs(func, sofact=1, side=-1)

GrDivergenceadient shifted by half a grid point, only to be used in combination with grads.

FDutils.grads(func, sofact=1, side=1)

Gradient shifted by half a grid point, only to be used in combination with divs.

FD_utils.laplacian(v, irho)

Laplacian with density div( 1/rho grad) (u)

FDutils.satti(u, v, model)

Tensor factorized SSA TTI wave equation spatial derivatives.

  • Parameters:
    • u (TimeFunction) – first TTI field
    • v (TimeFunction) – second TTI field
    • model (Model) – Model structure

FDutils.thomsenmat(model)

Diagonal Matrices with Thomsen parameters for vectorial temporaries computation.

  • Parameters: model (Model) – Model structure

checkpoint module

class checkpoint.CheckpointOperator(op, **kwargs)

Devito’s concrete implementation of the ABC pyrevolve.Operator. This class wraps devito.Operator so it conforms to the pyRevolve API. pyRevolve will call apply with arguments tstart and tend. Devito calls these arguments ts and te so the following dict is used to perform the translations between different names.

  • Parameters:
    • op (Operator) – devito.Operator object that this object will wrap.
    • args (dict) – If devito.Operator.apply() expects any arguments, they can be provided here to be cached. Any calls to CheckpointOperator.apply() will automatically include these cached arguments in the call to the underlying devito.Operator.apply().

apply(tstart, tend)

If the devito operator requires some extra arguments in the call to apply they can be stored in the args property of this object so pyRevolve calls pyRevolve.Operator.apply() without caring about these extra arguments while this method passes them on correctly to devito.Operator

targnames = {'tend': 'timeM', 'tstart': 'timem'}

class checkpoint.DevitoCheckpoint(objects)

Devito’s concrete implementation of the Checkpoint abstract base class provided by pyRevolve. Holds a list of symbol objects that hold data.

property dtype

data type

get_data(timestep)

returns the data (wavefield) for the time-step timestep

getdatalocation(timestep)

returns the data (wavefield) for the time-step timestep

load()

NotImplementedError

save()

NotImplementedError

property size

The memory consumption of the data contained in a checkpoint.

checkpoint.getsymboldata(symbol, timestep)

Return the symbol corresponding to the data at time-step timestep

geom_utils module

geomutils.geomexpr(model, u, srccoords=None, reccoords=None, wavelet=None, fw=True, nt=None)

Generates the source injection and receiver interpolation. This function is fully abstracted and does not care whether this is a forward or adjoint wave-equation. The source is the source term of the equation The receiver is the measurment term

Therefore, for the adjoint, this function has to be called as: srcrec(model, v, srccoords=rec_coords, …) because the data is the sources

  • Parameters:
    • model (Model) – Physical model
    • u (TimeFunction or tuple) – Wavefield to inject into and read from
    • src_coords (Array) – Physical coordinates of the sources
    • rec_coords (Array) – Physical coordinates of the receivers
    • wavelet (Array) – Data for the source
    • fw=True – Whether the direction is forward or backward in time
    • nt (int) – Number of time steps

geomutils.srcrec(model, u, srccoords=None, reccoords=None, wavelet=None, nt=None)

interface module

interface.Jadjoint(model, srccoords, wavelet, reccoords, recin, spaceorder=8, isresidual=False, checkpointing=False, ncheckpoints=None, tsub=1, returnobj=False, freqlist=[], dftsub=None, ic='as', illum=False, ws=None, f0=0.015, born_fwd=False, nlind=False, misfit=None, fw=True)

Jacobian (adjoint fo born modeling operator) operator on a shot record as a source (i.e data residual). Supports three modes: * Checkpinting * Frequency compression (on-the-fly DFT) * Standard zero lag cross correlation over time

  • Parameters:
    • model (Model) – Physical model
    • src_coords (Array) – Coordiantes of the source(s)
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • recin (Array) – Receiver data
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • checkpointing (Bool) – Whether or not to use checkpointing
    • n_checkpoints (Int) – Number of checkpoints for checkpointing
    • maxmem (Float) – Maximum memory to use for checkpointing
    • freq_list (List) – List of frequencies for on-the-fly DFT
    • dft_sub (Int) – Subsampling factor for on-the-fly DFT
    • ic (String) – Imaging conditions (“as”, “isic” or “fwi”), defaults to “as”
    • ws (Array) – Extended source spatial distribution
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation as base propagator
  • Returns: Adjoint jacobian on the input data (gradient)
  • Return type: Array

interface.Jadjointcheckpointing(model, srccoords, wavelet, reccoords, recin, spaceorder=8, isresidual=False, ncheckpoints=None, bornfwd=False, return_obj=False, ic='as', ws=None, nlind=False, f0=0.015, misfit=None, illum=False, fw=True)

Jacobian (adjoint fo born modeling operator) operator on a shot record as a source (i.e data residual). Outputs the gradient with Checkpointing.

  • Parameters:
    • model (Model) – Physical model
    • src_coords (Array) – Coordiantes of the source(s)
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • recin (Array) – Receiver data
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • checkpointing (Bool) – Whether or not to use checkpointing
    • n_checkpoints (Int) – Number of checkpoints for checkpointing
    • maxmem (Float) – Maximum memory to use for checkpointing
    • ic (String) – Imaging conditions (“as”, “isic” or “fwi”), defaults to “as”
    • ws (Array) – Extended source spatial distribution
    • is_residual (Bool) – Whether to treat the input as the residual or as the observed data
    • born_fwd (Bool) – Whether to use the forward or linearized forward modeling operator
    • nlind (Bool) – Whether to remove the non linear data from the input data. This option is only available in combination with born_fwd
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation as base propagator
  • Returns: Adjoint jacobian on the input data (gradient)
  • Return type: Array

interface.Jadjointfreq(model, srccoords, wavelet, reccoords, recin, spaceorder=8, freqlist=[], isresidual=False, returnobj=False, nlind=False, dftsub=None, ic='as', ws=None, bornfwd=False, f0=0.015, misfit=None, illum=False, fw=True)

Jacobian (adjoint fo born modeling operator) operator on a shot record as a source (i.e data residual). Outputs the gradient with Frequency compression (on-the-fly DFT).

  • Parameters:
    • model (Model) – Physical model
    • src_coords (Array) – Coordiantes of the source(s)
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • recin (Array) – Receiver data
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • freq_list (List) – List of frequencies for on-the-fly DFT
    • dft_sub (Int) – Subsampling factor for on-the-fly DFT
    • ic (String) – Imaging conditions (“as”, “isic” or “fwi”), defaults to “as”
    • ws (Array) – Extended source spatial distribution
    • is_residual (Bool) – Whether to treat the input as the residual or as the observed data
    • born_fwd (Bool) – Whether to use the forward or linearized forward modeling operator
    • nlind (Bool) – Whether to remove the non linear data from the input data. This option is only available in combination with born_fwd
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation as base propagator
  • Returns: Adjoint jacobian on the input data (gradient)
  • Return type: Array

interface.Jadjointstandard(model, srccoords, wavelet, reccoords, recin, spaceorder=8, isresidual=False, returnobj=False, bornfwd=False, illum=False, ic='as', ws=None, t_sub=1, nlind=False, f0=0.015, misfit=None, fw=True)

Adjoint Jacobian (adjoint fo born modeling operator) operator on a shot record as a source (i.e data residual). Outputs the gradient with standard zero lag cross correlation over time.

  • Parameters:
    • model (Model) – Physical model
    • src_coords (Array) – Coordiantes of the source(s)
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • recin (Array) – Receiver data
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • ic (String) – Imaging conditions (“as”, “isic” or “fwi”), defaults to “as”
    • ws (Array) – Extended source spatial distribution
    • is_residual (Bool) – Whether to treat the input as the residual or as the observed data
    • born_fwd (Bool) – Whether to use the forward or linearized forward modeling operator
    • nlind (Bool) – Whether to remove the non linear data from the input data. This option is only available in combination with born_fwd
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation as base propagator
  • Returns: Adjoint jacobian on the input data (gradient)
  • Return type: Array

interface.adjointw(model, reccoords, data, wavelet, space_order=8, f0=0.015, illum=False, fw=True)

Adjoint/backward modeling of a shot record (receivers as source) for an extended source setup Pw*F^T*Pr^T*d_obs.

  • Parameters:
    • model (Model) – Physical model
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • data (Array) – Shot gather
    • wavelet (Array) – Time signature of the forward source for stacking along time
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: spatial distribution
  • Return type: Array

interface.bornrec(model, srccoords, wavelet, reccoords, spaceorder=8, ic='as', f0=0.015, illum=False, fw=True)

Linearized (Born) modeling of a point source for a model perturbation (square slowness) dm.

  • Parameters:
    • model (Model) – Physical model
    • src_coords (Array) – Coordiantes of the source(s)
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • ic (String) – Imaging conditions (“as”, “isic” or “fwi”), defaults to “as”
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: Shot record
  • Return type: Array

interface.bornrecw(model, weight, wavelet, reccoords, spaceorder=8, ic='as', f0=0.015, illum=False, fw=True)

Linearized (Born) modeling of an extended source for a model perturbation (square slowness) dm with an extended source

  • Parameters:
    • model (Model) – Physical model
    • weight (Array) – Spatial distriubtion of the extended source
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • ic (String) – Imaging conditions (“as”, “isic” or “fwi”), defaults to “as”
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: Shot record
  • Return type: Array

interface.forwardnorec(model, srccoords, wavelet, spaceorder=8, f0=0.015, illum=False, fw=True)

Forward modeling of a point source without receiver.

  • Parameters:
    • model (Model) – Physical model
    • src_coords (Array) – Coordiantes of the source(s)
    • wavelet (Array) – Source signature
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: Wavefield
  • Return type: Array

interface.forwardrec(model, srccoords, wavelet, reccoords, spaceorder=8, f0=0.015, illum=False, fw=True)

Modeling of a point source with receivers Pr*F*Ps^T*q.

  • Parameters:
    • model (Model) – Physical model
    • src_coords (Array) – Coordiantes of the source(s)
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: Shot record
  • Return type: Array

interface.forwardrecw(model, weight, wavelet, reccoords, spaceorder=8, f0=0.015, illum=False, fw=True)

Forward modeling of an extended source with receivers Pr*F*Pw^T*w

  • Parameters:
    • model (Model) – Physical model
    • weights (Array) – Spatial distribution of the extended source.
    • wavelet (Array) – Source signature
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: Shot record
  • Return type: Array

interface.forwardwfsrc(model, u, reccoords, spaceorder=8, f0=0.015, illum=False, fw=True)

Forward modeling of a full wavefield source Pr*F*u.

  • Parameters:
    • model (Model) – Physical model
    • u (TimeFunction or Array) – Time-space dependent wavefield
    • rec_coords (Array) – Coordiantes of the receiver(s)
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: Shot record
  • Return type: Array

interface.forwardwfsrcnorec(model, u, spaceorder=8, f0=0.015, illum=False, fw=True)

Forward modeling of a full wavefield source without receiver F*u.

  • Parameters:
    • model (Model) – Physical model
    • u (TimeFunction or Array) – Time-space dependent wavefield
    • space_order (Int (**optional )) – Spatial discretization order, defaults to 8
    • f0 (float) – peak frequency
    • illum (bool) – Whether to compute illumination during propagation
    • fw (bool) – Whether it is forward or adjoint propagation
  • Returns: Wavefield
  • Return type: Array

interface.wrifunc(model, srccoords, wavelet, reccoords, recin, yin, spaceorder=8, ic='as', ws=None, tsub=1, grad='m', gradcorr=False, alphaop=False, wfun=None, eps=0, freq_list=[], wfilt=None, f0=0.015)

Time domain wavefield reconstruction inversion wrapper

kernels module

kernels.SLS2ndorder(model, p, fw=True, q=None, f0=0.015)

Viscoacoustic 2nd SLS wave equation. https://library.seg.org/doi/10.1190/geo2013-0030.1

Bulk modulus moved to rhs. The adjoint equation is directly derived as the discrete adjoint of the forward PDE which leads to a slightly different formulation than in the paper.

  • Parameters:
    • model (Model) – Physical model
    • u1 (TimeFunction) – Pressure field
    • u2 (TimeFunction) – Attenuation Memory variable
    • fw (Bool) – Whether forward or backward in time propagation
    • q (TimeFunction or Expr) – Full time-space source as a tuple (one value for each component)
    • f0 (Peak frequency) –

kernels.acoustic_kernel(model, u, fw=True, q=None)

Acoustic wave equation time stepper

  • Parameters:
    • model (Model) – Physical model
    • u (TimeFunction or tuple) – wavefield (tuple if TTI)
    • fw (Bool) – Whether forward or backward in time propagation
    • q (TimeFunction or Expr) – Full time-space source

kernels.elastic_kernel(model, v, tau, fw=True, q=None)

Elastic wave equation time stepper

  • Parameters:
    • model (Model) – Physical model
    • v (VectorTimeFunction) – Particle Velocity
    • tau (TensorTimeFunction) – Stress tensor
    • fw (Bool) – Whether forward or backward in time propagation
    • q (TimeFunction or Expr) – Full time-space source as a tuple (one value for each component)

kernels.tti_kernel(model, u1, u2, fw=True, q=None)

TTI wave equation time stepper

  • Parameters:
    • model (Model) – Physical model
    • u1 (TimeFunction) – First component (pseudo-P) of the wavefield
    • u2 (TimeFunction) – First component (pseudo-P) of the wavefield
    • fw (Bool) – Whether forward or backward in time propagation
    • q (TimeFunction or Expr) – Full time-space source as a tuple (one value for each component)

kernels.wave_kernel(model, u, fw=True, q=None, f0=0.015)

Pde kernel corresponding the the model for the input wavefield

  • Parameters:
    • model (Model) – Physical model
    • u (TimeFunction or tuple) – wavefield (tuple if TTI or Viscoacoustic)
    • fw (Bool) – Whether forward or backward in time propagation
    • q (TimeFunction or Expr) – Full time-space source
    • f0 (Peak frequency) –

models module

class models.Model(origin, spacing, shape, space_order=8, nbl=40, dtype=<class 'numpy.float32'>, m=None, epsilon=None, delta=None, theta=None, phi=None, rho=None, b=None, qp=None, lam=None, mu=None, dm=None, fs=False, **kwargs)

The physical model used in seismic inversion : shape_pml = np.array(shape) + 2 * self.nbl processes.

  • Parameters:
    • origin (tuple of floats) – Origin of the model in m as a tuple in (x,y,z) order.
    • spacing (tuple of floats) – Grid size in m as a Tuple in (x,y,z) order.
    • shape (tuple of int) – Number of grid points size in (x,y,z) order.
    • space_order (int) – Order of the spatial stencil discretisation.
    • m (array_like or float) – Squared slownes in s^2/km^2
    • nbl (int , optional) – The number of absorbin layers for boundary damping.
    • dtype (np.float32 or np.float64) – Defaults to 32.
    • epsilon (array_like or float , optional) – Thomsen epsilon parameter (0<epsilon<1).
    • delta (array_like or float) – Thomsen delta parameter (0<delta<1), delta<epsilon.
    • theta (array_like or float) – Tilt angle in radian.
    • phi (array_like or float) – Asymuth angle in radian.
    • dt (Float) – User provided computational time-step

property critical_dt

Critical computational time step value from the CFL condition.

property dim

Spatial dimension of the problem and model domain.

property dm

Model perturbation for linearized modeling

property domain_size

Physical size of the domain as determined by shape and spacing

property dt

User provided dt

property dtype

Data type for all assocaited data objects.

property is_elastic

Whether the model is TTI or isotopic

property is_tti

Whether the model is TTI or isotopic

property is_viscoacoustic

Whether the model is TTI or isotopic

property m

Function holding the squared slowness in s^2/km^2.

property padsizes

property physical_parameters

List of physical parameteres

physical_params(**kwargs)

Return all set physical parameters and update to input values if provided

property space_dimensions

Spatial dimensions of the grid

property space_order

Spatial discretization order

property spacing

Grid spacing for all fields in the physical model.

property spacing_map

Map between spacing symbols and their values for each SpaceDimension.

property vp

Symbolic representation of the velocity vp = sqrt(1 / m)

property zero_thomsen

propagators module

propagators.adjoint(*args, **kwargs)

propagators.born(model, srccoords, rcvcoords, wavelet, spaceorder=8, save=False, qwf=None, returnop=False, ic='as', freqlist=None, dftsub=None, ws=None, t_sub=1, nlind=False, f0=0.015, illum=False, fw=True)

Low level propagator, to be used through interface.py Compute linearized wavefield U = J(m)* δ m and related quantities.

propagators.forward(model, srccoords, rcvcoords, wavelet, spaceorder=8, save=False, qwf=None, returnop=False, freqlist=None, dftsub=None, normwf=False, wfun=None, ws=None, wr=None, t_sub=1, f0=0.015, illum=False, fw=True, **kwargs)

Low level propagator, to be used through interface.py Compute forward wavefield u = A(m)^{-1}*f and related quantities (u(xrcv))

propagators.forwardgrad(model, srccoords, rcvcoords, wavelet, v, spaceorder=8, q=None, ws=None, ic='as', w=None, freq=None, f0=0.015, **kwargs)

Low level propagator, to be used through interface.py Compute forward wavefield u = A(m)^{-1}*f and related quantities (u(xrcv))

propagators.gradient(model, residual, rcvcoords, u, returnop=False, spaceorder=8, fw=True, w=None, freq=None, dftsub=None, ic='as', f0=0.015, save=True, illum=False)

Low level propagator, to be used through interface.py Compute the action of the adjoint Jacobian onto a residual J’* δ d.

sensitivity module

sensitivity.Loss(dsyn, dobs, dt, is_residual=False, misfit=None)

L2 loss and residual between the synthetic data dsyn and observed data dobs

  • Parameters:
    • dsyn (SparseTimeFunction or tuple) – Synthetic data or tuple (background, linearized) data
    • dobs (SparseTimeFunction) – Observed data
    • dt (float) – Time sampling rate
    • is_residual (bool) – Whether input dobs is already the data residual
    • misfit (function) – User provided function of the form: misifit(dsyn, dob) -> obj, adjoint_source

sensitivity.basic_src(model, u, **kwargs)

Basic source for linearized modeling

  • Parameters:
    • model (Model) – Model containing the perturbation dm
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)

sensitivity.crosscorrfreq(u, v, model, freq=None, dftsub=None, **kwargs)

Standard cross-correlation imaging condition with on-th-fly-dft

  • Parameters:
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)
    • v (TimeFunction or Tuple) – Adjoint wavefield (tuple of fields for TTI)
    • model (Model) – Model structure
    • freq (Array) – Array of frequencies for on-the-fly DFT
    • factor (int) – Subsampling factor for DFT

sensitivity.crosscorr_time(u, v, model, **kwargs)

Cross correlation of forward and adjoint wavefield

  • Parameters:
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)
    • v (TimeFunction or Tuple) – Adjoint wavefield (tuple of fields for TTI)
    • model (Model) – Model structure

sensitivity.func_name(freq=None, ic='as')

Get key for imaging condition/linearized source function

sensitivity.fwi_freq(*ar, **kw)

sensitivity.fwi_src(*ar, **kw)

sensitivity.fwi_time(*ar, **kw)

sensitivity.gradexpr(gradm, u, v, model, w=None, freq=None, dftsub=None, ic='as')

Gradient update stencil

  • Parameters:
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)
    • v (TimeFunction or Tuple) – Adjoint wavefield (tuple of fields for TTI)
    • model (Model) – Model structure
    • w (Float or Expr (**optional )) – Weight for the gradient expression (default=1)
    • freq (Array) – Array of frequencies for on-the-fly DFT
    • factor (int) – Subsampling factor for DFT
    • isic (Bool) – Whether or not to use inverse scattering imaging condition (not supported yet)

sensitivity.inner_grad(u, v)

Inner product of the gradient of two Function.

  • Parameters:
    • u (TimeFunction or Function) – First wavefield
    • v (TimeFunction or Function) – Second wavefield

sensitivity.isic_freq(u, v, model, **kwargs)

Inverse scattering imaging condition

  • Parameters:
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)
    • v (TimeFunction or Tuple) – Adjoint wavefield (tuple of fields for TTI)
    • model (Model) – Model structure

sensitivity.isic_src(model, u, **kwargs)

ISIC source for linearized modeling

  • Parameters:
    • model (Model) – Model containing the perturbation dm
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)

sensitivity.isic_time(u, v, model, **kwargs)

Inverse scattering imaging condition

  • Parameters:
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)
    • v (TimeFunction or Tuple) – Adjoint wavefield (tuple of fields for TTI)
    • model (Model) – Model structure

sensitivity.lin_src(model, u, ic='as')

Source for linearized modeling

  • Parameters:
    • model (Model) – Model containing the perturbation dm
    • u (TimeFunction or Tuple) – Forward wavefield (tuple of fields for TTI or dft)
    • ic (String) – Imaging condition of which we compute the linearized source

sources module

class sources.PointSource(*args)

Symbolic data object for a set of sparse point sources

  • Parameters:
    • name (String) – Name of the symbol representing this source
    • grid (Grid) – Grid object defining the computational domain.
    • coordinates (Array) – Point coordinates for this source
    • data ( (**Optional ) Data) – values to initialise point data
    • ntime (Int (**Optional )) – Number of timesteps for which to allocate data
    • npoint (Int (**Optional )) –
    • source (Number of sparse points represented by this) –
    • dimension (Dimension (**Optional )) – object for representing the number of points in this source
    • Note
    • fully (either the dimensions ntime and npoint or the) –
    • provided. (initialised data array need to be) –

defaultassumptions *= {'commutative': True, 'complex': True, 'extendedreal': True, 'finite': True, 'hermitian': True, 'imaginary': False, 'infinite': False, 'real': True}*

is_commutative : bool | None = True

is_complex = True

isextendedreal : bool | None = True

is_finite = True

is_hermitian = True

is_imaginary = False

is_infinite = False

is_real : bool | None = True

sources.Receiver

alias of PointSource

class sources.RickerSource(*args)

Symbolic object that encapsulate a set of sources with a pre-defined Ricker wavelet: http://subsurfwiki.org/wiki/Ricker_wavelet name: Name for the resulting symbol grid: Grid object defining the computational domain. f0: Peak frequency for Ricker wavelet in kHz time: Discretized values of time in ms

defaultassumptions *= {'commutative': True, 'complex': True, 'extendedreal': True, 'finite': True, 'hermitian': True, 'imaginary': False, 'infinite': False, 'real': True}*

is_commutative : bool | None = True

is_complex = True

isextendedreal : bool | None = True

is_finite = True

is_hermitian = True

is_imaginary = False

is_infinite = False

is_real : bool | None = True

wavelet(timev)

class sources.TimeAxis(start=None, step=None, num=None, stop=None)

Data object to store the TimeAxis. Exactly three of the four key arguments must be prescribed. Because of remainder values it is not possible to create a TimeAxis that exactly adhears to the inputs therefore start, stop, step and num values should be taken from the TimeAxis object rather than relying upon the input values. The four possible cases are: * start is None: start = step*(1 - num) + stop * step is None: step = (stop - start)/(num - 1) * num is None: num = ceil((stop - start + step)/step) and because of remainder stop = step*(num - 1) + start * stop is None: stop = step*(num - 1) + start

  • Parameters:
    • start (float , optional) – Start of time axis.
    • step (float , optional) – Time interval.
    • num (int , optional) – Number of values (Note: this is the number of intervals + 1). Stop value is reset to correct for remainder.
    • stop (float , optional) – End time.

time_values

wave_utils module

Module contents

diff --git a/dev/search/index.html b/dev/search/index.html index 22d46c212..6296cd880 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · JUDI documentation

Loading search...

    +Search · JUDI documentation

    Loading search...

      diff --git a/dev/tutorials/01_intro/index.html b/dev/tutorials/01_intro/index.html index 632ede1d5..ce7a1c377 100644 --- a/dev/tutorials/01_intro/index.html +++ b/dev/tutorials/01_intro/index.html @@ -66,4 +66,4 @@ ylabel("Recording time (s)") title("xsrc=$(1f-3xsrc[2*i][1])km") end -tight_layout()

      png

      +tight_layout()

      png

      diff --git a/dev/tutorials/02_fwi_example_NLopt/index.html b/dev/tutorials/02_fwi_example_NLopt/index.html index 68c6545cd..9c993487e 100644 --- a/dev/tutorials/02_fwi_example_NLopt/index.html +++ b/dev/tutorials/02_fwi_example_NLopt/index.html @@ -93,4 +93,4 @@ (22470.578125, [0.4444444477558136, 0.4444444477558136, 0.4444444477558136, 0.4444444477558136, 0.4444444477558136, 0.4444444477558136, 0.4444444477558136, 0.4444444477558136, 0.4444444477558136, 0.4444444477558136 … 0.05060886426348713, 0.05044609939336615, 0.050292761170062046, 0.05017357884927398, 0.05011064413011435, 0.05011993876926194, 0.05020965433880526, 0.05038047472521424, 0.05062740429803987, 0.05094217839179781], :MAXEVAL_REACHED)

      We plot the final velocity model after 15 function evaluations:

      imshow(sqrt.(1f0./reshape(minx, model0.n))', cmap="GnBu", extent=(0,10,3,0), vmin=1.5, vmax=5.4); title("FWI with L-BFGS")
       xlabel("Lateral position [km]");
      -ylabel("Depth [km]");

      png

      +ylabel("Depth [km]");

      png

      diff --git a/dev/tutorials/03_constrained_fwi/index.html b/dev/tutorials/03_constrained_fwi/index.html index b38c42639..3b1d6b504 100644 --- a/dev/tutorials/03_constrained_fwi/index.html +++ b/dev/tutorials/03_constrained_fwi/index.html @@ -1825,4 +1825,4 @@ title("TV FWI Residual sz=$(zsrc[index]) || True sz=$(zsrc[index]) || FWI sz=$(zsrc[index]) (flipped)"); tight_layout() end
      make_plot (generic function with 1 method)

      Data for the 1st shot, generated in the initial and FWI models

      make_plot(1)

      png

      Data for the 4th shot, generated in the initial and FWI models

      make_plot(4)

      png

      Data for the 8th shot, generated in the initial and FWI models

      make_plot(8)

      png

      Remove workers

      rmprocs(workers());
      ┌ Warning: rmprocs: process 1 not removed
      -└ @ Distributed /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Distributed/src/cluster.jl:1038
      +└ @ Distributed /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Distributed/src/cluster.jl:1038 diff --git a/dev/tutorials/04_judi_leading_edge_tutorial/index.html b/dev/tutorials/04_judi_leading_edge_tutorial/index.html index ec0dbb83d..088524f26 100644 --- a/dev/tutorials/04_judi_leading_edge_tutorial/index.html +++ b/dev/tutorials/04_judi_leading_edge_tutorial/index.html @@ -101,4 +101,4 @@ xlabel("Iteration number", size=12) ylabel("Misfit", size=12) xlim(1, 10) -show()

      Figure 3: Normalized function values for the FWI inversion example with stochastic gradient descent and the Gauss-Newton method.

      An alternative to (Gauss–)Newton methods are quasi-Newton methods, which build up an approximation of the Hessian from previous gradients only and require no additional PDE solves or matrix inversions. Implementing an efficient and correct version of this method, such as the L-BFGS algorithm, exceeds a few lines of code and we therefore leave this exercise to the reader. Instead of implementing more complicated algorithms by hand, it is also possible to interface third-party Julia optimization libraries and an example for this is given in the notebook fwiexampleNLopt.ipynb.

      Even though all examples shown here are two-dimensional, in order to make them reproducible on a laptop or desktop PC, JUDI can be used for 3D modeling and inversion without having to change the code, since the number of dimensions are automatically inferred from the velocity model and data dimensions.

      Conclusions

      In this final part of our FWI tutorial series, we demonstrated how to set up basic optimization algorithms for waveform inversion using JUDI. The methods shown here are all gradient based and differ in the way how update directions for the velocity model are computed. Our numerical examples can serve for the reader as a basis for developing more advanced FWI workflows, which usually include additional data preprocessing, frequency continuation techniques or further model constraints.

      Acknowledgments

      This research was carried out as part of the SINBAD II project with the support of the member organizations of the SINBAD Consortium. This work was financially supported in part by EPSRC grant EP/L000407/1 and the Imperial College London Intel Parallel Computing Centre.

      References

      Aminzadeh, F., Brac, J., and Kunz, T., 1997. 3D Salt and Overthrust models. SEG/EAGE Modeling Series, No. 1: Distribution CD of Salt and Overthrust models, SEG Book Series Tulsa, Oklahoma.

      Bezanson, J., Karpinski, S., Shah, V. B., and Edelman, A., 2012, Julia: A fast dynamic language for technical computing: CoRR. Retrieved from http://arxiv.org/abs/1209.5145

      Bunks, C., Saleck, F. M., Zaleski, S., and Chavent, G., 1995, Multiscale seismic waveform inversion: GEOPHYSICS, 60, 1457–1473. doi:10.1190/1.1443880

      Johnson, S., 2017, Calling python functions from the julia language: GitHub repository. https://github.com/JuliaPy/PyCall.jl; GitHub.

      Lange, M., Kukreja, N., Louboutin, M., Luporini, F., Zacarias, F. V., Pandolfo, V., … Gorman, G., 2016, Devito: Towards a generic finite difference DSL using symbolic python: 6th workshop on python for high-performance and scientific computing. doi:10.1109/PyHPC.2016.9

      Leeuwen, T. van, Aravkin, A. Y., Calandra, H., and Herrmann, F. J., 2013, In which domain should we measure the misfit for robust full waveform inversion? EAGE annual conference proceedings. doi:10.3997/2214-4609.20130839

      Louboutin, M., Witte, P. A., Lange, M., Kukreja, N., Luporini, F., Gorman, G., and Herrmann, F. J., 2017, Full-waveform inversion - part 1: Forward modeling: Retrieved from https://www.slim.eos.ubc.ca/Publications/Private/Submitted/2017/louboutin2017fwi/louboutin2017fwi.html

      Louboutin, M., Witte, P. A., Lange, M., Kukreja, N., Luporini, F., Gorman, G., and Herrmann, F. J., 2018, Full-waveform inversion - part 2: Adjoint modeling:

      Nocedal, J., and Wright, S., 2009, Numerical optimization: (2nd ed.). Springer.

      Paige, C. C., and Saunders, M. A., 1982, LSQR: An algorithm for sparse linear equations and sparse least squares: ACM Trans. Math. Softw., 8, 43–71. doi:10.1145/355984.355989

      Peters, B., and Herrmann, F. J., 2017, Constraints versus penalties for edge-preserving full-waveform inversion: The Leading Edge, 36, 94–100. doi:10.1190/tle36010094.1

      Warner, M., and Guasch, L., 2014, Adaptive waveform inversion: Theory: In SEG technical program expanded abstracts 2014 (pp. 1089–1093). doi:10.1190/segam2014-0371.1

      +show()

      Figure 3: Normalized function values for the FWI inversion example with stochastic gradient descent and the Gauss-Newton method.

      An alternative to (Gauss–)Newton methods are quasi-Newton methods, which build up an approximation of the Hessian from previous gradients only and require no additional PDE solves or matrix inversions. Implementing an efficient and correct version of this method, such as the L-BFGS algorithm, exceeds a few lines of code and we therefore leave this exercise to the reader. Instead of implementing more complicated algorithms by hand, it is also possible to interface third-party Julia optimization libraries and an example for this is given in the notebook fwiexampleNLopt.ipynb.

      Even though all examples shown here are two-dimensional, in order to make them reproducible on a laptop or desktop PC, JUDI can be used for 3D modeling and inversion without having to change the code, since the number of dimensions are automatically inferred from the velocity model and data dimensions.

      Conclusions

      In this final part of our FWI tutorial series, we demonstrated how to set up basic optimization algorithms for waveform inversion using JUDI. The methods shown here are all gradient based and differ in the way how update directions for the velocity model are computed. Our numerical examples can serve for the reader as a basis for developing more advanced FWI workflows, which usually include additional data preprocessing, frequency continuation techniques or further model constraints.

      Acknowledgments

      This research was carried out as part of the SINBAD II project with the support of the member organizations of the SINBAD Consortium. This work was financially supported in part by EPSRC grant EP/L000407/1 and the Imperial College London Intel Parallel Computing Centre.

      References

      Aminzadeh, F., Brac, J., and Kunz, T., 1997. 3D Salt and Overthrust models. SEG/EAGE Modeling Series, No. 1: Distribution CD of Salt and Overthrust models, SEG Book Series Tulsa, Oklahoma.

      Bezanson, J., Karpinski, S., Shah, V. B., and Edelman, A., 2012, Julia: A fast dynamic language for technical computing: CoRR. Retrieved from http://arxiv.org/abs/1209.5145

      Bunks, C., Saleck, F. M., Zaleski, S., and Chavent, G., 1995, Multiscale seismic waveform inversion: GEOPHYSICS, 60, 1457–1473. doi:10.1190/1.1443880

      Johnson, S., 2017, Calling python functions from the julia language: GitHub repository. https://github.com/JuliaPy/PyCall.jl; GitHub.

      Lange, M., Kukreja, N., Louboutin, M., Luporini, F., Zacarias, F. V., Pandolfo, V., … Gorman, G., 2016, Devito: Towards a generic finite difference DSL using symbolic python: 6th workshop on python for high-performance and scientific computing. doi:10.1109/PyHPC.2016.9

      Leeuwen, T. van, Aravkin, A. Y., Calandra, H., and Herrmann, F. J., 2013, In which domain should we measure the misfit for robust full waveform inversion? EAGE annual conference proceedings. doi:10.3997/2214-4609.20130839

      Louboutin, M., Witte, P. A., Lange, M., Kukreja, N., Luporini, F., Gorman, G., and Herrmann, F. J., 2017, Full-waveform inversion - part 1: Forward modeling: Retrieved from https://www.slim.eos.ubc.ca/Publications/Private/Submitted/2017/louboutin2017fwi/louboutin2017fwi.html

      Louboutin, M., Witte, P. A., Lange, M., Kukreja, N., Luporini, F., Gorman, G., and Herrmann, F. J., 2018, Full-waveform inversion - part 2: Adjoint modeling:

      Nocedal, J., and Wright, S., 2009, Numerical optimization: (2nd ed.). Springer.

      Paige, C. C., and Saunders, M. A., 1982, LSQR: An algorithm for sparse linear equations and sparse least squares: ACM Trans. Math. Softw., 8, 43–71. doi:10.1145/355984.355989

      Peters, B., and Herrmann, F. J., 2017, Constraints versus penalties for edge-preserving full-waveform inversion: The Leading Edge, 36, 94–100. doi:10.1190/tle36010094.1

      Warner, M., and Guasch, L., 2014, Adaptive waveform inversion: Theory: In SEG technical program expanded abstracts 2014 (pp. 1089–1093). doi:10.1190/segam2014-0371.1

      diff --git a/dev/tutorials/05_custom_misfit/index.html b/dev/tutorials/05_custom_misfit/index.html index 068c7f836..3f5f8da48 100644 --- a/dev/tutorials/05_custom_misfit/index.html +++ b/dev/tutorials/05_custom_misfit/index.html @@ -281,4 +281,4 @@ result{Float32}(Float32[0.44444445 0.44444445 … 0.053637963 0.052456174; 0.44444445 0.44444445 … 0.053673286 0.052389987; … ; 0.44444445 0.44444445 … 0.05293595 0.05135409; 0.44444445 0.44444445 … 0.052959688 0.051626943], Float32[0.0 0.0 … 0.0014253161 0.0031370732; 0.0 0.0 … 0.0007196072 0.0023543844; … ; 0.0 0.0 … 0.014447195 0.01871568; 0.0 0.0 … 0.013791027 0.017101452], 0.04899293f0, Float32[0.98902273, 0.5962111, 0.5856857, 0.38198355, 0.22556786, 0.17507246, 0.15682286, 0.14212339, 0.11700058, 0.111277334 … 0.079943426, 0.073783785, 0.073261, 0.07614578, 0.05530872, 0.059201777, 0.057410687, 0.04899293, 0.050576232, 0.04932886], Matrix{Float32}[[0.44444445 0.44444445 … 0.05585606 0.05512348; 0.44444445 0.44444445 … 0.05584115 0.055107832; … ; 0.44444445 0.44444445 … 0.055858355 0.05516676; 0.44444445 0.44444445 … 0.05585274 0.05516145]], 63, 40, 40)
      suptitle("FWI result")
      -plot_velocity(reshape(solh_ideal.x, model0.n)'.^(-.5), model0.d; new_fig=false, name="Ideal data, Envelope")

      png

      In this tutorial, we have seen how misfit functions can impact the inversion result and how JUDI provides multiple misfit functions and a flexible interface for custom user inputs. This interface will allow for better application to real worl dataset since, as show in our example suite, JUDI already provide an interface for handling large SegY datasets and interfaces tricially with optimization frameworks

      +plot_velocity(reshape(solh_ideal.x, model0.n)'.^(-.5), model0.d; new_fig=false, name="Ideal data, Envelope")

      png

      In this tutorial, we have seen how misfit functions can impact the inversion result and how JUDI provides multiple misfit functions and a flexible interface for custom user inputs. This interface will allow for better application to real worl dataset since, as show in our example suite, JUDI already provide an interface for handling large SegY datasets and interfaces tricially with optimization frameworks

      diff --git a/dev/tutorials/06_automatic_differentiation/index.html b/dev/tutorials/06_automatic_differentiation/index.html index a3ec60752..f9475e84d 100644 --- a/dev/tutorials/06_automatic_differentiation/index.html +++ b/dev/tutorials/06_automatic_differentiation/index.html @@ -155,4 +155,4 @@ -Grads(...) +Grads(...) diff --git a/dev/tutorials/07_preconditionners/index.html b/dev/tutorials/07_preconditionners/index.html index 5505d0416..990930945 100644 --- a/dev/tutorials/07_preconditionners/index.html +++ b/dev/tutorials/07_preconditionners/index.html @@ -151,4 +151,4 @@ └ @ Core :-1 ┌ Warning: Deprecated model.d, use spacing(model) │  caller = ip:0x0 -└ @ Core :-1

      png

      +└ @ Core :-1

      png

      diff --git a/dev/tutorials/imaging_conditions/index.html b/dev/tutorials/imaging_conditions/index.html index 3ad76262c..c9dae3f2e 100644 --- a/dev/tutorials/imaging_conditions/index.html +++ b/dev/tutorials/imaging_conditions/index.html @@ -57,4 +57,4 @@ imshow(ni(g_as'), cmap="seismic", aspect="auto", vmin=-1, vmax=1) title("Adjoint State") tight_layout() -display(fig)

      +display(fig)

      diff --git a/dev/tutorials/quickstart/index.html b/dev/tutorials/quickstart/index.html index 35871df56..d19cc661b 100644 --- a/dev/tutorials/quickstart/index.html +++ b/dev/tutorials/quickstart/index.html @@ -118,4 +118,4 @@ xlabel("Receiver position (m)") ylabel("Time (s)") title("TWRI gradient w.r.t y") -display(fig)

      +display(fig)