aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Scholten2025-10-24 15:10:56 +1000
committerSam Scholten2025-10-24 15:10:56 +1000
commit6355d2cdadfc4f3f6b9d6fd3f78249a3b776cc50 (patch)
tree38ccd962ad1dc4ac66722155b9c1b3fcc6dfe2d3
parent8f3b32eef181512e1f9bdfa48902ace5e9764245 (diff)
downloadtransivent-6355d2cdadfc4f3f6b9d6fd3f78249a3b776cc50.tar.gz
transivent-6355d2cdadfc4f3f6b9d6fd3f78249a3b776cc50.zip
Fix import of downsample_to_interval in analysis.pyv2.1.0
-rw-r--r--src/transivent/analysis.py35
1 files changed, 2 insertions, 33 deletions
diff --git a/src/transivent/analysis.py b/src/transivent/analysis.py
index 6ef34d4..ad856ed 100644
--- a/src/transivent/analysis.py
+++ b/src/transivent/analysis.py
@@ -98,38 +98,7 @@ def plot_preview_image(image_path: str, title: str = "Preview Image") -> None:
logger.warning(f"Failed to display preview image {image_path}: {e}")
-def _average_downsample(
- t: np.ndarray, x: np.ndarray, q: int
-) -> Tuple[np.ndarray, np.ndarray]:
- """
- Private helper to downsample by averaging blocks of samples.
-
- Parameters
- ----------
- t : np.ndarray
- Time array.
- x : np.ndarray
- Signal array.
- q : int
- Downsample factor (must be integer > 1).
-
- Returns
- -------
- Tuple[np.ndarray, np.ndarray]
- Downsampled time and signal arrays.
- """
- if q <= 1:
- return t, x
-
- n_keep = (len(x) // q) * q
- x_reshaped = x[:n_keep].reshape(-1, q)
- x_avg = x_reshaped.mean(axis=1)
-
- # Generate uniform time array
- dt = t[1] - t[0] if len(t) > 1 else 1.0
- t_down = np.arange(len(x_avg)) * dt * q + t[0]
-
- return t_down, x_avg
+
def configure_logging(log_level: str = "INFO") -> None:
@@ -1547,7 +1516,7 @@ def detect_from_wfm(
current_interval = t[1] - t[0] if len(t) > 1 else sampling_interval
if target_sampling_interval != current_interval:
logger.info(f"Resampling from {current_interval:.3e}s to {target_sampling_interval:.3e}s")
- t, x = average_downsample_to_interval(t, x, target_sampling_interval)
+ t, x = downsample_to_interval(t, x, target_sampling_interval)
sampling_interval = target_sampling_interval
# Run analysis pipeline