simpeg.utils.distance_weighting#
- simpeg.utils.distance_weighting(mesh, reference_locs, active_cells=None, exponent=2.0, threshold=None, engine='numba', cdist_opts=None)[source]#
- Construct diagonal elements of a distance weighting matrix - Builds the model weights following the distance weighting strategy, a method to generate weights based on the distance between mesh cell centers and some reference location(s). Use these weights in regularizations to counteract the natural decay of potential field data with distance. - Parameters:
- meshdiscretize.base.BaseMesh
- Discretized model space. 
- reference_locs(n,ndim)numpy.ndarray
- The coordinate of the reference location, usually the receiver locations, for the distance weighting. A 2d array, with multiple reference locations, where each row should contain the coordinates of a single location point in the following order: _x_, _y_, _z_ (for 3D meshes) or _x_, _z_ (for 2D meshes). 
- active_cells(mesh.n_cells)numpy.ndarrayofbool,optional
- Index vector for the active cells on the mesh. If - None, every cell will be assumed to be active.
- exponentfloatorNone,optional
- Exponent parameter for distance weighting. The exponent should match the natural decay power of the potential field. For example, for gravity acceleration, set it to 2; for magnetic fields, to 3. 
- thresholdfloatorNone,optional
- Threshold parameters used in the distance weighting. If - None, it will be set to half of the smallest cell width.
- engine: str, ‘numba’ or ‘scipy’
- Pick between a - scipy.spatial.distance.cdistcomputation (memory intensive) or for loop implementation, parallelized with numba if available. Default to- "numba".
- cdist_opts: dict, optional
- Only valid with - engine=="scipy". Options to pass to- scipy.spatial.distance.cdist. Default to None.
 
- mesh
- Returns:
- (n_active)numpy.ndarray
- Normalized distance weights for the mesh at every active cell as a 1d-array. 
 
- (
 
