Regularization

class PyFWI.fwi_tools.Regularization(nx, nz, dx, dz)

Regularization Prepares tools for regularizing FWI problem

Parameters:
  • nx (int scalar) – Number of samples in x-direction

  • nz (int scalar) – Number of samples in z-direction

  • dx (float scalar) – Spatial sampling rate in x-direction

  • dz (float scalar) – Spatial sampling rate in z-direction

Total variation (TV)

Regularization.tv(x0, eps, alpha_z, alpha_x)
Parameters:
  • x0 (float) – Data

  • eps (scalar float) – small value for make it deffrintiable at zero

  • alpha_z (scalar float) – coefficient of Dz

  • alpha_x (scalar float) – coefficient of Dx

Returns:

  • rms (scalar float) – loss

  • grad (scalar float) – Gradient of loss w.r.t. model parameters

Tikhonov

Regularization.tikhonov(x0, alpha_z, alpha_x)

A method to implement Tikhonov regularization with order of 2

Parameters:
  • x0 (1D ndarray) – Data

  • alpha_z (float) – coefficient of Dz

  • alpha_x (float) – coefficient of Dx

Returns:

  • rms (scalar float) – loss

  • grad (scalar float) – Gradient of loss w.r.t. model parameters

Parameter relation

Regularization.parameter_relation(m0, models, k0, kend, freq)

parameter_relation considers regularization for the relation between parameters.

Parameters:
  • m0 (ndarray) – Vector of parameters

  • models (dict) – A dictionary containing couple of dictionaries which includes a numpy polyfit model and regularization parameter.

  • k0 (int) – Index of the first parameter in m0

  • kend (int) – Index of the last parameter in m0

Returns:

  • rms (float) – rms of regularization

  • grad (ndarray) – Vector of gradient od the regularization

Prior information

Regularization.priori_regularization(m0, regularization_dict, k0, kend, freq)

priori_regularization consider the priori information regularization.

Parameters:
  • m0 (float) – Vector of parameters

  • regularization_dict (dict) – A dictionary containing couple of priori model and regularization hyperparameter

  • k0 (int) – Index of the first parameter in m0

  • kend (int) – Index of the last parameter in m0

Returns:

  • rms (float) – rms of regularization

  • grad (ndarray) – Vector of gradient od the regularization

References

Asnaashari et al., 2013, Regularized seismic full waveform inversion with prior model information, Geophysics, 78(2), R25-R36, eq. 5.

Gradient switching

lmd to vd

grad_switcher.grad_lmd_to_vd(gmu, grho, lam, mu, rho)

grad_lmr_to_vd switch the gradient.

This function switch the gradient from [lambda, mu, rho] (LMD) to [vp, vs, rho] (DV).

Parameters:
  • glam (float) – Gradient w.r.t. lambda

  • gmu – Gradient w.r.t. mu

  • grho (float) – Gradient w.r.t. density

  • lam (float) – Gradient w.r.t. lambda

  • mu (float) – Gradient w.r.t. mu

  • rho (float) – Gradient w.r.t. density

Returns:

  • gvp (float) – Gradient of cost function w.r.t. Vp

  • gvs (float) – Gradient of cost function w.r.t. Vs

  • grho (float) – Gradient of cost function w.r.t. density

vd to lmd

grad_switcher.grad_vd_to_lmd(gvs, grho, vp, vs, rho)

grad_vd_to_lmd grad_vd_to_lmd transder the gradient from DV to LMD

Parameters:
  • gvp (float) – Gradient of cost function w.r.t. Vp

  • gvs (float) – Gradient of cost function w.r.t. Vs

  • grho (float) – Gradient of cost function w.r.t. density

  • vp (float) – P-wave velocity

  • vs (float) – S-wave velocity

  • rho (float) – Density

Returns:

  • glam (float) – Gradient of cost function w.r.t. first Lamé parameter (lambda)

  • gmu (float) – Gradient of cost function w.r.t. second Lamé parameter (mu)

  • grho (float) – Gradient of cost function w.r.t. density

Cost Function

class PyFWI.fwi_tools.CostFunction(cost_function_type='l2')

CostFunction provides different cost functions.

Parameters:

cost_function_type (str, optional) – Type of cost function, by default “l2”

__call__(dest, dobs)

By calling a CostFunction object, the loss is calculated.

Parameters:
  • dest (dict) – Estimated data

  • dobs (dict) – Observed data

Returns:

  • err (scalar float) – Error

  • adj_src (dict) – A dictionary containing adjoint of the residuals

Visualization

Earth model

seiplot.earth_model(keys=[], offset=None, depth=None, **kwargs)

earth_model show the earth model.

This function is provided to show the earth models.

Parameters:
  • model (Dictionary) – A dictionary containing the earth model.

  • keys (list, optional) – List of parameters you want to show. Defaults to [].

Returns:

The figure class to which the images are added for furthur settings like im.set-clim().

Return type:

fig (class)

Seismic Section

seiplot.seismic_section(data, x_axis=None, t_axis=None, aspect_preserving=False, **kargs)

seismic_section show seismic section

Parameters:
  • ax (Axes or array of Axes) – ax to arrange plots

  • data (float) – Seismic section

  • x_axis (array) – X-axis, by default None

  • t_axis (array, optional) – t-axis, by default None

  • aspect_preserving (bool, optional) – _description_, by default False

Returns:

ax – The ax for more adjustment

Return type:

Axis