# Usage¶

`Scalar`

¶

*class*deepwave.Scalar(*v: torch.Tensor*,*grid_spacing: Union[int, float, List[float], torch.Tensor]*,*v_requires_grad: bool = False*)¶A Module wrapper around

`scalar()`

.This is a convenience module that allows you to only specify v and grid_spacing once. They will then be added to the list of arguments passed to

`scalar()`

when you call the forward method.Note that a copy will be made of the provided wavespeed. Gradients will not backpropagate to the initial guess wavespeed that is provided. You can use the module’s v attribute to access the wavespeed.

- Parameters
**v**– A 2D Tensor containing an initial guess of the wavespeed.**grid_spacing**– The spatial grid cell size, specified with a single real number (used for both dimensions) or a List or Tensor of length two (the length in each of the two dimensions).**v_requires_grad**– Optional bool specifying how to set the requires_grad attribute of the wavespeed, and so whether the necessary data should be stored to calculate the gradient with respect to v during backpropagation. Default False.

- forward(
*dt: float*,*source_amplitudes: Optional[torch.Tensor] = None*,*source_locations: Optional[torch.Tensor] = None*,*receiver_locations: Optional[torch.Tensor] = None*,*accuracy: int = 4*,*pml_width: Union[int, List[int]] = 20*,*pml_freq: Optional[float] = None*,*max_vel: Optional[float] = None*,*survey_pad: Optional[Union[int, List[Optional[int]]]] = None*,*wavefield_0: Optional[torch.Tensor] = None*,*wavefield_m1: Optional[torch.Tensor] = None*,*psiy_m1: Optional[torch.Tensor] = None*,*psix_m1: Optional[torch.Tensor] = None*,*zetay_m1: Optional[torch.Tensor] = None*,*zetax_m1: Optional[torch.Tensor] = None*,*origin: Optional[List[int]] = None*,*nt: Optional[int] = None*,*model_gradient_sampling_interval: int = 1*) Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor] ¶ Perform forward propagation/modelling.

The inputs are the same as for

`scalar()`

except that v and grid_spacing do not need to be provided again. See`scalar()`

for a description of the inputs and outputs.

`scalar`

¶

- deepwave.scalar(
*v: torch.Tensor*,*grid_spacing: Union[int, float, List[float], torch.Tensor]*,*dt: float*,*source_amplitudes: Optional[torch.Tensor] = None*,*source_locations: Optional[torch.Tensor] = None*,*receiver_locations: Optional[torch.Tensor] = None*,*accuracy: int = 4*,*pml_width: Union[int, List[int]] = 20*,*pml_freq: Optional[float] = None*,*max_vel: Optional[float] = None*,*survey_pad: Optional[Union[int, List[Optional[int]]]] = None*,*wavefield_0: Optional[torch.Tensor] = None*,*wavefield_m1: Optional[torch.Tensor] = None*,*psiy_m1: Optional[torch.Tensor] = None*,*psix_m1: Optional[torch.Tensor] = None*,*zetay_m1: Optional[torch.Tensor] = None*,*zetax_m1: Optional[torch.Tensor] = None*,*origin: Optional[List[int]] = None*,*nt: Optional[int] = None*,*model_gradient_sampling_interval: int = 1*,*freq_taper_frac: float = 0.0*,*time_pad_frac: float = 0.0*) Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor] ¶ Scalar wave propagation (functional interface).

This function performs forward modelling with the scalar wave equation. The outputs are differentiable with respect to the wavespeed, the source amplitudes, and the initial wavefields.

For computational performance, multiple shots may be propagated simultaneously.

