feat: enhance waveform viewer with unit info display and event selection functionality
This commit is contained in:
@@ -163,7 +163,7 @@ class MiniMateClient:
|
||||
log.info("connect: %s", device_info)
|
||||
return device_info
|
||||
|
||||
def get_events(self, include_waveforms: bool = True, debug: bool = False) -> list[Event]:
|
||||
def get_events(self, full_waveform: bool = False, debug: bool = False) -> list[Event]:
|
||||
"""
|
||||
Download all stored events from the device using the confirmed
|
||||
1E → 0A → 0C → 5A → 1F event-iterator protocol.
|
||||
@@ -247,21 +247,39 @@ class MiniMateClient:
|
||||
"get_events: 0C failed for key=%s: %s", key4.hex(), exc
|
||||
)
|
||||
|
||||
# SUB 5A — bulk waveform stream: event-time metadata
|
||||
# Stops early after "Project:" is found (typically in A5[7] of 9)
|
||||
# so we fetch only ~8 frames rather than the full multi-MB stream.
|
||||
# This is the authoritative source for client/operator/seis_loc/notes.
|
||||
# SUB 5A — bulk waveform stream.
|
||||
# By default (full_waveform=False): stop early after frame 7 ("Project:")
|
||||
# is found — fetches only ~8 frames for event-time metadata.
|
||||
# When full_waveform=True: fetch the complete stream (stop_after_metadata=False,
|
||||
# max_chunks=128) and decode raw ADC samples into ev.raw_samples.
|
||||
# The full waveform MUST be fetched here, inside the 1E→0A→0C→5A→1F loop.
|
||||
# Issuing 5A after 1F has advanced the event context will time out.
|
||||
try:
|
||||
a5_frames = proto.read_bulk_waveform_stream(
|
||||
key4, stop_after_metadata=True
|
||||
)
|
||||
if a5_frames:
|
||||
_decode_a5_metadata_into(a5_frames, ev)
|
||||
log.debug(
|
||||
"get_events: 5A metadata client=%r operator=%r",
|
||||
ev.project_info.client if ev.project_info else None,
|
||||
ev.project_info.operator if ev.project_info else None,
|
||||
if full_waveform:
|
||||
log.info(
|
||||
"get_events: 5A full waveform download for key=%s", key4.hex()
|
||||
)
|
||||
a5_frames = proto.read_bulk_waveform_stream(
|
||||
key4, stop_after_metadata=False, max_chunks=128
|
||||
)
|
||||
if a5_frames:
|
||||
_decode_a5_metadata_into(a5_frames, ev)
|
||||
_decode_a5_waveform(a5_frames, ev)
|
||||
log.info(
|
||||
"get_events: 5A decoded %d sample-sets",
|
||||
len((ev.raw_samples or {}).get("Tran", [])),
|
||||
)
|
||||
else:
|
||||
a5_frames = proto.read_bulk_waveform_stream(
|
||||
key4, stop_after_metadata=True
|
||||
)
|
||||
if a5_frames:
|
||||
_decode_a5_metadata_into(a5_frames, ev)
|
||||
log.debug(
|
||||
"get_events: 5A metadata client=%r operator=%r",
|
||||
ev.project_info.client if ev.project_info else None,
|
||||
ev.project_info.operator if ev.project_info else None,
|
||||
)
|
||||
except ProtocolError as exc:
|
||||
log.warning(
|
||||
"get_events: 5A failed for key=%s: %s — event-time metadata unavailable",
|
||||
|
||||
Reference in New Issue
Block a user