watex.externals.zutils.centre_point(xarray, yarray)[source]#

get the centre point of arrays of x and y values

watex.externals.zutils.compute_determinant_error(z_array, z_err_array, method='theoretical', repeats=1000)[source]#

compute the error of the determinant of z using a stochastic method seed random z arrays with a normal distribution around the input array

Parameters:
  • z_array – z (impedance) array containing real and imaginary values

  • z_err_array – impedance error array containing real values, in MT we assume the real and imag errors are the same

  • method – method to use, theoretical calculation or stochastic

Returns:

error: array of real values with same shape as z_err_array representing the error in the determinant of Z

Returns:

error_sqrt: array of real values with same shape as z_err_array representing the error in the (determinant of Z)**0.5

watex.externals.zutils.get_period_list(period_min, period_max, periods_per_decade, include_outside_range=True)[source]#

get a list of values (e.g. periods), evenly spaced in log space and including values on multiples of 10

Returns:

numpy array containing list of values

Inputs:

period_min = minimum period period_max = maximum period periods_per_decade = number of periods per decade include_outside_range = option whether to start and finish the period

list just inside or just outside the bounds specified by period_min and period_max default True

watex.externals.zutils.invertmatrix_incl_errors(inmatrix, inmatrix_err=None)[source]#

Invert matrices with inclinaison errors

watex.externals.zutils.make_log_increasing_array(z1_layer, target_depth, n_layers, increment_factor=0.999)[source]#

create depth array with log increasing cells, down to target depth, inputs are z1_layer thickness, target depth, number of layers (n_layers)

watex.externals.zutils.multiplymatrices_incl_errors(inmatrix1, inmatrix2, inmatrix1_err=None, inmatrix2_err=None)[source]#

multiplies matrices including the propagation errors.

watex.externals.zutils.nearest_index(val, array)[source]#

find the index of the nearest value in the array :param val: the value to search for :param array: the array to search in

Returns:

index: integer describing position of nearest value in array

watex.externals.zutils.old_z_error2r_phi_error(x, x_error, y, y_error)[source]#

Error estimation from rect to polar, but with small variation needed for MT: the so called ‘relative phase error’ is NOT the relative phase error, but the ABSOLUTE uncertainty in the angle that corresponds to the relative error in the amplitude.

So, here we calculate the transformation from rect to polar coordinates, esp. the absolute/length of the value. Then we find the uncertainty in this length and calculate the relative error of this. The relative error of the resistivity will be double this value, because it’s calculated by taking the square of this length.

The relative uncertainty in length defines a circle around (x,y) (APPROXIMATION!). The uncertainty in phi is now the absolute of the angle beween the vector to (x,y) and the origin-vector tangential to the circle. BUT….since the phase angle uncertainty is interpreted with regard to the resistivity and not the Z-amplitude, we have to look at the square of the length, i.e. the relative error in question has to be halfed to get the correct relationship between resistivity and phase errors!!.

watex.externals.zutils.propagate_error_polar2rect(r, r_error, phi, phi_error)[source]#

Find error estimations for the transformation from polar to cartesian coordinates.

Uncertainties in polar representation define a section of an annulus. Find the 4 corners of this section and additionally the outer boundary point, which is defined by phi = phi0, rho = rho0 + sigma rho. The cartesian “box” defining the uncertainties in x,y is the outer bound around the annulus section, defined by the four outermost points. So check the four corners as well as the outer boundary edge of the section to find the extrema in x znd y. These give you the sigma_x/y.

watex.externals.zutils.propagate_error_rect2polar(x, x_error, y, y_error)[source]#

Find error estimations for the transformation from cartesian coordinates to polar.

watex.externals.zutils.reorient_data2D(x_values, y_values, x_sensor_angle=0, y_sensor_angle=90)[source]#

Re-orient time series data of a sensor pair, which has not been in default (x=0, y=90) orientation.

Input: - x-values - Numpy array - y-values - Numpy array Note: same length for both! - If not, the shorter length is taken

Optional: - Angle of the x-sensor - measured in degrees, clockwise from North (0) - Angle of the y-sensor - measured in degrees, clockwise from North (0)

Output: - corrected x-values (North) - corrected y-values (East)

watex.externals.zutils.rhophi2z(rho, phi, freq)[source]#

Convert impedance-style information given in Rho/Phi format into complex valued Z.

Input: rho - 2x2 array (real) - in Ohm m phi - 2x2 array (real) - in degrees freq - scalar - frequency in Hz

Output: Z - 2x2 array (complex)

watex.externals.zutils.rotatematrix_incl_errors(inmatrix, angle, inmatrix_err=None)[source]#

rotates the matrix including the propagation errors.

watex.externals.zutils.rotatevector_incl_errors(invector, angle, invector_err=None)[source]#

rotates vector including the propagation errors.

watex.externals.zutils.roundsf(number, sf)[source]#

round a number to a specified number of significant figures (sf)

watex.externals.zutils.z_error2r_phi_error(z_real, z_imag, error)[source]#

Error estimation from rectangular to polar coordinates.

By standard error propagation, relative error in resistivity is 2*relative error in z amplitude.

Uncertainty in phase (in degrees) is computed by defining a circle around the z vector in the complex plane. The uncertainty is the absolute angle between the vector to (x,y) and the vector between the origin and the tangent to the circle.

Returns:

tuple containing relative error in resistivity, absolute error in phase

Inputs:

z_real = real component of z (real number or array) z_imag = imaginary component of z (real number or array) error = absolute error in z (real number or array)