- Parameters
**v**– A 2D Tensor containing the wavespeed model. Unlike the module interface (`Scalar`

), in this functional interface a copy is not made of the model, so gradients will propagate back into the provided Tensor.**grid_spacing**– The spatial grid cell size, specified with a single real number (used for both dimensions) or a List or Tensor of length two (the length in each of the two dimensions).**dt**– A float specifying the time step interval of the input and output (internally a smaller interval may be used in propagation to obey the CFL condition for stability).**source_amplitudes**– A Tensor with dimensions [shot, source, time]. If two shots are being propagated simultaneously, each containing three sources of one hundred time samples, it would have shape [2, 3, 100]. The time length will be the number of time steps in the simulation. Optional. If provided, source_locations must also be specified. If not provided, nt must be specified.**source_locations**– A Tensor with dimensions [shot, source, 2], containing the index in the two spatial dimensions of the cell that each source is located in, relative to the origin of the model. Optional. Must be provided if source_amplitudes is. It should have torch.long (int64) datatype. The location of each source must be unique within the same shot (you cannot have two sources in the same shot that both have location [1, 2], for example).**receiver_locations**– A Tensor with dimensions [shot, receiver, 2], containing the coordinates of the cell containing each receiver. Optional. It should have torch.long (int64) datatype. If not provided, the output receiver_amplitudes Tensor will be empty. If backpropagation will be performed, the location of each receiver must be unique within the same shot.**accuracy**– An int specifying the finite difference order of accuracy. Possible values are 2, 4, 6, and 8, with larger numbers resulting in more accurate results but greater computational cost. Optional, with a default of 4.**pml_width**– An int or list of four ints specifying the width (in number of cells) of the PML that prevents reflections from the edges of the model. If a single integer is provided, that value will be used for all edges. If a list is provided, it should contain the integer values for the edges in the following order: [the beginning of the first dimension, the end of the first dimension, the beginning of the second dimension, the end of the second dimension]. Larger values result in smaller reflections, with values of 10 to 20 being typical. For a reflective or “free” surface, set the value for that edge to be zero. For example, if your model is oriented so that surface that you want to be reflective is the beginning of the second dimension, then you could specify pml_width=[20, 20, 0, 20]. The wavespeed in the PML region is obtained by replicating the values on the edge of the model. Optional, default 20.**pml_freq**– A float specifying the frequency that you wish to use when constructing the PML. This is usually the dominant frequency of the source wavelet. Choosing this value poorly will result in the edges becoming more reflective. Optional, default 25 Hz (assuming dt is in seconds).**max_vel**– A float specifying the maximum velocity, which is used when applying the CFL condition and when constructing the PML. If not specified, the actual maximum absolute wavespeed in the model (or portion of it that is used) will be used. The option to specify this is provided to allow you to ensure consistency between runs even if there are changes in the wavespeed. Optional, default None.**survey_pad**– A single value or list of four values, all of which are either an int or None, specifying whether the simulation domain should be restricted to a region surrounding the sources and receivers. If you have a large model, but the sources and receivers of individual shots only cover a small portion of it (such as in a towed streamer survey), then it may be wasteful to simulate wave propagation over the whole model. This parameter allows you to specify what distance around sources and receivers you would like to extract from the model to use for the simulation. A value of None means that no restriction of the model should be performed in that direction, while an integer value specifies the minimum number of cells that the edge of the simulation domain should be from any source or receiver in that direction (if possible). If a single value is provided, it applies to all directions, so specifying None will use the whole model for every simulation, while specifying 10 will cause the simulation domain to contain at least 10 cells of padding in each direction around sources and receivers if possible. The padding will end if the edge of the model is encountered. Specifying a list, in the following order: [towards the beginning of the first dimension, towards the end of the first dimension, towards the beginning of the second dimension, towards the end of the second dimension] allows the padding in each direction to be controlled. Ints and None may be mixed, so a survey_pad of [5, None, None, 10] means that there should be at least 5 cells of padding towards the beginning of the first dimension, no restriction of the simulation domain towards the end of the first dimension or beginning of the second, and 10 cells of padding towards the end of the second dimension. If the simulation contains one source at [20, 15], one receiver at [10, 15], and the model is of shape [40, 50], then the extracted simulation domain with this value of survey_pad would cover the region [5:40, 0:25]. The same simulation domain will be used for all shots propagated simultaneously, so if this option is used then it is advisable to propagate shots that cover similar regions of the model simultaneously so that it provides a benefit (if the shots cover opposite ends of a dimension, then that whole dimension will be used regardless of what survey_pad value is used). This option is disregarded if any initial wavefields are provided, as those will instead be used to determine the simulation domain. Optional, default None.**wavefield_0**– A Tensor specifying the initial wavefield at time step 0. It should have three dimensions, with the first dimension being shot and the subsequent two corresponding to the two spatial dimensions. The spatial shape should be equal to the simulation domain, which is the extracted model plus the PML. If two shots are being propagated simultaneously in a region of size [20, 30] extracted from the model for the simulation, and pml_width=[1, 2, 3, 4], then wavefield_0 should be of shape [2, 23, 37]. Optional, default all zeros.**wavefield_m1**– A Tensor specifying the initial wavefield at time step -1 (using Deepwave’s internal time step interval, which may be smaller than the user provided one to obey the CFL condition). See the entry for wavefield_0 for more details.**psiy_m1**– Tensor specifying the initial value for this PML-related wavefield at time step -1. See the entry for wavefield_0 for more details.**psix_m1**– Tensor specifying the initial value for this PML-related wavefield at time step -1. See the entry for wavefield_0 for more details.**zetay_m1**– Tensor specifying the initial value for this PML-related wavefield at time step -1. See the entry for wavefield_0 for more details.**zetax_m1**– Tensor specifying the initial value for this PML-related wavefield at time step -1. See the entry for wavefield_0 for more details.**origin**– A list of ints specifying the origin of the provided initial wavefields relative to the origin of the model. Only relevant if initial wavefields are provided. The origin of a wavefield is the cell where the extracted model used for the simulation domain began. It does not include the PML. So if a simulation is performed using the model region [10:20, 15:30], the origin is [10, 15]. Optional, default [0, 0].**nt**– If the source amplitudes are not provided then you must instead specify the number of time steps to run the simulation for by providing an integer for nt. You cannot specify both the source amplitudes and nt.**model_gradient_sampling_interval**– An int specifying the number of time steps between contributions to the model gradient. The gradient with respect to the model is an integral over the backpropagation time steps. The time sampling frequency of this integral should be at least the Nyquist frequency of the source or data (whichever is greater). If this Nyquist frequency is substantially less than 1/dt, you may wish to reduce the sampling frequency of the integral to reduce computational (especially memory) costs. Optional, default 1 (integral is sampled every time step interval dt).**freq_taper_frac**– A float specifying the fraction of the end of the source and receiver amplitudes (if present) in the frequency domain to cosine taper if they are resampled due to the CFL condition. This might be useful to reduce ringing. A value of 0.1 means that the top 10% of frequencies will be tapered. Default 0.0 (no tapering).**time_pad_frac**– A float specifying the amount of zero padding that will be added to the source and receiver amplitudes (if present) before resampling and removed afterwards, if they are resampled due to the CFL condition, as a fraction of their length. This might be useful to reduce wraparound artifacts. A value of 0.1 means that zero padding of 10% of the number of time samples will be used. Default 0.0.

