TensorMesh

class emg3d.meshes.TensorMesh(h, x0)[source]

Bases: discretize.TensorMesh.TensorMesh, emg3d.meshes._TensorMesh

A slightly modified discretize.TensorMesh.

Adds a few attributes (__eq__, copy, to_dict, and from_dict) to the discretize.TensorMesh.

Falls back to a minimal TensorMesh if discretize is not installed. Nothing fancy is possible with the minimal TensorMesh, particularly NO plotting nor nice repr-functions.

Parameters:
h : list of three ndarrays

Cell widths in [x, y, z] directions.

x0 : ndarray of dimension (3, )

Origin (x, y, z).

**Required Properties:**
* **axis_u (Vector3): Vector orientation of u-direction. For more details see the docs for the rotation_matrix property., a 3D Vector of <class ‘float’> with shape (3), Default: X**
* **axis_v (Vector3): Vector orientation of v-direction. For more details see the docs for the rotation_matrix property., a 3D Vector of <class ‘float’> with shape (3), Default: Y**
* **axis_w (Vector3): Vector orientation of w-direction. For more details see the docs for the rotation_matrix property., a 3D Vector of <class ‘float’> with shape (3), Default: Z**
* **h (a list of Array): h is a list containing the cell widths of the tensor mesh in each dimension., a list (each item is a list or numpy array of <class ‘float’> with shape (*)) with length between 0 and 3**
* **reference_system (String): The type of coordinate reference frame. Can take on the values cartesian, cylindrical, or spherical. Abbreviations of these are allowed., a unicode string, Default: cartesian**
* **x0 (Array): origin of the mesh (dim, ), a list or numpy array of <class ‘float’>, <class ‘int’> with shape (*)**

Methods Summary

copy() Return a copy of the TensorMesh.
from_dict(inp) Convert dictionary into TensorMesh instance.
to_dict([copy]) Store the necessary information of the TensorMesh in a dict.

Methods Documentation

copy()[source]

Return a copy of the TensorMesh.

classmethod from_dict(inp)[source]

Convert dictionary into TensorMesh instance.

Parameters:
inp : dict

Dictionary as obtained from TensorMesh.to_dict(). The dictionary needs the keys hx, hy, hz, and x0.

Returns:
obj : TensorMesh instance
to_dict(copy=False)[source]

Store the necessary information of the TensorMesh in a dict.