feat(db): persist per-channel ZC freq on insert/upsert

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YDXjZCr4RqT2U3QvMDhgzf
This commit is contained in:
2026-07-29 17:27:36 +00:00
co-authored by Claude Opus 4.8
parent 9a71d5b914
commit 1744eb1803
2 changed files with 68 additions and 3 deletions
+31 -3
View File
@@ -415,8 +415,12 @@ class SeismoDb:
sample_rate, record_type,
blastware_filename, blastware_filesize,
a5_pickle_filename, sidecar_filename,
device_family)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
device_family,
tran_zc_freq, vert_zc_freq, long_zc_freq, mic_zc_freq,
tran_zc_above_range, vert_zc_above_range,
long_zc_above_range, mic_zc_above_range)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?)
""",
(
self._new_id(), serial, key, session_id, ts,
@@ -436,6 +440,14 @@ class SeismoDb:
rec.get("a5_pickle_filename"),
rec.get("sidecar_filename"),
device_family,
pv.tran_zc_freq if pv else None,
pv.vert_zc_freq if pv else None,
pv.long_zc_freq if pv else None,
pv.mic_zc_freq if pv else None,
(1 if (pv and pv.tran_zc_above_range) else 0),
(1 if (pv and pv.vert_zc_above_range) else 0),
(1 if (pv and pv.long_zc_above_range) else 0),
(1 if (pv and pv.mic_zc_above_range) else 0),
),
)
inserted += 1
@@ -477,7 +489,15 @@ class SeismoDb:
blastware_filesize = ?,
a5_pickle_filename = ?,
sidecar_filename = ?,
device_family = COALESCE(?, device_family)
device_family = COALESCE(?, device_family),
tran_zc_freq = ?,
vert_zc_freq = ?,
long_zc_freq = ?,
mic_zc_freq = ?,
tran_zc_above_range = ?,
vert_zc_above_range = ?,
long_zc_above_range = ?,
mic_zc_above_range = ?
WHERE serial = ? AND timestamp = ?
""",
(
@@ -497,6 +517,14 @@ class SeismoDb:
rec.get("a5_pickle_filename") if rec else None,
rec.get("sidecar_filename") if rec else None,
device_family,
pv.tran_zc_freq if pv else None,
pv.vert_zc_freq if pv else None,
pv.long_zc_freq if pv else None,
pv.mic_zc_freq if pv else None,
(1 if (pv and pv.tran_zc_above_range) else 0),
(1 if (pv and pv.vert_zc_above_range) else 0),
(1 if (pv and pv.long_zc_above_range) else 0),
(1 if (pv and pv.mic_zc_above_range) else 0),
serial,
ts,
),