Skip to content

Commit 9aa668f

Browse files
committed
Return when no calib data on clean, set lifecycle state after critical calls
1 parent 5f2474d commit 9aa668f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/explorepy/asr_processor.py

Lines changed: 3 additions & 1 deletion
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,12 +278,13 @@ 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
284285
try:
285286
self._state = asr_calibrate(cleaned, self.sr, cutoff=self._cutoff)
287+
self.lifecycle_state = state
286288
except np.linalg.LinAlgError as e:
287289
self.calibration_data_available = False
288290
self.lifecycle_state = State.CALIBRATION_ERROR

0 commit comments

Comments
 (0)