array_processing.tools.array_characterization module

array_processing.tools.array_characterization.arraySig(rij, kmax, sigLevel, p=0.9, velLims=(0.27, 0.36), NgridV=100, NgridTh=100, NgridK=100)[source]

Estimate 2-D array uncertainties in trace velocity and back-azimuth, and calculate impulse response.

Parameters:
  • rij – Coordinates (km) of sensors as eastings & northings in a (2, N) array
  • kmax (float) – Impulse response will be calculated over the range [-kmax, kmax] in \(k\)-space (1/km)
  • sigLevel (float) – Variance in time delays (s), typically \(\sigma_\tau\)
  • p (float) – Confidence limit in uncertainty estimates
  • velLims (tuple) – Range of trace velocities (km/s) to estimate uncertainty over. A single value can be used, but the by default a range is used
  • NgridV (int) – Number of velocities to estimate uncertainties in range velLims
  • NgridTh (int) – Number of angles to estimate uncertainties in range \([0^\circ, 360^\circ]\)
  • NgridK (int) – Number of \(k\)-space coordinates to calculate in each dimension
Returns:

Tuple containing:

  • sigV – Uncertainties in trace velocity (°) as a function of trace velocity and back-azimuth as (NgridTh, NgridV) array
  • sigTh – Uncertainties in trace velocity (km/s) as a function of trace velocity and back-azimuth as (NgridTh, NgridV) array
  • impResp – Impulse response over grid as (NgridK, NgridK) array
  • vel – Vector of trace velocities (km/s) for axis in (NgridV, ) array
  • th – Vector of back azimuths (°) for axis in (NgridTh, ) array
  • kvec – Vector wavenumbers for axes in \(k\)-space in (NgridK, ) array

Return type:

tuple

array_processing.tools.array_characterization.chi2(nu, alpha, funcTol=1e-10)[source]

Calculate value of a \(\chi^2\) such that a \(\nu\)-dimensional confidence ellipsoid encloses a fraction \(1 - \alpha\) of normally distributed variable.

Parameters:
  • nu (int) – Degrees of freedom (typically embedding dimension of variable)
  • alpha (float) – Confidence interval such that \(\alpha \in [0, 1]\)
  • funcTol (float) – Optimization function evaluation tolerance for \(\nu \ne 2\)
Returns:

Value of a \(\chi^2\) enclosing \(1 - \alpha\) confidence region

Return type:

float

array_processing.tools.array_characterization.co_array(rij)[source]

Form co-array coordinates for given array coordinates.

Parameters:rij(d, n) array; n sensor coordinates as [northing, easting, {elevation}] column vectors in d dimensions
Returns:(d, n(n-1)//2) co-array, coordinates of the sensor pairing separations
array_processing.tools.array_characterization.cubicEqn(a, b, c)[source]

Roots of cubic equation in the form \(x^3 + ax^2 + bx + c = 0\).

Parameters:
  • a (int or float) – Scalar coefficient of cubic equation, can be complex
  • b (int or float) – Same as above
  • c (int or float) – Same as above
Returns:

Roots of cubic equation in standard form

Return type:

list

See also

numpy.roots() — Generic polynomial root finder

Notes

Relatively stable solutions, with some tweaks by Dr. Z, per algorithm of Numerical Recipes 2nd ed., \(\S\) 5.6. Even numpy.roots() can have some (minor) issues; e.g., \(x^3 - 5x^2 + 8x - 4 = 0\).

array_processing.tools.array_characterization.impulseResp(dij, kmax, NgridK)[source]

Calculate impulse response of a 2-D array.

Parameters:
  • dij – Coordinates of co-array of N sensors in a (2, (N*N-1)/2) array
  • kmax (float) – Impulse response will be calculated over the range [-kmax, kmax] in \(k\)-space
  • NgridK (int) – Number of \(k\)-space coordinates to calculate in each dimension
Returns:

Tuple containing:

  • d – Impulse response over grid as (NgridK, NgridK) array
  • kvec - Vector wavenumbers for axes in \(k\)-space in (NgridK, ) array

Return type:

tuple

array_processing.tools.array_characterization.quadraticEqn(a, b, c)[source]

Roots of quadratic equation in the form \(ax^2 + bx + c = 0\).

Parameters:
  • a (int or float) – Scalar coefficient of quadratic equation, can be complex
  • b (int or float) – Same as above
  • c (int or float) – Same as above
Returns:

Roots of quadratic equation in standard form

Return type:

list

See also

numpy.roots() — Generic polynomial root finder

Notes

Stable solutions, even for \(b^2 >> ac\) or complex coefficients, per algorithm of Numerical Recipes 2nd ed., \(\S\) 5.6.

array_processing.tools.array_characterization.quarticEqn(a, b, c, d)[source]

Roots of quartic equation in the form \(x^4 + ax^3 + bx^2 + cx + d = 0\).

Parameters:
  • a (int or float) – Scalar coefficient of quartic equation, can be complex
  • b (int or float) – Same as above
  • c (int or float) – Same as above
  • d (int or float) – Same as above
Returns:

Roots of quartic equation in standard form

Return type:

list

See also

numpy.roots() — Generic polynomial root finder

Notes

Stable solutions per algorithm of CRC Std. Mathematical Tables, 29th ed.

array_processing.tools.array_characterization.read_kml(kml_file)[source]

Parse an array KML file into a list of element latitudes and longitudes.

KML file must contain a single folder containing the array element points.

Parameters:kml_file (str) – Full path to input KML file (extension .kml)
Returns:(latlist, lonlist) for input to getrij()
Return type:tuple
array_processing.tools.array_characterization.rthEllipse(a, b, x0, y0)[source]

Calculate angles subtending, and extremal distances to, a coordinate-aligned ellipse from the origin.

Parameters:
  • a (float) – Semi-major axis of ellipse
  • b (float) – Semi-minor axis of ellipse
  • x0 (float) – Horizontal center of ellipse
  • y0 (float) – Vertical center of ellipse
Returns:

Tuple containing:

  • eExtrm – Extremal parameters in (4, ) array as

    [min distance, max distance, min angle (degrees), max angle (degrees)]
    
  • eVec – Coordinates of extremal points on ellipse in (4, 2) array as

    [[x min dist., y min dist.],
     [x max dist., y max dist.],
     [x max angle tangency, y max angle tangency],
     [x min angle tangency, y min angle tangency]]
    

Return type:

tuple