API Reference
Main Functions
run_hash()
Determine focal mechanism from P-wave polarities.
result = run_hash(p_azi, p_the, p_pol, p_qual, **kwargs)
Parameters:
Name |
Type |
Default |
Description |
|---|---|---|---|
|
ndarray |
required |
Azimuths (degrees), shape (nsta,) or (nsta, nmc) |
|
ndarray |
required |
Takeoff angles (degrees) |
|
ndarray |
required |
Polarities: 1=up, -1=down |
|
ndarray |
required |
Quality: 0=impulsive, 1=emergent |
|
float |
5.0 |
Grid angle increment |
|
int |
30 |
Monte Carlo trials |
|
int |
500 |
Max output mechanisms |
|
float |
0.1 |
Allowed bad polarity fraction |
|
int |
8 |
Minimum polarities |
|
float |
90.0 |
Max azimuth gap |
|
float |
60.0 |
Max plunge gap |
Returns:
Key |
Type |
Description |
|---|---|---|
|
bool |
Solution found |
|
float |
Strike (degrees) |
|
float |
Dip (degrees) |
|
float |
Rake (degrees) |
|
str |
A, B, C, D, E, or F |
|
float |
Misfit fraction (0-1) |
|
float |
Solution probability |
|
float |
Station distribution ratio |
|
int |
Number of solutions |
run_hash_with_amp()
Determine mechanism using polarities + S/P amplitude ratios.
result = run_hash_with_amp(p_azi, p_the, p_pol, sp_amp, **kwargs)
Additional Parameter:
Name |
Type |
Description |
|---|---|---|
|
ndarray |
S/P ratios (log10), 0.0 = no data |
Additional Returns:
Key |
Type |
Description |
|---|---|---|
|
float |
Amplitude misfit (log10) |
|
int |
Polarity count |
|
int |
S/P ratio count |
run_hash_from_file()
Process events from HASH input file.
results = run_hash_from_file("example.inp")
Quality Rating
Grade |
Criteria |
|---|---|
A |
prob > 0.8, var ≤ 25°, misfit ≤ 15%, stdr ≥ 0.5 |
B |
prob > 0.6, var ≤ 35°, misfit ≤ 20%, stdr ≥ 0.4 |
C |
prob > 0.5, var ≤ 45°, misfit ≤ 30%, stdr ≥ 0.3 |
D |
Solution found but below C criteria |
E |
Azimuth or plunge gap too large |
F |
No acceptable mechanism found |
Modules
Module |
Functions |
Description |
|---|---|---|
|
|
Main entry points |
|
|
Grid search algorithm |
|
|
S/P amplitude ratio |
|
|
Uncertainty analysis |
|
|
File I/O |
|
|
Coordinate conversions |
|
|
Velocity model tables |
Low-Level Functions
focalmc()
Core grid search algorithm.
result = focalmc(p_azi_mc, p_the_mc, p_pol, p_qual, npol, nmc, dang, maxout, nextra, ntotal)
Returns all acceptable mechanisms with fault normals and slip vectors.
get_misfit()
Calculate polarity misfit.
mfrac, stdr = get_misfit(npol, p_azi, p_the, p_pol, p_qual, strike, dip, rake)
get_gap()
Calculate azimuthal and plunge gaps.
magap, mpgap = get_gap(npol, p_azi, p_the)
mech_prob()
Calculate mechanism probability and average.
result = mech_prob(nf, norm1, norm2, cangle=45.0, prob_max=0.1)