ruvnet/RuView · error · CSIProcessingError
Failed to preprocess CSI data: {e}
Error message
Failed to preprocess CSI data: {e} What it means
CSIProcessingError raised by CSIProcessor.preprocess_csi_data when any exception escapes its internal steps (_remove_noise, _apply_windowing, _normalize_amplitude). It is a wrapper: the original exception is stringified into the message, so inspect the embedded text to find the real cause. The wrapper exists so all preprocessing failures share one catchable type.
Source
Thrown at archive/v1/src/core/csi_processor.py:147
CSIProcessingError: If preprocessing fails
"""
if not self.enable_preprocessing:
return csi_data
try:
# Remove noise from the signal
cleaned_data = self._remove_noise(csi_data)
# Apply windowing function
windowed_data = self._apply_windowing(cleaned_data)
# Normalize amplitude values
normalized_data = self._normalize_amplitude(windowed_data)
return normalized_data
except Exception as e:
raise CSIProcessingError(f"Failed to preprocess CSI data: {e}")
def extract_features(self, csi_data: CSIData) -> Optional[CSIFeatures]:
"""Extract features from CSI data.
Args:
csi_data: Preprocessed CSI data
Returns:
Extracted features or None if disabled
Raises:
CSIProcessingError: If feature extraction fails
"""
if not self.enable_feature_extraction:
return None
try:
# Extract amplitude-based featuresView on GitHub (pinned to 4685618388)
Solutions
- Read the embedded message: `str(e)` contains the original exception — fix that root cause first.
- Validate CSIData shape before calling: non-empty 2-D arrays with matching amplitude/phase shapes (see validationCode).
- Drop or sanitize NaN/inf: `np.nan_to_num` on amplitude/phase, or reject the packet at ingestion.
- If data comes from a capture buffer, wait until at least window_size samples exist before preprocessing.
Example fix
# before
clean = processor.preprocess_csi_data(csi_data) # CSIProcessingError: Failed to preprocess CSI data: ...empty...
# after
if csi_data.amplitude.ndim == 2 and csi_data.amplitude.shape[0] >= processor.window_size:
clean = processor.preprocess_csi_data(csi_data)
else:
logger.warning('skipping undersized CSI batch %s', csi_data.amplitude.shape) Defensive patterns
Strategy: try-catch
Validate before calling
def preprocessable(csi_data, min_samples: int) -> bool:
amp = getattr(csi_data, 'amplitude', None)
pha = getattr(csi_data, 'phase', None)
return (
amp is not None and pha is not None
and getattr(amp, 'ndim', 0) == 2 and getattr(pha, 'ndim', 0) == 2
and amp.shape == pha.shape
and amp.shape[0] >= min_samples
and bool(np.isfinite(amp).all() and np.isfinite(pha).all())
)
if preprocessable(csi_data, processor.window_size):
clean = processor.preprocess_csi_data(csi_data) Try / catch
try:
clean = processor.preprocess_csi_data(csi_data)
except CSIProcessingError as e:
logger.warning('dropping bad CSI batch (%s): %s',
getattr(csi_data, 'timestamp', '?'), e)
continue # skip this batch, keep the stream alive
# Do not catch blindly: inspect str(e) root cause before dropping Prevention
- Normalize shapes at ingestion: amplitude and phase must be 2-D (samples x subcarriers) with equal shapes.
- np.nan_to_num raw CSI before it reaches the processor.
- Buffer until >= window_size samples; never feed first partial packets.
When it happens
Trigger: Calling processor.preprocess_csi_data(csi_data) with malformed CSIData: empty arrays (size 0 amplitude/phase), arrays with different subcarrier counts between amplitude and phase, 1-D phase where 2-D is expected, or NaN/inf values that break normalization (division by zero norm).
Common situations: Feeding the first packet from a cold ESP32 capture where the buffer is empty; simulators generating mismatched amplitude/phase shapes; CSI data truncated by packet loss so last window is ragged; NaNs introduced upstream by log of zero or division by zero in the extractor; test fixtures with synthetic shapes that violate the 2-D (samples x subcarriers) contract.
Related errors
- Failed to extract features: {e}
- Failed to detect human presence: {e}
- Pipeline processing failed: {e}
- Missing required configuration: {missing_fields}
- sampling_rate must be positive
AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16).
Data as JSON: /api/errors/edbeaf5cd2afd779.
Report an issue: GitHub.