gamma-wadati 0.1.0.dev2__tar.gz → 0.1.0.dev3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gamma-wadati
3
- Version: 0.1.0.dev2
3
+ Version: 0.1.0.dev3
4
4
  Summary: Earthquake phase association and location as a Bayesian Gaussian mixture on the Wadati transform
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "gamma-wadati"
7
- version = "0.1.0.dev2"
7
+ version = "0.1.0.dev3"
8
8
  description = "Earthquake phase association and location as a Bayesian Gaussian mixture on the Wadati transform"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gamma-wadati
3
- Version: 0.1.0.dev2
3
+ Version: 0.1.0.dev3
4
4
  Summary: Earthquake phase association and location as a Bayesian Gaussian mixture on the Wadati transform
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -21,7 +21,7 @@ from sklearn.cluster import KMeans
21
21
  from sklearn.utils._param_validation import StrOptions
22
22
  from sklearn.utils.extmath import row_norms
23
23
 
24
- from .forward import D_SIGMA, DEFAULT_VELOCITY, Velocity, estimate_t0, locate, predict_mean
24
+ from .forward import DEFAULT_VELOCITY, Velocity, estimate_t0, locate, predict_mean
25
25
  from .windowing import init_event_seeds
26
26
 
27
27
  ###############################################################################
@@ -402,7 +402,7 @@ def _estimate_wadati_parameters(
402
402
  "tied": _estimate_gaussian_covariances_tied,
403
403
  "diag": _estimate_gaussian_covariances_diag,
404
404
  "spherical": _estimate_gaussian_covariances_spherical,
405
- }[covariance_type](resp, X, nk, means, reg_covar if covariance_type == "spherical" else reg_covar * np.array([1.0, D_SIGMA**2])) # D's variance is D_SIGMA**2 times M's
405
+ }[covariance_type](resp, X, nk, means, reg_covar)
406
406
  return nk, centers, t0, means, covariances
407
407
 
408
408
 
@@ -435,7 +435,7 @@ def _init_responsibilities(
435
435
  M, D, station_locs, n_components, velocity
436
436
  )
437
437
  means = predict_mean(centers, t0, station_locs, velocity.p, velocity.q)
438
- labels = np.argmin(np.sum(((X[:, None, :] - means) / [1.0, D_SIGMA]) ** 2, axis=2), axis=1)
438
+ labels = np.argmin(np.sum((X[:, None, :] - means) ** 2, axis=2), axis=1)
439
439
  else: # "kmeans"
440
440
  u = M - velocity.alpha * D
441
441
  km_to_s = 1.0 / velocity.vp # station km -> s (P travel time), so that
@@ -21,11 +21,6 @@ from scipy.optimize import least_squares
21
21
  VP = 6.0
22
22
  VS = VP / 1.75
23
23
 
24
- # For equal, independent P and S pick errors of variance s^2: Var(M) = s^2 / 2 and
25
- # Var(D) = 2 s^2, so a D residual carries twice the standard deviation of an M
26
- # residual. Least squares and distances in (M, D) divide the D residual by this.
27
- D_SIGMA = 2.0
28
-
29
24
 
30
25
  @dataclass(frozen=True)
31
26
  class Velocity:
@@ -127,7 +122,7 @@ def estimate_t0(M, D, resp, alpha):
127
122
  def _locate_one(M, D, w, t0_k, station_locs, p, q, x0, bounds):
128
123
  """Weighted nonlinear least squares for one event's hypocenter.
129
124
 
130
- Minimizes ``sum_n w_n [(t0_k + p r_n - M_n)^2 + ((q r_n - D_n) / D_SIGMA)^2]``.
125
+ Minimizes ``sum_n w_n [(t0_k + p r_n - M_n)^2 + (q r_n - D_n)^2]``.
131
126
  """
132
127
  sw = np.sqrt(w)
133
128
 
@@ -135,7 +130,7 @@ def _locate_one(M, D, w, t0_k, station_locs, p, q, x0, bounds):
135
130
  d = station_locs - xi[None, :]
136
131
  r = np.sqrt(np.sum(d * d, axis=1))
137
132
  res_m = sw * (t0_k + p * r - M)
138
- res_d = sw * (q * r - D) / D_SIGMA
133
+ res_d = sw * (q * r - D)
139
134
  return np.concatenate([res_m, res_d])
140
135
 
141
136
  def jacobian(xi):
@@ -145,7 +140,7 @@ def _locate_one(M, D, w, t0_k, station_locs, p, q, x0, bounds):
145
140
  # d r / d xi = (xi - s) / r = -d / r
146
141
  grad_r = -d / r_safe[:, None] # (n, 3)
147
142
  jac_m = (sw * p)[:, None] * grad_r
148
- jac_d = (sw * q / D_SIGMA)[:, None] * grad_r
143
+ jac_d = (sw * q)[:, None] * grad_r
149
144
  return np.vstack([jac_m, jac_d])
150
145
 
151
146
  if bounds is None: