get_receiver

emg3d.fields.get_receiver(grid, values, coordinates, method='cubic', extrapolate=False)[source]

Return values corresponding to grid at coordinates.

Works for electric fields as well as magnetic fields obtained with get_h_field(), and for model parameters.

Note that in order to avoid boundary effects the first and last value in each direction is neglected. Values for coordinates outside of the grid are set to NaN’s, unless extrapolate is set.

Parameters:
grid : emg3d.meshes.TensorMesh

The model grid.

values : ndarray

Field instance, or a particular field (e.g. field.fx); Model parameters.

coordinates : tuple (x, y, z)

Coordinates (x, y, z) where to interpolate values; e.g. receiver locations.

method : str, optional

The method of interpolation to perform, ‘linear’ or ‘cubic’. Default is ‘cubic’ (forced to ‘linear’ if there are less than 3 points in any direction).

extrapolate : bool

If True, points on new_grid which are outside of grid are filled by the nearest value (if method='cubic') or by extrapolation (if method='linear'). If False, points outside are set to NaN’s.

Default is False.

Returns:
new_values : ndarray or utils.EMArray

Values at coordinates.

If input was a field it returns an EMArray, which is a subclassed ndarray with .pha and .amp attributes.

If input was an entire Field instance, output is a tuple (fx, fy, fz).

See also

grid2grid
Interpolation of model parameters or fields to a new grid.
get_receiver_response
Get response for arbitrarily rotated receivers.