ADFWI.fwi.regularization

ADFWI.fwi.regularization.base

class ADFWI.fwi.regularization.base.Regularization(nx: int, nz: int, dx: float, dz: float, alphax: float, alphaz: float, step_size: int | None = 1000, gamma: int | None = 1, device='cpu', dtype=torch.float32)[source]

Bases: object

A base class for applying regularization on a grid with grid spacing in the x and z directions.

Parameters:
  • nx (int) – Number of grid points in the x-direction.

  • nz (int) – Number of grid points in the z-direction.

  • dx (float) – Grid size in the x-direction (m).

  • dz (float) – Grid size in the z-direction (m).

  • alphax (float) – The regularization factor in the x-direction.

  • alphaz (float) – The regularization factor in the z-direction.

  • step_size (int, optional) – The update step for alphax and alphaz. Default is 1000.

  • gamma (float, optional) – The update step decay factor. Default is 1.

  • device (str, optional) – The device to use (‘cpu’ or ‘cuda’). Default is ‘cpu’.

  • dtype (torch.dtype, optional) – The data type for the tensors. Default is torch.float32.

abstract forward()[source]

Abstract method to compute the forward pass for regularization.

This method must be implemented in subclasses.

Returns:

The regularized output.

Return type:

torch.Tensor

ADFWI.fwi.regularization.base.regular_StepLR(iter, step_size, alpha, gamma=0.8)[source]

Regular learning rate scheduler using exponential decay.

Parameters:
  • iter (int) – The current iteration.

  • step_size (int) – The step size for updating the learning rate.

  • alpha (float) – The initial learning rate.

  • gamma (float, optional) – The decay factor for the learning rate. Default is 0.8.

Returns:

The updated learning rate.

Return type:

float

ADFWI.fwi.regularization.tikhonov_1order

class ADFWI.fwi.regularization.tikhonov_1order.Tikhonov_1order(nx, nz, dx, dz, alphax=0, alphaz=0, step_size=1000, gamma=1, device='cpu', dtype=torch.float32)[source]

Bases: Regularization

1-Order Tikhonov Regularization.

The regularization function is defined as: [ lpha_x | L_1 m_x |_p + lpha_z | L_1 m_z |_p ] Where ( L_1 ) is the finite difference operator for the grid and ( m_x ), ( m_z ) are the model components in the horizontal and vertical directions, respectively.

References

Du, Z., et al., 2021. A high-order total-variation regularisation method for full-waveform inversion. Journal of Geophysics and Engineering, 18, 241–252. doi:10.1093/jge/gxab010

Parameters:
  • nx (int) – Number of grid points in the x-direction.

  • nz (int) – Number of grid points in the z-direction.

  • dx (float) – Grid size in the x-direction (m).

  • dz (float) – Grid size in the z-direction (m).

  • alphax (float, optional) – Regularization factor for the x-direction. Default is 0.

  • alphaz (float, optional) – Regularization factor for the z-direction. Default is 0.

  • step_size (int, optional) – Step size for updating the regularization parameters. Default is 1000.

  • gamma (float, optional) – Decay factor for regularization parameter updates. Default is 1.

  • device (str, optional) – Device to use for computation (‘cpu’ or ‘cuda’). Default is ‘cpu’.

  • dtype (torch.dtype, optional) – The data type of the tensors. Default is torch.float32.

forward(m)[source]

Compute the regularized misfit for the given model.

Parameters:

m (torch.Tensor) – The model tensor to apply regularization on.

Returns:

The regularized misfit value.

Return type:

torch.Tensor

ADFWI.fwi.regularization.tikhonov_2order

class ADFWI.fwi.regularization.tikhonov_2order.Tikhonov_2order(nx, nz, dx, dz, alphax=0, alphaz=0, step_size=1000, gamma=1, device='cpu', dtype=torch.float32)[source]

Bases: Regularization

2nd-Order Tikhonov Regularization.

The regularization function is defined as: [ | lpha_x L_2 m_x + lpha_z L_2 m_z |_2 ] Where ( L_2 ) is the second-order finite difference operator for the grid, and ( m_x ), ( m_z ) are the model components in the horizontal and vertical directions, respectively.

References

Du, Z., et al., 2021. A high-order total-variation regularisation method for full-waveform inversion. Journal of Geophysics and Engineering, 18, 241–252. doi:10.1093/jge/gxab010