- Returns
- wavefield_nt:
A Tensor containing the wavefield at the final time step.

- wavefield_ntm1:
A Tensor containing the wavefield at the second-to-last time step (using Deepwave’s internal time interval, which may be smaller than the user provided one to obey the CFL condition).

- psiy_ntm1, psix_ntm1, zetay_ntm1, zetax_ntm1:
Tensor containing the wavefield related to the PML at the second-to-last time step.

- receiver_amplitudes:
A Tensor of dimensions [shot, receiver, time] containing the receiver amplitudes recorded at the provided receiver locations. If no receiver locations were specified then this Tensor will be empty.

- Return type
Tuple[Tensor]

`ScalarBorn`

¶

*class*deepwave.ScalarBorn(*v: torch.Tensor*,*scatter: torch.Tensor*,*grid_spacing: Union[int, float, List[float], torch.Tensor]*,*v_requires_grad: bool = False*,*scatter_requires_grad: bool = False*)¶A Module wrapper around

`scalar_born()`

.This is a convenience module that allows you to only specify v, scatter, and grid_spacing once. They will then be added to the list of arguments passed to

`scalar_born()`

when you call the forward method.Note that a copy will be made of the provided v and scatter. Gradients will not backpropagate to the initial guess wavespeed and scattering potential that are provided. You can use the module’s v and scatter attributes to access them.

- Parameters
**v**– A 2D Tensor containing an initial guess of the wavespeed.**scatter**– A 2D Tensor containing an initial guess of the scattering potential.**grid_spacing**– The spatial grid cell size, specified with a single real number (used for both dimensions) or a List or Tensor of length two (the length in each of the two dimensions).**v_requires_grad**– Optional bool specifying how to set the requires_grad attribute of the wavespeed, and so whether the necessary data should be stored to calculate the gradient with respect to v during backpropagation. Default False.**scatter_requires_grad**– Similar, for the scattering potential.

