hyperdd 0.2.0__py3-none-any.whl → 0.2.1.dev2__py3-none-any.whl

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.
hyperdd/hypoDD.py CHANGED
@@ -177,7 +177,7 @@ def run_hypoDD(inp_file: str, data: dict = None, **options) -> None:
177
177
 
178
178
  # ---- 1. Parse input file ----
179
179
  cfg = parse_inp(inp_file)
180
- _known = {"max_step_km", "solver_backend", "anchor_mu", "anchor_components", "robust_loss", "gnc_kernel", "gnc_threshold", "max_partition_size", "covariance", "eikonal"}
180
+ _known = {"max_step_km", "solver_backend", "anchor_mu", "anchor_components", "robust_loss", "gnc_kernel", "gnc_threshold", "max_partition_size", "covariance", "eikonal", "zero_mean_step", "stop_tol"}
181
181
  for k, v in options.items():
182
182
  if k not in _known:
183
183
  raise ValueError(f"run_hypoDD: unknown option {k!r} (known: {', '.join(sorted(_known))})")
@@ -827,6 +827,9 @@ def run_hypoDD(inp_file: str, data: dict = None, **options) -> None:
827
827
  log.info(" step limit: %d of %d events scaled", int((_f < 1).sum()), nev)
828
828
  src_dx[:nev] *= _f; src_dy[:nev] *= _f; src_dz[:nev] *= _f; src_dt[:nev] *= _f
829
829
 
830
+ if getattr(cfg, "zero_mean_step", False): # under test (quakeflow RESULTS E29): the step of a cluster has no mean, as the mean-shift rows of HypoDD's SVD solver ask (its LSQR and HyperDD's leave them out)
831
+ for _a in (src_dx, src_dy, src_dz, src_dt): _a[:nev] -= _a[:nev].mean()
832
+
830
833
  dxav = float(np.mean(np.abs(src_dx[:nev])))
831
834
  dyav = float(np.mean(np.abs(src_dy[:nev])))
832
835
  dzav = float(np.mean(np.abs(src_dz[:nev])))
@@ -993,6 +996,17 @@ def run_hypoDD(inp_file: str, data: dict = None, **options) -> None:
993
996
  (" CND %5d" % round(acond)) if cfg.isolv == 2 else "",
994
997
  )
995
998
 
999
+ # under test (quakeflow RESULTS E41): a set ends when its misfit no longer falls by the fraction stop_tol in one iteration
1000
+ # (the larger fall of the two data types). Not judged on a set's first iteration: its weights and cuts are new.
1001
+ _tol = getattr(cfg, "stop_tol", None)
1002
+ if _tol is not None and (aiter[iset - 1] if iset else 0) + 1 < iter_ < aiter[iset]:
1003
+ assert not getattr(cfg, "covariance", False), "stop_tol: the covariance is computed on the last planned iteration only"
1004
+ if max(((old - new) / old for new, old in ((rms_ct, rms_ctold), (rms_cc, rms_ccold)) if old > 0), default=0.0) < _tol:
1005
+ _skip = aiter[iset] - iter_
1006
+ log.info(" set %d ends at iteration %d: the misfit fell by less than %g (%d iterations skipped)", iset + 1, iter_, _tol, _skip)
1007
+ for i in range(iset, len(aiter)): aiter[i] -= _skip
1008
+ maxiter -= _skip
1009
+
996
1010
  rms_ccold = rms_cc
997
1011
  rms_ctold = rms_ct
998
1012
  rms_cc0old = rms_cc0
