- class watex.externals.z.ResPhase(z_array=None, z_err_array=None, freq=None, **kwargs)[source]#
Bases:
objectresistivity and phase class - generates Resistivity and phase tensors object.
- compute_resistivity_phase(z_array=None, z_err_array=None, freq=None)[source]#
compute resistivity and phase from z and z_err
- property phase#
- property phase_det#
- property phase_det_err#
- property phase_err#
- property phase_err_xx#
- property phase_err_xy#
- property phase_err_yx#
- property phase_err_yy#
- property phase_xx#
- property phase_xy#
- property phase_yx#
- property phase_yy#
- property res_det#
- property res_det_err#
- property res_err_xx#
- property res_err_xy#
- property res_err_yx#
- property res_err_yy#
- property res_xx#
- property res_xy#
- property res_yx#
- property res_yy#
- property resistivity#
- property resistivity_err#
- set_res_phase(res_array, phase_array, freq, res_err_array=None, phase_err_array=None)[source]#
Set values for resistivity (res - in Ohm m) and phase (phase - in degrees), including error propagation.
- Parameters
res_array (np.ndarray(num_freq, 2, 2)) – resistivity array in Ohm-m
phase_array (n_loggeingp.ndarray(num_freq, 2, 2)) – phase array in degrees
freq (np.ndarray(num_freq)) – frequency array in Hz
res_err_array (np.ndarray(num_freq, 2, 2)) – resistivity error array in Ohm-m
phase_err_array (np.ndarray(num_freq, 2, 2)) – phase error array in degrees
- class watex.externals.z.Z(z_array=None, z_err_array=None, freq=None)[source]#
Bases:
ResPhaseZ class - generates an impedance tensor (Z) object.
Z is a np.complex128 array of the form (n_freq, 2, 2), with indices in the following order:
Zxx: (0,0)
Zxy: (0,1)
Zyx: (1,0)
Zyy: (1,1)
All errors are given as standard deviations (sqrt(VAR))
- Parameters
z_array (numpy.ndarray(n_freq, 2, 2)) – array containing np.complex128 impedance values
z_err_array (numpy.ndarray(n_freq, 2, 2)) – array containing error values (standard deviation) of impedance tensor elements
freq (np.ndarray(n_freq)) – array of frequency values corresponding to impedance tensor elements.
Attributes
Description
freq
array of frequencies corresponding to elements of z
rotation_angle
angle of which data is rotated by
z
impedance tensor
z_err
estimated errors of impedance tensor
resistivity
apparent resisitivity estimated from z in Ohm-m
resistivity_err
apparent resisitivity error
phase
impedance phase (deg)
phase_err
error in impedance phase
Methods
Description
det
calculates determinant of z with errors
invariants
calculates the invariants of z
inverse
calculates the inverse of z
remove_distortion
removes distortion given a distortion matrix
remove_ss
removes static shift by assumin Z = S * Z_0
norm
calculates the norm of Z
only1d
zeros diagonal components and computes the absolute valued mean of the off-diagonal components.
only2d
zeros diagonal components
res_phase
computes resistivity and phase
rotate
rotates z positive clockwise, angle assumes North is 0.
set_res_phase
recalculates z and z_err, needs attribute freq
skew
calculates the invariant skew (off diagonal trace)
trace
calculates the trace of z
- Example
>>> import mtpy.core.z as mtz >>> import numpy as np >>> z_test = np.array([[0+0j, 1+1j], [-1-1j, 0+0j]]) >>> z_object = mtz.Z(z_array=z_test, freq=[1]) >>> z_object.rotate(45) >>> z_object.resistivity
- property det#
Return the determinant of Z
- Returns
det_Z
- Return type
np.ndarray(nfreq)
- property det_err#
Return the determinant of Z error
- Returns
det_Z_err
- Return type
np.ndarray(nfreq)
- property freq#
Frequencies for each impedance tensor element
Units are Hz.
- property invariants#
Return a dictionary of Z-invariants.
- property inverse#
Return the inverse of Z.
(no error propagation included yet)
- property norm#
Return the 2-/Frobenius-norm of Z
- Returns
norm
- Return type
np.ndarray(nfreq)
- property norm_err#
Return the 2-/Frobenius-norm of Z error
- Returns
norm_err
- Return type
np.ndarray(nfreq)
- property only_1d#
Return Z in 1D form.
If Z is not 1D per se, the diagonal elements are set to zero, the off-diagonal elements keep their signs, but their absolute is set to the mean of the original Z off-diagonal absolutes.
- property only_2d#
Return Z in 2D form.
If Z is not 2D per se, the diagonal elements are set to zero.
- remove_distortion(distortion_tensor, distortion_err_tensor=None)[source]#
Remove distortion D form an observed impedance tensor Z to obtain the uperturbed “correct” Z0: Z = D * Z0
Propagation of errors/uncertainties included
- Parameters
distortion_tensor (np.ndarray(2, 2, dtype=real)) – real distortion tensor as a 2x2
distortion_err_tensor – default is None
- Return type
np.ndarray(2, 2, dtype=’real’)
- returns
impedance tensor with distorion removed
- Return type
np.ndarray(num_freq, 2, 2, dtype=’np.complex128’)
- returns
impedance tensor error after distortion is removed
- Return type
np.ndarray(num_freq, 2, 2, dtype=’np.complex128’)
- Example
>>> import mtpy.core.z as mtz >>> distortion = np.array([[1.2, .5],[.35, 2.1]]) >>> d, new_z, new_z_err = z_obj.remove_distortion(distortion)
- remove_ss(reduce_res_factor_x=1.0, reduce_res_factor_y=1.0)[source]#
Remove the static shift by providing the respective correction factors for the resistivity in the x and y components. (Factors can be determined by using the “Analysis” module for the impedance tensor)
Assume the original observed tensor Z is built by a static shift S and an unperturbated “correct” Z0 :
Z = S * Z0
- therefore the correct Z will be :
Z0 = S^(-1) * Z
- Parameters
reduce_res_factor_x (float or iterable list or array) – static shift factor to be applied to x components (ie z[:, 0, :]). This is assumed to be in resistivity scale
reduce_res_factor_y (float or iterable list or array) – static shift factor to be applied to y components (ie z[:, 1, :]). This is assumed to be in resistivity scale
- Returns
static shift matrix,
- Return type
np.ndarray ((2, 2))
- Returns
corrected Z
- Return type
mtpy.core.z.Z
Note
The factors are in resistivity scale, so the entries of the matrix “S” need to be given by their square-roots!
- rotate(alpha)[source]#
Rotate Z array by angle alpha.
Rotation angle must be given in degrees. All angles are referenced to geographic North, positive in clockwise direction. (Mathematically negative!)
In non-rotated state, X refs to North and Y to East direction.
- Updates the attributes
z
z_err
zrot
resistivity
phase
resistivity_err
phase_err
- property skew#
Returns the skew of Z as defined by Z[0, 1] + Z[1, 0]
Note
This is not the MT skew, but simply the linear algebra skew
- Returns
skew
- Return type
np.ndarray(nfreq, 2, 2)
- property skew_err#
Returns the skew error of Z as defined by Z_err[0, 1] + Z_err[1, 0]
Note
This is not the MT skew, but simply the linear algebra skew
- Returns
skew_err
- Return type
np.ndarray(nfreq, 2, 2)
- property trace#
Return the trace of Z
- Returns
Trace(z)
- Return type
np.ndarray(nfreq, 2, 2)
- property trace_err#
Return the trace of Z
- Returns
Trace(z)
- Return type
np.ndarray(nfreq, 2, 2)
- property z#
Impedance tensor
np.ndarray(nfreq, 2, 2)
- property z_err#