- forward(
*dt: float*,*source_amplitudes: Optional[torch.Tensor] = None*,*source_locations: Optional[torch.Tensor] = None*,*receiver_locations: Optional[torch.Tensor] = None*,*accuracy: int = 4*,*pml_width: Union[int, List[int]] = 20*,*pml_freq: Optional[float] = None*,*max_vel: Optional[float] = None*,*survey_pad: Optional[Union[int, List[Optional[int]]]] = None*,*wavefield_0: Optional[torch.Tensor] = None*,*wavefield_m1: Optional[torch.Tensor] = None*,*psiy_m1: Optional[torch.Tensor] = None*,*psix_m1: Optional[torch.Tensor] = None*,*zetay_m1: Optional[torch.Tensor] = None*,*zetax_m1: Optional[torch.Tensor] = None*,*wavefield_sc_0: Optional[torch.Tensor] = None*,*wavefield_sc_m1: Optional[torch.Tensor] = None*,*psiy_sc_m1: Optional[torch.Tensor] = None*,*psix_sc_m1: Optional[torch.Tensor] = None*,*zetay_sc_m1: Optional[torch.Tensor] = None*,*zetax_sc_m1: Optional[torch.Tensor] = None*,*origin: Optional[List[int]] = None*,*nt: Optional[int] = None*,*model_gradient_sampling_interval: int = 1*) Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor] ¶ Perform forward propagation/modelling.

The inputs are the same as for

`scalar_born()`

except that v, scatter, and grid_spacing do not need to be provided again. See`scalar_born()`

for a description of the inputs and outputs.

`scalar_born`

¶

- deepwave.scalar_born(
*v: torch.Tensor*,*scatter: torch.Tensor*,*grid_spacing: Union[int, float, List[float], torch.Tensor]*,*dt: float*,*source_amplitudes: Optional[torch.Tensor] = None*,*source_locations: Optional[torch.Tensor] = None*,*receiver_locations: Optional[torch.Tensor] = None*,*accuracy: int = 4*,*pml_width: Union[int, List[int]] = 20*,*pml_freq: Optional[float] = None*,*max_vel: Optional[float] = None*,*survey_pad: Optional[Union[int, List[Optional[int]]]] = None*,*wavefield_0: Optional[torch.Tensor] = None*,*wavefield_m1: Optional[torch.Tensor] = None*,*psiy_m1: Optional[torch.Tensor] = None*,*psix_m1: Optional[torch.Tensor] = None*,*zetay_m1: Optional[torch.Tensor] = None*,*zetax_m1: Optional[torch.Tensor] = None*,*wavefield_sc_0: Optional[torch.Tensor] = None*,*wavefield_sc_m1: Optional[torch.Tensor] = None*,*psiy_sc_m1: Optional[torch.Tensor] = None*,*psix_sc_m1: Optional[torch.Tensor] = None*,*zetay_sc_m1: Optional[torch.Tensor] = None*,*zetax_sc_m1: Optional[torch.Tensor] = None*,*origin: Optional[List[int]] = None*,*nt: Optional[int] = None*,*model_gradient_sampling_interval: int = 1*,*freq_taper_frac: float = 0.0*,*time_pad_frac: float = 0.0*) Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor] ¶ Scalar Born wave propagation (functional interface).

This function performs Born forward modelling with the scalar wave equation. The outputs are differentiable with respect to the wavespeed, the scattering potential, the source amplitudes, and the initial wavefields.

For computational performance, multiple shots may be propagated simultaneously.

Most arguments and returns are the same as those of

`scalar()`

, so only those that are different will be described here.- Parameters
**scatter**– A 2D Tensor containing an initial guess of the scattering potential. Unlike the module interface (`ScalarBorn`

), in this functional interface a copy is not made of the model, so gradients will propagate back into the provided Tensor.**wavefield_sc_0**– The equivalent of wavefield_0, etc., for the scattered wavefield.**wavefield_sc_m1**– The equivalent of wavefield_0, etc., for the scattered wavefield.**psiy_sc_m1**– The equivalent of psiy_m1, etc., for the scattered wavefield.**psix_sc_m1**– The equivalent of psiy_m1, etc., for the scattered wavefield.**zetay_sc_m1**– The equivalent of psiy_m1, etc., for the scattered wavefield.**zetax_sc_m1**– The equivalent of psiy_m1, etc., for the scattered wavefield.

- Returns
- wavefield_nt:
A Tensor containing the non-scattered wavefield at the final time step.

- wavefield_ntm1:
A Tensor containing the non-scattered wavefield at the second-to-last time step.

