phasenet 0.2.6.dev2__py3-none-any.whl → 0.2.6.dev3__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.
@@ -85,7 +85,8 @@ def predict_2d(model: torch.nn.Module,
85
85
  max_batch_size: Max patches per forward pass (memory safety valve).
86
86
 
87
87
  Returns:
88
- Phase scores of shape (3, nx, nt) — [noise, P, S].
88
+ Phase scores of shape (3, nx, nt) — [noise, P, S]; with a polarity head (4, nx, nt), the fourth row the
89
+ probability that the first motion is up.
89
90
  If model outputs event_center/event_time, returns
90
91
  (scores, event_center, event_time) at their native resolution.
91
92
  """
@@ -167,6 +168,10 @@ def predict_2d(model: torch.nn.Module,
167
168
  with torch.autocast(device_type=dev.type, dtype=torch.bfloat16, enabled=bf16):
168
169
  out = model({"data": batch})
169
170
  probs = torch.softmax(out["phase"].float(), dim=1)
171
+ if "polarity" in out: # P(up), carried as a fourth row through the same overlap-discard
172
+ probs = torch.cat([probs, torch.sigmoid(out["polarity"].float())], dim=1)
173
+ if scores_sum.shape[0] != probs.shape[1]:
174
+ scores_sum = torch.zeros(probs.shape[1], nx, nt, dtype=torch.float32, device=acc_device)
170
175
  if not use_gpu:
171
176
  probs = probs.cpu()
172
177
 
@@ -328,6 +333,8 @@ def detect_picks(scores: np.ndarray,
328
333
  "phase_score": round(prob, 4),
329
334
  "phase_type": phase,
330
335
  "dt_s": dt_s,
336
+ **({"phase_polarity": round(scores[3, ch_idx, tidx].item(), 4)}
337
+ if phase == "P" and scores.shape[0] > 3 else {}), # P(up) at the P pick
331
338
  })
332
339
 
333
340
  return picks
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: phasenet
3
- Version: 0.2.6.dev2
3
+ Version: 0.2.6.dev3
4
4
  Summary: A PyTorch implementation of PhaseNet for seismic and DAS phase picking
5
5
  Author: Weiqiang Zhu
6
6
  License-Expression: MIT
@@ -24,11 +24,11 @@ phasenet/models/prompt/prompt_encoder.py,sha256=q1m9N-3Ir_b6otiX23X5PNjAS45y0i8u
24
24
  phasenet/models/prompt/transformer.py,sha256=upHVeXMeVF0wKRif2hduo9zzY3RhllzMs2tq1DjINgA,8317
25
25
  phasenet/utils/__init__.py,sha256=evtQmqHe-22D1JB_3TMdwEIS48druYsCPm7A__txmmA,56
26
26
  phasenet/utils/detect_peaks_cpu.py,sha256=rfmCt7kmYoaD9628Gqg35AfHNJUSyaUbR2jYsW4MVS4,7776
27
- phasenet/utils/inference.py,sha256=y-IOZ8ca9xgo05kTyh0GAtgO1z2pDHZt23sH2pVkkoQ,19978
27
+ phasenet/utils/inference.py,sha256=CmTO4qOaY74HrH0Cdo45SNw3vqMQAQ_-ELuHzqPU6P8,20610
28
28
  phasenet/utils/postprocess.py,sha256=WhVsJuf7goASeW0HSTaR-dPUsbMJjXmFzMlXfNoJF3w,11749
29
29
  phasenet/utils/visualization.py,sha256=EHw1AMnOUPGQzBYGVpb33Ipc6jM3-EnnYdRfinpf6q0,27003
30
- phasenet-0.2.6.dev2.dist-info/METADATA,sha256=Vo4FEvtLYmUUrmIKrBiAK68jnmt4lU1x0f00tVcPY2o,23211
31
- phasenet-0.2.6.dev2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
32
- phasenet-0.2.6.dev2.dist-info/entry_points.txt,sha256=m41YTuKlfR4svomlQKHVgq1_bLz4ng6gH8PbVBD1vqc,45
33
- phasenet-0.2.6.dev2.dist-info/top_level.txt,sha256=Zw-8M-227zxFhDWHIS13TKNYEz1cAGDhp7ADNunSgAI,21
34
- phasenet-0.2.6.dev2.dist-info/RECORD,,
30
+ phasenet-0.2.6.dev3.dist-info/METADATA,sha256=C3kuZG_lmPH8gvFHGoLlnLe3s-5Nt8zyUqR_jksJ-9k,23211
31
+ phasenet-0.2.6.dev3.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
32
+ phasenet-0.2.6.dev3.dist-info/entry_points.txt,sha256=m41YTuKlfR4svomlQKHVgq1_bLz4ng6gH8PbVBD1vqc,45
33
+ phasenet-0.2.6.dev3.dist-info/top_level.txt,sha256=Zw-8M-227zxFhDWHIS13TKNYEz1cAGDhp7ADNunSgAI,21
34
+ phasenet-0.2.6.dev3.dist-info/RECORD,,