summaryrefslogtreecommitdiff
path: root/examples/example.py
diff options
context:
space:
mode:
authorSam Scholten2025-10-23 16:05:39 +1000
committerSam Scholten2025-10-23 16:05:39 +1000
commita74c1249a18dbb4d6a69f52ac88a7bb8f6ac0eb7 (patch)
treed686e561b69d1aae5105cdb9905889dd6ca2b388 /examples/example.py
parentd671e06c561337ca5a82fd9aa78a3cb089e90efc (diff)
downloadtransivent-a74c1249a18dbb4d6a69f52ac88a7bb8f6ac0eb7.tar.gz
transivent-a74c1249a18dbb4d6a69f52ac88a7bb8f6ac0eb7.zip
Fix examples to use correct API importsv2.0.2
- example.py: Update to use detect_from_wfm() instead of process_file() - example_diffusion.py: Import diffusion functions from event_processor submodule - Both examples now correctly use the v2.0.0 API structure
Diffstat (limited to 'examples/example.py')
-rw-r--r--examples/example.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/examples/example.py b/examples/example.py
index 06c33c5..0c79986 100644
--- a/examples/example.py
+++ b/examples/example.py
@@ -2,7 +2,7 @@ from warnings import warn
import matplotlib as mpl
-from transivent import configure_logging, get_waveform_params, process_file
+from transivent import configure_logging, detect_from_wfm, get_waveform_params
# --- User configuration dictionary ---
CONFIG = {
@@ -72,8 +72,8 @@ def main() -> None:
)
sampling_interval = params["sampling_interval"]
- # Call with explicit parameters
- process_file(
+ # Call with explicit parameters using new API
+ results = detect_from_wfm(
name=name,
sampling_interval=sampling_interval,
data_path=merged_config["DATA_PATH"],
@@ -88,12 +88,16 @@ def main() -> None:
envelope_mode_limit=merged_config.get("ENVELOPE_MODE_LIMIT", 10e-3),
sidecar=sidecar,
crop=merged_config.get("crop"),
- yscale_mode=merged_config.get("YSCALE_MODE", "snr"),
- show_plots=True,
+ save_plots=True,
filter_type=merged_config.get("FILTER_TYPE", "gaussian"),
filter_order=merged_config.get("FILTER_ORDER", 2),
chunk_size=merged_config.get("CHUNK_SIZE"),
)
+
+ # Show the plot (equivalent to old show_plots=True)
+ if results.get("plot"):
+ import matplotlib.pyplot as plt
+ plt.show()
if __name__ == "__main__":