From 222e5fe252b9d204c34291cf6baf204d3d27b0cd Mon Sep 17 00:00:00 2001 From: jupfi Date: Sun, 10 Dec 2023 08:18:47 +0100 Subject: [PATCH] Added two SP settings. --- src/nqrduck_spectrometer_limenqr/controller.py | 14 +++++++++++--- src/nqrduck_spectrometer_limenqr/model.py | 6 ++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/nqrduck_spectrometer_limenqr/controller.py b/src/nqrduck_spectrometer_limenqr/controller.py index 875daa6..b2938e6 100644 --- a/src/nqrduck_spectrometer_limenqr/controller.py +++ b/src/nqrduck_spectrometer_limenqr/controller.py @@ -84,11 +84,18 @@ class LimeNQRController(BaseSpectrometerController): tdx = lime.HDF.tdx[evidx] - lime.HDF.tdx[evidx][0] tdy = lime.HDF.tdy[evidx] / lime.nav + fft_shift = self.module.model.get_setting_by_name(self.module.model.FFT_SHIFT).value + + if fft_shift: + fft_shift = self.module.model.if_frequency + else: + fft_shift = 0 + measurement_data = Measurement( tdx, tdy, self.module.model.target_frequency, - # frequency_shift=self.module.model.if_frequency, + frequency_shift=fft_shift, ) # Emit the data to the nqrduck core @@ -120,7 +127,7 @@ class LimeNQRController(BaseSpectrometerController): # 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 + self.module.model.target_frequency - setting.get_setting() ) self.module.model.if_frequency = setting.get_setting() elif setting.name == self.module.model.ACQUISITION_TIME: @@ -330,7 +337,8 @@ class LimeNQRController(BaseSpectrometerController): Returns: tuple: A tuple containing the start and stop time of the RX event in µs""" # This is a correction factor for the RX event. The offset of the first pulse is 2.2µs longer than from the specified samples. - CORRECTION_FACTOR = 2.4e-6 + #CORRECTION_FACTOR = 2.4e-6 + CORRECTION_FACTOR = self.module.model.get_setting_by_name(self.module.model.RX_OFFSET).value events = self.module.model.pulse_programmer.model.pulse_sequence.events previous_events_duration = 0 diff --git a/src/nqrduck_spectrometer_limenqr/model.py b/src/nqrduck_spectrometer_limenqr/model.py index a02dc8f..418633b 100644 --- a/src/nqrduck_spectrometer_limenqr/model.py +++ b/src/nqrduck_spectrometer_limenqr/model.py @@ -28,12 +28,15 @@ class LimeNQRModel(BaseSpectrometerModel): RX_I_GAIN_CORRECTION = "RX I Gain correction" RX_Q_GAIN_CORRECTION = "RX Q Gain correction" RX_PHASE_ADJUSTMENT = "RX phase adjustment" + RX_OFFSET = "RX offset" + FFT_SHIFT = "FFT shift" # Constants for the Categories of the settings ACQUISITION = "Acquisition" GATE_SETTINGS = "Gate Settings" RX_TX_SETTINGS = "RX/TX Settings" CALIBRATION = "Calibration" + SIGNAL_PROCESSING = "Signal Processing" # Pulse parameter constants TX = "TX" @@ -71,6 +74,9 @@ class LimeNQRModel(BaseSpectrometerModel): self.add_setting(self.RX_I_GAIN_CORRECTION, 2047, "RX I Gain correction", self.CALIBRATION) self.add_setting(self.RX_Q_DC_CORRECTION, 2047, "TX Q Gain correction", self.CALIBRATION) self.add_setting(self.RX_PHASE_ADJUSTMENT, 0, "TX phase adjustment", self.CALIBRATION) + # Signal Processing settings + self.add_setting(self.RX_OFFSET, 2.4e-6, "The offset of the RX event, this changes all the time", self.SIGNAL_PROCESSING) + self.add_setting(self.FFT_SHIFT, False, "FFT shift", self.SIGNAL_PROCESSING) # Pulse parameter options self.add_pulse_parameter_option(self.TX, TXPulse)