EMArray

class emg3d.utils.EMArray[source]

Bases: numpy.ndarray

Create an EM-ndarray: add amplitude <amp> and phase <pha> methods.

Parameters:
data : array

Data to which to add .amp and .pha attributes.

Examples

>>> import numpy as np
>>> from empymod.utils import EMArray
>>> emvalues = EMArray(np.array([1+1j, 1-4j, -1+2j]))
>>> print(f"Amplitude         : {emvalues.amp()}")
Amplitude         : [1.41421356 4.12310563 2.23606798]
>>> print(f"Phase (rad)       : {emvalues.pha()}")
Phase (rad)       : [ 0.78539816 -1.32581766 -4.24874137]
>>> print(f"Phase (deg)       : {emvalues.pha(deg=True)}")
Phase (deg)       : [  45.          -75.96375653 -243.43494882]
>>> print(f"Phase (deg; lead) : {emvalues.pha(deg=True, lag=False)}")
Phase (deg; lead) : [-45.          75.96375653 243.43494882]

Methods Summary

amp() Amplitude of the electromagnetic field.
pha([deg, unwrap, lag]) Phase of the electromagnetic field.

Methods Documentation

amp()[source]

Amplitude of the electromagnetic field.

pha(deg=False, unwrap=True, lag=True)[source]

Phase of the electromagnetic field.

Parameters:
deg : bool

If True the returned phase is in degrees, else in radians. Default is False (radians).

unwrap : bool

If True the returned phase is unwrapped. Default is True (unwrapped).

lag : bool

If True the returned phase is lag, else lead defined. Default is True (lag defined).