ruvnet/RuView · error · CSIProcessingError

Failed to extract features: {e}

Error message

Failed to extract features: {e}

What it means

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.

Source

Thrown at archive/v1/src/core/csi_processor.py:189

            # Extract correlation features
            correlation_matrix = self._extract_correlation_features(csi_data)
            
            # Extract Doppler and frequency features
            doppler_shift, power_spectral_density = self._extract_doppler_features(csi_data)
            
            return CSIFeatures(
                amplitude_mean=amplitude_mean,
                amplitude_variance=amplitude_variance,
                phase_difference=phase_difference,
                correlation_matrix=correlation_matrix,
                doppler_shift=doppler_shift,
                power_spectral_density=power_spectral_density,
                timestamp=datetime.now(timezone.utc),
                metadata={'processing_params': self.config}
            )
            
        except Exception as e:
            raise CSIProcessingError(f"Failed to extract features: {e}")
    
    def detect_human_presence(self, features: CSIFeatures) -> Optional[HumanDetectionResult]:
        """Detect human presence from CSI features.
        
        Args:
            features: Extracted CSI features
            
        Returns:
            Detection result or None if disabled
            
        Raises:
            CSIProcessingError: If detection fails
        """
        if not self.enable_human_detection:
            return None
        
        try:
            # Analyze motion patterns

View on GitHub (pinned to 4685618388)

Solutions

  1. Follow the pipeline order: preprocess_csi_data first, then extract_features on its output.
  2. Check the embedded original exception in the message and fix that specific shape/value issue.
  3. Ensure sample count >= window_size and amplitude.shape == phase.shape with 2-D layout.
  4. Replace NaN/inf before extraction: np.nan_to_num, or filter the batch at ingestion.

Example fix

# before
features = processor.extract_features(raw_csi)  # raw data -> shape errors wrapped

# after
prepped = processor.preprocess_csi_data(raw_csi)
features = processor.extract_features(prepped)
Defensive patterns

Strategy: try-catch

Validate before calling

prepped = processor.preprocess_csi_data(csi_data)
assert prepped.amplitude.ndim == 2 and prepped.amplitude.shape[0] >= processor.window_size
features = processor.extract_features(prepped)  # only on preprocessed output

Try / catch

try:
    features = processor.extract_features(prepped)
except CSIProcessingError as e:
    logger.warning('feature extraction failed (%s); skipping batch', e)
    continue
# Inspect the embedded inner message before deciding to skip vs abort

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16). Data as JSON: /api/errors/12956f4f2036917c. Report an issue: GitHub.