- psiy_ntm1, psix_ntm1, zetay_ntm1, zetax_ntm1:
Tensor containing the wavefield related to the PML at the second-to-last time step for the non-scattered wavefield.

- wavefield_sc_nt, wavefield_sc_ntm1:
Tensor containing the scattered wavefield.

- psiy_sc_ntm1, psix_sc_ntm1, zetay_sc_ntm1, zetax_sc_ntm1:
Tensor containing the wavefield related to the scattered wavefield PML.

- receiver_amplitudes:
A Tensor of dimensions [shot, receiver, time] containing the receiver amplitudes recorded at the provided receiver locations, extracted from the scattered wavefield. If no receiver locations were specified then this Tensor will be empty.

- Return type
Tuple[Tensor]

`common.cosine_taper_end`

¶

- deepwave.common.cosine_taper_end(
*signal: torch.Tensor*,*n_taper: int*) torch.Tensor ¶ Tapers the end of the final dimension of a Tensor using a cosine.

A half period, shifted and scaled to taper from 1 to 0, is used.

- Parameters
**signal**– The Tensor that will have its final dimension tapered.**n_taper**– The length of the cosine taper, in number of samples.

- Returns
The tapered signal.

`common.upsample`

¶

- deepwave.common.upsample(
*signal: torch.Tensor*,*step_ratio: int*,*freq_taper_frac: float = 0.0*,*time_pad_frac: float = 0.0*) torch.Tensor ¶ Upsamples the final dimension of a Tensor by a factor.

Low-pass upsampling is used to produce an upsampled signal without introducing higher frequencies than were present in the input. The Nyquist frequency of the input will be zeroed.

- Parameters
**signal**– The Tensor that will have its final dimension upsampled.**step_ratio**– The integer factor by which the signal will be upsampled. The input signal is returned if this is 1 (freq_taper_frac and time_pad_frac will be ignored).**freq_taper_frac**– A float specifying the fraction of the end of the signal amplitude in the frequency domain to cosine taper. This might be useful to reduce ringing. A value of 0.1 means that the top 10% of frequencies will be tapered before upsampling. Default 0.0 (no tapering).**time_pad_frac**– A float specifying the amount of zero padding that will be added to the signal before upsampling and removed afterwards, as a fraction of the length of the final dimension of the input signal. This might be useful to reduce wraparound artifacts. A value of 0.1 means that zero padding of 10% of the length of the signal will be used. Default 0.0.

- Returns
The signal after upsampling.

`common.downsample`

¶

- deepwave.common.downsample(
*signal: torch.Tensor*,*step_ratio: int*,*freq_taper_frac: float = 0.0*,*time_pad_frac: float = 0.0*) torch.Tensor ¶ Downsamples the final dimension of a Tensor by a factor.

Frequencies higher than or equal to the Nyquist frequency of the downsampled signal will be zeroed before downsampling.

- Parameters
**signal**– The Tensor that will have its final dimension downsampled.**step_ratio**– The integer factor by which the signal will be downsampled. The input signal is returned if this is 1 (freq_taper_frac and time_pad_frac will be ignored).**freq_taper_frac**– A float specifying the fraction of the end of the signal amplitude in the frequency domain to cosine taper. This might be useful to reduce ringing. A value of 0.1 means that the top 10% of frequencies will be tapered after downsampling. Default 0.0 (no tapering).**time_pad_frac**– A float specifying the amount of zero padding that will be added to the signal before downsampling and removed afterwards, as a fraction of the length of the final dimension of the output signal. This might be useful to reduce wraparound artifacts. A value of 0.1 means that zero padding of 10% of the length of the output signal will be used. Default 0.0.

- Returns
The signal after downsampling.

`common.cfl_condition`

¶

- deepwave.common.cfl_condition(
*dy: float*,*dx: float*,*dt: float*,*max_vel: float*,*eps: float = 1e-15*) Tuple[float, int] ¶ Calculates the time step interval to obey the CFL condition.

The output time step will be a factor of the input time step.

- Parameters
**dy**– The grid spacing in the first dimension.**dx**– The grid spacing in the second dimension.**dt**– The time step interval.**max_vel**– The maximum wave speed in the model.**eps**– A small quantity to prevent division by zero. Default 1e-15.

- Returns
- inner_dt:
A time step interval that obeys the CFL condition.

- step_ratio:
The integer dt / inner_dt.

- Return type
Tuple[float, int]

`location_interpolation.Hicks`

¶

