Improved Error handling when the pulse sequence is invalid.

This commit is contained in:
jupfi 2024-03-19 09:21:58 +01:00
parent e717cb2a24
commit 0a2838dbb9

View file

@ -26,9 +26,16 @@ class SimulatorController(BaseSpectrometerController):
dwell_time = self.calculate_dwelltime()
logger.debug("Dwell time: %s", dwell_time)
pulse_array = self.translate_pulse_sequence(dwell_time)
try:
pulse_array = self.translate_pulse_sequence(dwell_time)
except ValueError:
logger.warning("Could not translate pulse sequence")
self.module.nqrduck_signal.emit(
"measurement_error", "Could not translate pulse sequence. Did you configure one?"
)
return
simulation = self.get_simulation(sample, pulse_array)
simulation = self.get_simulation(sample, pulse_array)
result = simulation.simulate()