mirror of
https://github.com/nqrduck/nqrduck-spectrometer-limenqr.git
synced 2024-11-09 11:10:03 +00:00
Added error handling for empty pulse sequences.
This commit is contained in:
parent
7ff28685ab
commit
dcd34db340
1 changed files with 13 additions and 2 deletions
|
@ -23,7 +23,13 @@ class LimeNQRController(BaseSpectrometerController):
|
||||||
self.log_start_message()
|
self.log_start_message()
|
||||||
|
|
||||||
lime = self.initialize_lime()
|
lime = self.initialize_lime()
|
||||||
if not lime:
|
if lime is None:
|
||||||
|
# Emit error message
|
||||||
|
self.emit_measurement_error("Error with Lime driver. Is the Lime driver installed?")
|
||||||
|
return -1
|
||||||
|
elif lime.Npulses == 0:
|
||||||
|
# Emit error message
|
||||||
|
self.emit_measurement_error("Error with pulse sequence. Is the pulse sequence empty?")
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
self.setup_lime_parameters(lime)
|
self.setup_lime_parameters(lime)
|
||||||
|
@ -49,7 +55,11 @@ class LimeNQRController(BaseSpectrometerController):
|
||||||
logger.debug("Starting measurement with spectrometer: %s", self.module.model.name)
|
logger.debug("Starting measurement with spectrometer: %s", self.module.model.name)
|
||||||
|
|
||||||
def initialize_lime(self):
|
def initialize_lime(self):
|
||||||
"""This method initializes the limr object that is used to communicate with the pulseN driver."""
|
"""This method initializes the limr object that is used to communicate with the pulseN driver.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
PyLimeConfig: The PyLimeConfig object that is used to communicate with the pulseN driver
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
n_pulses = self.get_number_of_pulses()
|
n_pulses = self.get_number_of_pulses()
|
||||||
lime = PyLimeConfig(n_pulses)
|
lime = PyLimeConfig(n_pulses)
|
||||||
|
@ -60,6 +70,7 @@ class LimeNQRController(BaseSpectrometerController):
|
||||||
logger.error("Error while initializing Lime driver: %s", e)
|
logger.error("Error while initializing Lime driver: %s", e)
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def setup_lime_parameters(self, lime):
|
def setup_lime_parameters(self, lime):
|
||||||
|
|
Loading…
Reference in a new issue