Parameters:
  • nx (int) – Number of grid points in the x-direction.

  • nz (int) – Number of grid points in the z-direction.

  • dx (float) – Grid size in the x-direction (m).

  • dz (float) – Grid size in the z-direction (m).

  • alphax (float, optional) – Regularization factor for the x-direction. Default is 0.

  • alphaz (float, optional) – Regularization factor for the z-direction. Default is 0.

  • step_size (int, optional) – Step size for updating the regularization parameters. Default is 1000.

  • gamma (float, optional) – Decay factor for regularization parameter updates. Default is 1.

  • device (str, optional) – Device to use for computation (‘cpu’ or ‘cuda’). Default is ‘cpu’.

  • dtype (torch.dtype, optional) – The data type of the tensors. Default is torch.float32.

forward(m)[source]

Compute the regularized misfit for the given model.

Parameters:

m (torch.Tensor) – The model tensor to apply regularization on.

Returns:

The regularized misfit value.

Return type:

torch.Tensor

ADFWI.fwi.regularization.tv_1order

class ADFWI.fwi.regularization.tv_1order.TV_1order(nx, nz, dx, dz, alphax=0, alphaz=0, step_size=1000, gamma=1, device='cpu', dtype=torch.float32)[source]

Bases: Regularization

1st-Order Total Variation Regularization.

The regularization function is defined as: [ lpha_x | L_1 m_x |_p + lpha_z | L_1 m_z |_p ] Where ( L_1 ) is the first-order finite difference operator for the grid, and ( m_x ), ( m_z ) are the model components in the horizontal and vertical directions, respectively.

References

Du, Z., et al., 2021. A high-order total-variation regularisation method for full-waveform inversion. Journal of Geophysics and Engineering, 18, 241–252. doi:10.1093/jge/gxab010

Parameters:
  • nx (int) – Number of grid points in the x-direction.

  • nz (int) – Number of grid points in the z-direction.

  • dx (float) – Grid size in the x-direction (m).

  • dz (float) – Grid size in the z-direction (m).

  • alphax (float, optional) – Regularization factor for the x-direction. Default is 0.

  • alphaz (float, optional) – Regularization factor for the z-direction. Default is 0.

  • step_size (int, optional) – Step size for updating the regularization parameters. Default is 1000.

  • gamma (float, optional) – Decay factor for regularization parameter updates. Default is 1.

  • device (str, optional) – Device to use for computation (‘cpu’ or ‘cuda’). Default is ‘cpu’.

  • dtype (torch.dtype, optional) – The data type of the tensors. Default is torch.float32.

forward(m)[source]

Compute the regularized misfit for the given model.

Parameters:

m (torch.Tensor) – The model tensor to apply regularization on.

Returns:

The regularized misfit value.

Return type:

torch.Tensor

ADFWI.fwi.regularization.tv_2order

class ADFWI.fwi.regularization.tv_2order.TV_2order(nx, nz, dx, dz, alphax=0, alphaz=0, step_size=1000, gamma=1, device='cpu', dtype=torch.float32)[source]

Bases: Regularization

2nd-Order Total Variation Regularization.

The regularization function is defined as: [ lpha_x | L_1 m_x |_2 + lpha_z | L_1 m_z |_2 ] Where ( L_1 ) is the second-order finite difference operator for the grid, and ( m_x ), ( m_z ) are the model components in the horizontal and vertical directions, respectively.

References

Du, Z., et al., 2021. A high-order total-variation regularisation method for full-waveform inversion. Journal of Geophysics and Engineering, 18, 241–252. doi:10.1093/jge/gxab010

Parameters:
  • nx (int) – Number of grid points in the x-direction.

  • nz (int) – Number of grid points in the z-direction.

  • dx (float) – Grid size in the x-direction (m).

  • dz (float) – Grid size in the z-direction (m).

  • alphax (float, optional) – Regularization factor for the x-direction. Default is 0.

  • alphaz (float, optional) – Regularization factor for the z-direction. Default is 0.

  • step_size (int, optional) – Step size for updating the regularization parameters. Default is 1000.

  • gamma (float, optional) – Decay factor for regularization parameter updates. Default is 1.

  • device (str, optional) – Device to use for computation (‘cpu’ or ‘cuda’). Default is ‘cpu’.

  • dtype (torch.dtype, optional) – The data type of the tensors. Default is torch.float32.

forward(m)[source]

Compute the regularized misfit for the given model.

Parameters:

m (torch.Tensor) – The model tensor to apply regularization on.

Returns:

The regularized misfit value.

Return type:

torch.Tensor