{"record":{"id":"12956f4f2036917c","repo":"ruvnet/RuView","slug":"failed-to-extract-features-e","errorCode":null,"errorMessage":"Failed to extract features: {e}","messagePattern":"Failed to extract features: (.+?)","errorType":"exception","errorClass":"CSIProcessingError","httpStatus":null,"severity":"error","filePath":"archive/v1/src/core/csi_processor.py","lineNumber":189,"sourceCode":"            # Extract correlation features\n            correlation_matrix = self._extract_correlation_features(csi_data)\n            \n            # Extract Doppler and frequency features\n            doppler_shift, power_spectral_density = self._extract_doppler_features(csi_data)\n            \n            return CSIFeatures(\n                amplitude_mean=amplitude_mean,\n                amplitude_variance=amplitude_variance,\n                phase_difference=phase_difference,\n                correlation_matrix=correlation_matrix,\n                doppler_shift=doppler_shift,\n                power_spectral_density=power_spectral_density,\n                timestamp=datetime.now(timezone.utc),\n                metadata={'processing_params': self.config}\n            )\n            \n        except Exception as e:\n            raise CSIProcessingError(f\"Failed to extract features: {e}\")\n    \n    def detect_human_presence(self, features: CSIFeatures) -> Optional[HumanDetectionResult]:\n        \"\"\"Detect human presence from CSI features.\n        \n        Args:\n            features: Extracted CSI features\n            \n        Returns:\n            Detection result or None if disabled\n            \n        Raises:\n            CSIProcessingError: If detection fails\n        \"\"\"\n        if not self.enable_human_detection:\n            return None\n        \n        try:\n            # Analyze motion patterns","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/archive/v1/src/core/csi_processor.py#L171-L207","documentation":"CSIProcessingError raised by CSIProcessor.extract_features when feature computation (amplitude stats, phase difference, correlation matrix, Doppler shift, PSD) throws. Like the other pipeline wrappers, it wraps the original exception text; the failure is almost always a NumPy shape/value problem rather than a library bug.","triggerScenarios":"Calling processor.extract_features(csi_data) with data whose shapes are inconsistent (e.g. amplitude has more subcarriers than phase), single-sample inputs where variance/correlation degenerate, or arrays containing NaN that propagate into every statistic. extract_features is normally fed the output of preprocess_csi_data; bypassing preprocessing with raw data is a common trigger.","commonSituations":"Calling extract_features directly on raw CSIData to skip preprocessing; window_size larger than the sample count producing empty windows; subcarrier dimension mismatched between amplitude and phase after custom ingestion; NaN from upstream log/divide operations; feeding the same processor data from different hardware profiles (different subcarrier counts).","solutions":["Follow the pipeline order: preprocess_csi_data first, then extract_features on its output.","Check the embedded original exception in the message and fix that specific shape/value issue.","Ensure sample count >= window_size and amplitude.shape == phase.shape with 2-D layout.","Replace NaN/inf before extraction: np.nan_to_num, or filter the batch at ingestion."],"exampleFix":"# before\nfeatures = processor.extract_features(raw_csi)  # raw data -> shape errors wrapped\n\n# after\nprepped = processor.preprocess_csi_data(raw_csi)\nfeatures = processor.extract_features(prepped)","handlingStrategy":"try-catch","validationCode":"prepped = processor.preprocess_csi_data(csi_data)\nassert prepped.amplitude.ndim == 2 and prepped.amplitude.shape[0] >= processor.window_size\nfeatures = processor.extract_features(prepped)  # only on preprocessed output","typeGuard":null,"tryCatchPattern":"try:\n    features = processor.extract_features(prepped)\nexcept CSIProcessingError as e:\n    logger.warning('feature extraction failed (%s); skipping batch', e)\n    continue\n# Inspect the embedded inner message before deciding to skip vs abort","preventionTips":["Always run extract_features on preprocess_csi_data output, never raw CSIData.","Keep subcarrier counts constant per hardware profile; use one processor per profile.","Validate deserialized features against a fresh sample's shapes before reuse."],"tags":["csi-processing","runtime","numpy","feature-extraction","wrapper-exception"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}