{"record":{"id":"3d79963f603142ea","repo":"ruvnet/RuView","slug":"overlap-must-be-between-0-and-1","errorCode":null,"errorMessage":"overlap must be between 0 and 1","messagePattern":"overlap must be between 0 and 1","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"archive/v1/src/core/csi_processor.py","lineNumber":117,"sourceCode":"            config: Configuration to validate\n            \n        Raises:\n            ValueError: If configuration is invalid\n        \"\"\"\n        required_fields = ['sampling_rate', 'window_size', 'overlap', 'noise_threshold']\n        missing_fields = [field for field in required_fields if field not in config]\n        \n        if missing_fields:\n            raise ValueError(f\"Missing required configuration: {missing_fields}\")\n        \n        if config['sampling_rate'] <= 0:\n            raise ValueError(\"sampling_rate must be positive\")\n        \n        if config['window_size'] <= 0:\n            raise ValueError(\"window_size must be positive\")\n        \n        if not 0 <= config['overlap'] < 1:\n            raise ValueError(\"overlap must be between 0 and 1\")\n    \n    def preprocess_csi_data(self, csi_data: CSIData) -> CSIData:\n        \"\"\"Preprocess CSI data for feature extraction.\n        \n        Args:\n            csi_data: Raw CSI data\n            \n        Returns:\n            Preprocessed CSI data\n            \n        Raises:\n            CSIProcessingError: If preprocessing fails\n        \"\"\"\n        if not self.enable_preprocessing:\n            return csi_data\n        \n        try:\n            # Remove noise from the signal","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/archive/v1/src/core/csi_processor.py#L99-L135","documentation":"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.","triggerScenarios":"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%.","commonSituations":"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.","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."],"exampleFix":"# before\nconfig = {'sampling_rate': 100, 'window_size': 64, 'overlap': 1.0, 'noise_threshold': 0.1}   # 100% overlap\n\n# after\nconfig = {'sampling_rate': 100, 'window_size': 64, 'overlap': 0.5, 'noise_threshold': 0.1}  # 50% overlap","handlingStrategy":"validation","validationCode":"overlap = float(config.get('overlap', 0.5))\nif overlap >= 1 or overlap < 0:\n    overlap = min(max(overlap / 100.0 if overlap > 1 else overlap, 0.0), 0.99)\nconfig['overlap'] = overlap","typeGuard":null,"tryCatchPattern":"try:\n    processor = CSIProcessor(config)\nexcept ValueError as e:\n    if 'overlap must be between 0 and 1' in str(e):\n        config['overlap'] = 0.5\n        processor = CSIProcessor(config)\n    else:\n        raise","preventionTips":["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."],"tags":["config","validation","csi-processing","windowing"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}