hyperdd/io/inputs.py CHANGED
@@ -133,9 +133,9 @@ def write_hypodd_inputs(run_dir, events, stations, dt, velocity, damp, iter_sets
133
133
  for s in iter_sets:
134
134
  f.write(" " + " ".join(str(x) for x in tuple(s) + ((damp,) if len(s) == 9 else ())) + "\n")
135
135
  if np.ndim(vpvs) == 0: # IMOD 0: one Vp/Vs
136
- f.write(f"0\n{len(tops)} {vpvs}\n" + " ".join(f"{x:.1f}" for x in tops) + "\n" + " ".join(f"{x:.2f}" for x in vp) + "\n")
136
+ f.write(f"0\n{len(tops)} {vpvs}\n" + " ".join(f"{x:.4f}" for x in tops) + "\n" + " ".join(f"{x:.4f}" for x in vp) + "\n")
137
137
  else: # IMOD 1: tops, velocities and Vp/Vs per layer, each line closed by -9
138
- f.write("1\n" + " ".join(f"{x:.1f}" for x in tops) + " -9\n" + " ".join(f"{x:.4f}" for x in vp) + " -9\n" + " ".join(f"{x:.4f}" for x in vpvs) + " -9\n")
138
+ f.write("1\n" + " ".join(f"{x:.4f}" for x in tops) + " -9\n" + " ".join(f"{x:.4f}" for x in vp) + " -9\n" + " ".join(f"{x:.4f}" for x in vpvs) + " -9\n")
139
139
  f.write(" 0\n") # CID 0: all clusters
140
140
 
141
141
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperdd
3
- Version: 0.2.0
3
+ Version: 0.2.1.dev2
4
4
  Summary: Scalable double-difference earthquake relocation with sparse graph optimization
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/AI4EPS/HyperDD
@@ -1,6 +1,6 @@
1
1
  hyperdd/__init__.py,sha256=FF4boxFrngX8PzsyUgi6Ih970nM-cu71gRm9-69wq6w,88
2
2
  hyperdd/config.py,sha256=qmDqxT46EU21vBjsSjl7BtON2rEDzhG2S6mqUkuJ58g,6465
3
- hyperdd/hypoDD.py,sha256=sfhupg1LQ9JCKOvbdNswrkcBGQlWdZoq2oXicPDLq_k,51184
3
+ hyperdd/hypoDD.py,sha256=t23RrlsE61w_DRqENLESOpt7-w9t4IodHQWQor9UpUs,52513
4
4
  hyperdd/metrics.py,sha256=PxlpkF4bxwkqpaPJIuCYYW5wyAn_nk7pIxsPwjjcJTg,5167
5
5
  hyperdd/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  hyperdd/core/cluster.py,sha256=HsHX36GvSLTl9ybwHmwq1AQdbilK4NR6lK9gyZyrrBg,1948
@@ -16,7 +16,7 @@ hyperdd/geodesy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  hyperdd/geodesy/coordinates.py,sha256=zFSd7UKzZb5m_gLGBzAvzOYfm6fV8RBef79S6Mu0suc,10300
17
17
  hyperdd/geodesy/delaz_vec.py,sha256=55JaRwJ0g-yja5vRLK7noQqtP57qnaUf20V0eizQ6xg,1986
18
18
  hyperdd/io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- hyperdd/io/inputs.py,sha256=_W8oDzl1PzT8WThjd8geRmyN6CLrNaaUTZqnjH0HDtw,10410
19
+ hyperdd/io/inputs.py,sha256=wIGRrfaevakwXq2BDr5NDI3yJUFfucwId3K6SVLA_Sg,10410
20
20
  hyperdd/io/ph2dt.py,sha256=fTRBS7wKNyCIlai6uglPcKDLccFmjxeSzGkiRA10bt0,35597
21
21
  hyperdd/io/readers.py,sha256=XY4NSFZDYgabzqNQTw-PDLydWqzjpQdqusI2rs5SxVI,8936
22
22
  hyperdd/io/readers_csv.py,sha256=CtcsaTWhQls6VchBip9lyfQ_t8T4lgiA0bhp3ZTHWvk,4603
@@ -38,9 +38,9 @@ hyperdd/solvers/schur.py,sha256=dj77k7V9837WCRHFHoG9DDcdkrD3634AfeU5SGP7pxM,4123
38
38
  hyperdd/solvers/sparse_chol.py,sha256=TYRqE3McwkkZgBCLpdUh08ERI1XMscNcIOqbK1VYLt8,8641
39
39
  hyperdd/solvers/stats.py,sha256=krLQZ_KOwBpsxhnw1bZ8DLHuGYgHKpIuhWb1CjzIxBk,3300
40
40
  hyperdd/solvers/svd.py,sha256=j8vx7KzgoX8fQ0KpwLLmYVPsyAOwvc_7Q4rq5gVQetU,9438
41
- hyperdd-0.2.0.dist-info/licenses/LICENSE,sha256=sJNfJ5qJDP8i--R7TPFF3TjLVegAJFWAQDfyim8-_1g,1063
42
- hyperdd-0.2.0.dist-info/METADATA,sha256=Eha9SR0_LktTRBJFze-4x901nLAzvENShjg1uxOwRkM,668
43
- hyperdd-0.2.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
44
- hyperdd-0.2.0.dist-info/entry_points.txt,sha256=i5fNsYwSNsaP897LLUUBONiWH_NbyLPIooZAV9N6k5w,93
45
- hyperdd-0.2.0.dist-info/top_level.txt,sha256=3kbPhhomE0SUwaIeCCEGpxKgitY8RF9iZv_e9hY0yaE,8
46
- hyperdd-0.2.0.dist-info/RECORD,,
41
+ hyperdd-0.2.1.dev2.dist-info/licenses/LICENSE,sha256=sJNfJ5qJDP8i--R7TPFF3TjLVegAJFWAQDfyim8-_1g,1063
42
+ hyperdd-0.2.1.dev2.dist-info/METADATA,sha256=F_8XOaft6tjjh-88Tq86-Lc7U9VQfFFMOAthc7PEJaM,673
43
+ hyperdd-0.2.1.dev2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
44
+ hyperdd-0.2.1.dev2.dist-info/entry_points.txt,sha256=i5fNsYwSNsaP897LLUUBONiWH_NbyLPIooZAV9N6k5w,93
45
+ hyperdd-0.2.1.dev2.dist-info/top_level.txt,sha256=3kbPhhomE0SUwaIeCCEGpxKgitY8RF9iZv_e9hY0yaE,8
46
+ hyperdd-0.2.1.dev2.dist-info/RECORD,,