*class*deepwave.location_interpolation.Hicks(*locations: torch.Tensor*,*halfwidth: int = 4*,*free_surfaces: Optional[List[bool]] = None*,*model_shape: Optional[List[int]] = None*,*monopole: Union[torch.Tensor, bool] = True*,*dipole_dim: Union[torch.Tensor, int] = 0*,*dtype: torch.dtype = torch.float32*,*eps: float = 1e-05*)¶Location interpolation onto grid using method of Hicks

Hicks (2002, https://doi.org/10.1190/1.1451454) proposed using a Kaiser windowed sinc function to interpolate source and receiver locations onto a grid when they are not centred on a grid point. This class implements this approach. It can also be used to create dipole sources and receivers.

- Parameters
**locations**– A three dimensional Tensor [shot, per_shot, 2] specifying the locations to interpolate, provided as float values in units of cells relative to the origin of the grid, so [[[0.5, 0.5]]] corresponds to the point half a cell from the origin in both dimensions.**halfwidth**– An integer specifying the halfwidth of the window that will be used to interpolate each point onto the grid. A halfwidth of 4 (the default) means that an 8x8 window will be used. Possible values are in [1, 10].**free_surfaces**– A list of four booleans specifying whether the corresponding edge of the grid is a free surface, in the order [beginning of first dimension, end of first dimension, beginning of second dimension, end of second dimension]. [True, False, False, True] therefore means that the beginning of the first dimension and end of the second dimension are free surfaces, while the other two edges are not, for example. The default is for no edges to be free surfaces.**model_shape**– A list of two integers specifying the size of the grid. This is only used when the model contains free surfaces.**monopole**– A boolean or Tensor of booleans (of shape [shot, per_shot]) specifying whether the source/receiver is a monopole. If False, the point will be a dipole. Default True.**dipole_dim**– An integer or Tensor of integers (of shape [shot, per_shot]) of value 0 or 1 specifying the dimension in which the dipole is oriented. This is only used for points that are dipoles (not monopoles). Default 0.**dtype**– The datatype to use. Default torch.float.**eps**– A small value to prevent division by zero. Points closer to a grid cell centre than this will be rounded to the grid cell. Default 1e-5.

- get_locations(
*shot_idxs: Optional[torch.Tensor] = None*) torch.Tensor ¶ Get the interpolated locations.

The interpolated locations can be provided to a Deepwave propagator as the source or receiver locations.

- Parameters
**shot_idxs**– A 1D Tensor containing the indices of the shots that amplitudes are being provided for, within the locations provided at initialisation. This is useful if shots are being used in batches, so only some of the shots are needed now. Default (None) means all shots.- Returns
A Tensor containing the interpolated locations.

- receiver(
*amplitudes: torch.Tensor*,*shot_idxs: Optional[torch.Tensor] = None*) torch.Tensor ¶ Convert receiver amplitudes from interpolated to original locations.

- Parameters
**amplitudes**– A Tensor containing the amplitudes recorded at interpolated receiver locations.**shot_idxs**– A 1D Tensor containing the indices of the shots that amplitudes are being provided for, within the locations provided at initialisation. This is useful if shots are being used in batches, so only some of the shots are needed now. Default (None) means all shots.

- Returns
The amplitudes of receivers at the original locations.

- source(
*amplitudes: torch.Tensor*,*shot_idxs: Optional[torch.Tensor] = None*) torch.Tensor ¶ Calculate the amplitudes of the interpolated sources.

- Parameters
**amplitudes**– A Tensor containing the amplitudes of the sources at the original locations.**shot_idxs**– A 1D Tensor containing the indices of the shots that amplitudes are being provided for, within the locations provided at initialisation. This is useful if shots are being used in batches, so only some of the shots are needed now. Default (None) means all shots.

- Returns
The amplitudes of the interpolated sources, ready to be provided to a Deepwave propagator.

`wavelets.ricker`

¶

- deepwave.wavelets.ricker(
*freq: float*,*length: int*,*dt: float*,*peak_time: float*,*dtype: Optional[torch.dtype] = None*) torch.Tensor ¶ Return a Ricker wavelet with the specified central frequency.

- Parameters
**freq**– A float specifying the central frequency**length**– An int specifying the number of time samples**dt**– A float specifying the time sample spacing**peak_time**– A float specifying the time (in secs) of the peak amplitude**dtype**– The PyTorch datatype to use. Optional, defaults to PyTorch’s default (float32).