diff options
| author | Sam Scholten | 2025-10-30 11:28:58 +1000 |
|---|---|---|
| committer | Sam Scholten | 2025-10-30 11:28:58 +1000 |
| commit | c26cf2943de7f261951e891bc6325d82f79ef865 (patch) | |
| tree | 159cd9c81acc451c0e63f5866aee31d049f76f8a /src | |
| parent | 2c382a14d963b18708ae1c9a0756b0c17d66e01a (diff) | |
| download | scopekit-c26cf2943de7f261951e891bc6325d82f79ef865.tar.gz scopekit-c26cf2943de7f261951e891bc6325d82f79ef865.zip | |
fix: remove warning when no data in view during zoomingv1.0.3
- Remove RuntimeWarning that appeared during normal zoom operations
- This warning occurred when zooming into very small ranges where no data points were visible
- The behavior is now silent, returning empty arrays without warning as this is expected during zooming
- Simplified code logic by removing early return for empty mask and checking array length after filtering
- Bump version to 1.0.3
Diffstat (limited to 'src')
| -rw-r--r-- | src/scopekit/decimation.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/scopekit/decimation.py b/src/scopekit/decimation.py index 107054d..a8add3b 100644 --- a/src/scopekit/decimation.py +++ b/src/scopekit/decimation.py @@ -555,10 +555,11 @@ class DecimationManager: # Find indices for current view in raw time mask = (t_raw_full >= xlim_raw[0]) & (t_raw_full <= xlim_raw[1]) - if not np.any(mask): - warnings.warn( - f"No data in view for xlim_raw: {xlim_raw}. Returning empty arrays.", RuntimeWarning - ) + t_view = t_raw_full[mask] + x_view = x_raw_full[mask] + + # If no data in view, return empty arrays (normal during zooming) + if len(t_view) == 0: empty_result = ( np.array([], dtype=np.float32), np.array([], dtype=np.float32), @@ -570,9 +571,6 @@ class DecimationManager: self._cache[cache_key] = empty_result return empty_result - t_view = t_raw_full[mask] - x_view = x_raw_full[mask] - # Add warning for large number of points in detail mode if not use_envelope and len(t_view) > self.DETAIL_MODE_POINT_WARNING_THRESHOLD: warnings.warn( |
