mirror of
https://github.com/nqrduck/nqrduck-spectrometer-limenqr.git
synced 2024-11-09 11:10:03 +00:00
Cleaned up settings.
This commit is contained in:
parent
3ef32c2c53
commit
c519ad2a98
2 changed files with 98 additions and 59 deletions
|
@ -33,18 +33,6 @@ class LimeNQRController(BaseSpectrometerController):
|
|||
lime.noi = -1 # No initialisation
|
||||
lime.nrp = 1 # Numer of repetitions
|
||||
|
||||
lime.tdi = -45 # TX I DC correction
|
||||
lime.tdq = 0 # TX Q DC correction
|
||||
lime.tgi = 2047 # TX I Gain correction
|
||||
lime.tgq = 2039 # TX Q Gain correction
|
||||
lime.tpc = 3 # TX phase adjustment
|
||||
|
||||
lime.rgi = 2047
|
||||
lime.rgq = 2047
|
||||
lime.rdi = 0
|
||||
lime.rdq = 0
|
||||
lime.rpc = 0
|
||||
|
||||
lime = self.update_settings(lime)
|
||||
lime = self.translate_pulse_sequence(lime)
|
||||
|
||||
|
@ -109,32 +97,58 @@ class LimeNQRController(BaseSpectrometerController):
|
|||
for category in self.module.model.settings.keys():
|
||||
for setting in self.module.model.settings[category]:
|
||||
logger.debug("Setting %s has value %s", setting.name, setting.value)
|
||||
if setting.name == "RX Gain":
|
||||
lime.rgn = setting.get_setting()
|
||||
elif setting.name == "TX Gain":
|
||||
lime.tgn = setting.get_setting()
|
||||
elif setting.name == "Averages":
|
||||
lime.nav = int(setting.get_setting())
|
||||
elif setting.name == "Sampling Frequency":
|
||||
# Acquisiton settings
|
||||
if setting.name == self.module.model.FREQUENCY:
|
||||
self.module.model.target_frequency = setting.get_setting()
|
||||
elif setting.name == self.module.model.AVERAGES:
|
||||
lime.nav = setting.get_setting()
|
||||
elif setting.name == self.module.model.SAMPLING_FREQUENCY:
|
||||
lime.sra = setting.get_setting()
|
||||
elif setting.name == "RX LPF BW":
|
||||
lime.rlp = setting.get_setting()
|
||||
elif setting.name == "TX LPF BW":
|
||||
lime.tlp = setting.get_setting()
|
||||
elif setting.name == "IF Frequency":
|
||||
# Careful this doesn't only set the IF frequency but the local oscillator frequency
|
||||
elif setting.name == self.module.model.IF_FREQUENCY:
|
||||
lime.lof = self.module.model.target_frequency - setting.get_setting()
|
||||
elif setting.name == "Acquisition time":
|
||||
lime.tac = 82e-6
|
||||
elif setting.name == "Enable":
|
||||
lime.t3d[0] = int(setting.value)
|
||||
elif setting.name == "Gate padding left":
|
||||
lime.t3d[1] = int(setting.get_setting())
|
||||
elif setting.name == "Gate shift":
|
||||
lime.t3d[2] = int(setting.get_setting())
|
||||
elif setting.name == "Gate padding right":
|
||||
lime.t3d[3] = int(setting.get_setting())
|
||||
elif setting.name == "Acquisition time":
|
||||
self.module.model.if_frequency = setting.get_setting()
|
||||
elif setting.name == self.module.model.ACQUISITION_TIME:
|
||||
lime.tac = setting.get_setting()
|
||||
# Gate settings
|
||||
elif setting.name == self.module.model.GATE_ENABLE:
|
||||
lime.t3d[0] = int(setting.value)
|
||||
elif setting.name == self.module.model.GATE_PADDING_LEFT:
|
||||
lime.t3d[1] = int(setting.get_setting())
|
||||
elif setting.name == self.module.model.GATE_SHIFT:
|
||||
lime.t3d[2] = int(setting.get_setting())
|
||||
elif setting.name == self.module.model.GATE_PADDING_RIGHT:
|
||||
lime.t3d[3] = int(setting.get_setting())
|
||||
# RX/TX settings
|
||||
elif setting.name == self.module.model.TX_GAIN:
|
||||
lime.tgn = setting.get_setting()
|
||||
elif setting.name == self.module.model.RX_GAIN:
|
||||
lime.rgn = setting.get_setting()
|
||||
elif setting.name == self.module.model.RX_LPF_BW:
|
||||
lime.rlp = setting.get_setting()
|
||||
elif setting.name == self.module.model.TX_LPF_BW:
|
||||
lime.tlp = setting.get_setting()
|
||||
# Calibration settings
|
||||
elif setting.name == self.module.model.TX_I_DC_CORRECTION:
|
||||
lime.tdi = setting.get_setting()
|
||||
elif setting.name == self.module.model.TX_Q_DC_CORRECTION:
|
||||
lime.tdq = setting.get_setting()
|
||||
elif setting.name == self.module.model.TX_I_GAIN_CORRECTION:
|
||||
lime.tgi = setting.get_setting()
|
||||
elif setting.name == self.module.model.TX_Q_GAIN_CORRECTION:
|
||||
lime.tgq = setting.get_setting()
|
||||
elif setting.name == self.module.model.TX_PHASE_ADJUSTMENT:
|
||||
lime.tpc = setting.get_setting()
|
||||
elif setting.name == self.module.model.RX_I_DC_CORRECTION:
|
||||
lime.rdi = setting.get_setting()
|
||||
elif setting.name == self.module.model.RX_Q_DC_CORRECTION:
|
||||
lime.rdq = setting.get_setting()
|
||||
elif setting.name == self.module.model.RX_I_GAIN_CORRECTION:
|
||||
lime.rgi = setting.get_setting()
|
||||
elif setting.name == self.module.model.RX_Q_GAIN_CORRECTION:
|
||||
lime.rgq = setting.get_setting()
|
||||
elif setting.name == self.module.model.RX_PHASE_ADJUSTMENT:
|
||||
lime.rpc = setting.get_setting()
|
||||
|
||||
return lime
|
||||
|
||||
|
|
|
@ -8,41 +8,66 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
class LimeNQRModel(BaseSpectrometerModel):
|
||||
|
||||
# Setting constants for the names of the spectrometer settings
|
||||
FREQUENCY = "Frequency"
|
||||
AVERAGES = "Averages"
|
||||
SAMPLING_FREQUENCY = "Sampling Frequency"
|
||||
IF_FREQUENCY = "IF Frequency"
|
||||
ACQUISITION_TIME = "Acquisition time"
|
||||
GATE_ENABLE = "Enable"
|
||||
GATE_PADDING_LEFT = "Gate padding left"
|
||||
GATE_PADDING_RIGHT = "Gate padding right"
|
||||
GATE_SHIFT = "Gate shift"
|
||||
RX_GAIN = "RX Gain"
|
||||
TX_GAIN = "TX Gain"
|
||||
RX_LPF_BW = "RX LPF BW"
|
||||
TX_LPF_BW = "TX LPF BW"
|
||||
TX_I_DC_CORRECTION = "TX I DC correction"
|
||||
TX_Q_DC_CORRECTION = "TX Q DC correction"
|
||||
TX_I_GAIN_CORRECTION = "TX I Gain correction"
|
||||
TX_Q_GAIN_CORRECTION = "TX Q Gain correction"
|
||||
TX_PHASE_ADJUSTMENT = "TX phase adjustment"
|
||||
RX_I_DC_CORRECTION = "RX I DC correction"
|
||||
RX_Q_DC_CORRECTION = "RX Q DC correction"
|
||||
RX_I_GAIN_CORRECTION = "RX I Gain correction"
|
||||
RX_Q_GAIN_CORRECTION = "RX Q Gain correction"
|
||||
RX_PHASE_ADJUSTMENT = "RX phase adjustment"
|
||||
|
||||
def __init__(self, module) -> None:
|
||||
super().__init__(module)
|
||||
# Acquisition settings
|
||||
self.add_setting("Frequency", 100e6, "Experiment frequency", "Acquisition")
|
||||
self.add_setting(self.FREQUENCY, 100e6, "Experiment frequency", "Acquisition")
|
||||
self.target_frequency = 100e6
|
||||
self.add_setting("Averages", 100, "Number of averages", "Acquisition")
|
||||
self.add_setting("Sampling Frequency", 30.72e6 , "Sampling frequency", "Acquisition")
|
||||
self.add_setting("IF Frequency", 1.2e6, "IF frequency", "Acquisition")
|
||||
self.add_setting(self.AVERAGES, 100, "Number of averages", "Acquisition")
|
||||
self.add_setting(self.SAMPLING_FREQUENCY, 30.72e6 , "Sampling frequency", "Acquisition")
|
||||
self.add_setting(self.IF_FREQUENCY, 1.2e6, "IF Frequency", "Acquisition")
|
||||
self.if_frequency = 1.2e6
|
||||
self.add_setting("Acquisition time", 82e-6, "Acquisition time - this is from the beginning of the pulse sequence", "Acquisition")
|
||||
self.add_setting(self.ACQUISITION_TIME, 82e-6, "Acquisition time - this is from the beginning of the pulse sequence", "Acquisition")
|
||||
# Gate Settings
|
||||
self.add_setting("Enable", True, "Enable", "Gate Settings")
|
||||
self.add_setting("Gate padding left", 10, "Gate padding left", "Gate Settings")
|
||||
self.add_setting("Gate padding right", 10, "Gate padding right", "Gate Settings")
|
||||
self.add_setting("Gate shift", 53, "Gate shift", "Gate Settings")
|
||||
self.add_setting(self.GATE_ENABLE, True, "Enable", "Gate Settings")
|
||||
self.add_setting(self.GATE_PADDING_LEFT, 10, "Gate padding left", "Gate Settings")
|
||||
self.add_setting(self.GATE_PADDING_RIGHT, 10, "Gate padding right", "Gate Settings")
|
||||
self.add_setting(self.GATE_SHIFT, 53, "Gate shift", "Gate Settings")
|
||||
# RX/TX settings
|
||||
self.add_setting("RX Gain", 55, "RX Gain", "RX/TX Settings")
|
||||
self.add_setting("TX Gain", 40, "TX Gain", "RX/TX Settings")
|
||||
self.add_setting("RX LPF BW", 30.72e6/2, "RX LPF BW", "RX/TX Settings")
|
||||
self.add_setting("TX LPF BW", 130.0e6, "TX LPF BW", "RX/TX Settings")
|
||||
self.add_setting(self.RX_GAIN, 55, "RX Gain", "RX/TX Settings")
|
||||
self.add_setting(self.TX_GAIN, 40, "TX Gain", "RX/TX Settings")
|
||||
self.add_setting(self.RX_LPF_BW, 30.72e6/2, "RX LPF BW", "RX/TX Settings")
|
||||
self.add_setting(self.TX_LPF_BW, 130.0e6, "TX LPF BW", "RX/TX Settings")
|
||||
# Calibration settings
|
||||
self.add_setting("TX I DC correction", -45, "TX I DC correction", "Calibration")
|
||||
self.add_setting("TX Q DC correction", 0, "TX Q DC correction", "Calibration")
|
||||
self.add_setting("TX I Gain correction", 2047, "TX I Gain correction", "Calibration")
|
||||
self.add_setting("TX Q Gain correction", 2039, "TX Q Gain correction", "Calibration")
|
||||
self.add_setting("TX phase adjustment", 3, "TX phase adjustment", "Calibration")
|
||||
self.add_setting("RX I DC correction", 0, "TX I DC correction", "Calibration")
|
||||
self.add_setting("RX Q DC correction", 0, "TX Q DC correction", "Calibration")
|
||||
self.add_setting("RX I Gain correction", 2047, "TX I Gain correction", "Calibration")
|
||||
self.add_setting("RX Q Gain correction", 2047, "TX Q Gain correction", "Calibration")
|
||||
self.add_setting("RX phase adjustment", 0, "TX phase adjustment", "Calibration")
|
||||
self.add_setting(self.TX_I_DC_CORRECTION, -45, "TX I DC correction", "Calibration")
|
||||
self.add_setting(self.TX_Q_DC_CORRECTION, 0, "TX Q DC correction", "Calibration")
|
||||
self.add_setting(self.TX_I_GAIN_CORRECTION, 2047, "TX I Gain correction", "Calibration")
|
||||
self.add_setting(self.TX_Q_GAIN_CORRECTION, 2039, "TX Q Gain correction", "Calibration")
|
||||
self.add_setting(self.TX_PHASE_ADJUSTMENT, 3, "TX phase adjustment", "Calibration")
|
||||
self.add_setting(self.RX_I_DC_CORRECTION, 0, "RX I DC correction", "Calibration")
|
||||
self.add_setting(self.RX_Q_DC_CORRECTION, 0, "RX Q DC correction", "Calibration")
|
||||
self.add_setting(self.RX_I_GAIN_CORRECTION, 2047, "RX I Gain correction", "Calibration")
|
||||
self.add_setting(self.RX_Q_DC_CORRECTION, 2047, "TX Q Gain correction", "Calibration")
|
||||
self.add_setting(self.RX_PHASE_ADJUSTMENT, 0, "TX phase adjustment", "Calibration")
|
||||
|
||||
# Pulse parameter options
|
||||
self.add_pulse_parameter_option("TX", TXPulse)
|
||||
self.add_pulse_parameter_option("Gate", Gate)
|
||||
# self.add_pulse_parameter_option("Gate", Gate)
|
||||
self.add_pulse_parameter_option("RX", RXReadout)
|
||||
|
||||
# Try to load the pulse programmer module
|
||||
|
|
Loading…
Reference in a new issue