summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/example.py14
-rw-r--r--examples/example_diffusion.py20
2 files changed, 19 insertions, 15 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__":
diff --git a/examples/example_diffusion.py b/examples/example_diffusion.py
index dc2d05e..8826d16 100644
--- a/examples/example_diffusion.py
+++ b/examples/example_diffusion.py
@@ -11,23 +11,23 @@ import numpy as np
import matplotlib.pyplot as plt
# Import transivent functions
-from transivent import (
- process_file,
- get_final_events,
+from transivent import configure_logging, detect
+
+# Import building blocks from submodules
+from transivent.analysis import (
+ detect_events,
+ calculate_initial_background,
+ estimate_noise,
+ analyze_thresholds,
+)
+from transivent.event_processor import (
process_events_for_diffusion,
extract_event_waveforms,
calculate_msd_parallel,
calculate_acf,
fit_diffusion_linear,
plot_diffusion_comparison,
- detect_events,
- calculate_initial_background,
- estimate_noise,
- analyze_thresholds,
)
-
-# Configure logging
-from transivent import configure_logging
configure_logging("INFO")