Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/explorepy/asr_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def on_unclean_data_received(self, packet):
self.last_clean_at = time.time()
if not self.calibration_data_available:
logger.warning("Attempting to clean data with no calibration available - returning...")
return
new_data = np.array(packet.get_data()[1])
new_ts = np.array(packet.get_data()[0])
self.to_clean[:, :new_data.shape[1]] = new_data
Expand Down Expand Up @@ -277,8 +278,14 @@ def stop_calibration(self):
def set_state_from_calibration_data(self, calib_data):
self.lifecycle_state = State.CLEANING
cleaned, state = clean_calib_data(calib_data, self.sr)
self.lifecycle_state = state
if cleaned is None:
self.calibration_data_available = False
self.lifecycle_state = state
return
self._state = asr_calibrate(cleaned, self.sr, cutoff=self._cutoff)
try:
self._state = asr_calibrate(cleaned, self.sr, cutoff=self._cutoff)
self.lifecycle_state = state
except np.linalg.LinAlgError as e:
self.calibration_data_available = False
self.lifecycle_state = State.CALIBRATION_ERROR
logger.error(f"Could not calibrate ASR: {e}")
Loading