ruvnet/RuView · error · ValueError
overlap must be between 0 and 1
Error message
overlap must be between 0 and 1
What it means
Raised by CSIProcessor._validate_config during __init__ when overlap is present but outside the half-open interval [0, 1). The check `not 0 <= overlap < 1` rejects negative values, 1.0, and anything larger; overlap=0 (no overlap between consecutive windows) is valid. Values >= 1 would make window stride zero or negative, causing infinite loops or empty buffers.
Source
Thrown at archive/v1/src/core/csi_processor.py:117
config: Configuration to validate
Raises:
ValueError: If configuration is invalid
"""
required_fields = ['sampling_rate', 'window_size', 'overlap', 'noise_threshold']
missing_fields = [field for field in required_fields if field not in config]
if missing_fields:
raise ValueError(f"Missing required configuration: {missing_fields}")
if config['sampling_rate'] <= 0:
raise ValueError("sampling_rate must be positive")
if config['window_size'] <= 0:
raise ValueError("window_size must be positive")
if not 0 <= config['overlap'] < 1:
raise ValueError("overlap must be between 0 and 1")
def preprocess_csi_data(self, csi_data: CSIData) -> CSIData:
"""Preprocess CSI data for feature extraction.
Args:
csi_data: Raw CSI data
Returns:
Preprocessed CSI data
Raises:
CSIProcessingError: If preprocessing fails
"""
if not self.enable_preprocessing:
return csi_data
try:
# Remove noise from the signalView on GitHub (pinned to 4685618388)
Solutions
- Set overlap as a fraction in [0, 1): 0.5 means 50% window overlap — the common default.
- If the value arrives as a percentage, convert before construction: `overlap = pct / 100.0` and clamp with `min(0.99, ...)`.
- If you intended adjacent non-overlapping windows, use 0.
- Fix stride math: for desired hop h and window w, overlap = 1 - h/w, ensure h <= w.
Example fix
# before
config = {'sampling_rate': 100, 'window_size': 64, 'overlap': 1.0, 'noise_threshold': 0.1} # 100% overlap
# after
config = {'sampling_rate': 100, 'window_size': 64, 'overlap': 0.5, 'noise_threshold': 0.1} # 50% overlap Defensive patterns
Strategy: validation
Validate before calling
overlap = float(config.get('overlap', 0.5))
if overlap >= 1 or overlap < 0:
overlap = min(max(overlap / 100.0 if overlap > 1 else overlap, 0.0), 0.99)
config['overlap'] = overlap Try / catch
try:
processor = CSIProcessor(config)
except ValueError as e:
if 'overlap must be between 0 and 1' in str(e):
config['overlap'] = 0.5
processor = CSIProcessor(config)
else:
raise Prevention
- Store overlap as a fraction; convert percentages at the UI/CLI boundary.
- Remember 1.0 is invalid (half-open range) — use at most 0.99 for near-full overlap.
- Compute overlap as 1 - hop/window and assert 0 <= overlap < 1 in config tests.
When it happens
Trigger: Constructing CSIProcessor with overlap=1.0 (a frequent mistake — 100% overlap is mathematically invalid here), overlap > 1, or a negative fraction, e.g. CSIProcessor({..., 'overlap': 1.0, ...}). Also triggered by percentages passed unconverted: 50 meaning 50%.
Common situations: Configuring overlap as a percentage (50 or 100) instead of a fraction (0.5); UIs or CLIs that accept percent and forget to divide by 100; copying overlap=1.0 from another pipeline that allows full overlap; sign errors when computing overlap as `1 - stride/window` with stride > window.
Related errors
- Missing required configuration: {missing_fields}
- sampling_rate must be positive
- window_size must be positive
- Threshold must be between 0.0 and 1.0
- FPS must be between 1 and 60
AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16).
Data as JSON: /api/errors/3d79963f603142ea.
Report an issue: GitHub.