EMArray

class emg3d.utils.EMArray(data)[source]

Bases: numpy.ndarray

An EM-ndarray adds the methods amp (amplitude) and pha (phase).

Parameters
datandarray

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

Examples

In [1]: import numpy as np
   ...: from empymod.utils import EMArray
   ...: emvalues = EMArray(np.array([1+1j, 1-4j, -1+2j]))
   ...: 

# Amplitudes
In [2]: emvalues.amp()
Out[2]: EMArray([1.41421356, 4.12310563, 2.23606798])

# Phase in radians
In [3]: emvalues.pha()
Out[3]: EMArray([ 0.78539816, -1.32581766, -4.24874137])

# Phase in degrees
In [4]: emvalues.pha(deg=True)
Out[4]: EMArray([  45.        ,  -75.96375653, -243.43494882])

# Phase in degrees, lead defined
In [5]: emvalues.pha(deg=True, lag=False)
Out[5]: EMArray([-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
degbool, default: False

The returned phase is in degrees if True, else in radians.

unwrapbool, default: True

The returned phase is unwrapped if True.

lagbool, default: True

The returned phase is lag defined if True, else lead defined.