Skip to content

Commit 01b6e7a

Browse files
authored
Merge pull request #426 from Mentalab-hub/asr-testing
Asr testing
2 parents 7c7871c + 9aa668f commit 01b6e7a

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/explorepy/asr_processor.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ def on_unclean_data_received(self, packet):
200200
self.last_clean_at = time.time()
201201
if not self.calibration_data_available:
202202
logger.warning("Attempting to clean data with no calibration available - returning...")
203+
return
203204
new_data = np.array(packet.get_data()[1])
204205
new_ts = np.array(packet.get_data()[0])
205206
self.to_clean[:, :new_data.shape[1]] = new_data
@@ -277,8 +278,14 @@ def stop_calibration(self):
277278
def set_state_from_calibration_data(self, calib_data):
278279
self.lifecycle_state = State.CLEANING
279280
cleaned, state = clean_calib_data(calib_data, self.sr)
280-
self.lifecycle_state = state
281281
if cleaned is None:
282282
self.calibration_data_available = False
283+
self.lifecycle_state = state
283284
return
284-
self._state = asr_calibrate(cleaned, self.sr, cutoff=self._cutoff)
285+
try:
286+
self._state = asr_calibrate(cleaned, self.sr, cutoff=self._cutoff)
287+
self.lifecycle_state = state
288+
except np.linalg.LinAlgError as e:
289+
self.calibration_data_available = False
290+
self.lifecycle_state = State.CALIBRATION_ERROR
291+
logger.error(f"Could not calibrate ASR: {e}")

0 commit comments

Comments
 (0)