From 901190e0680fe7e2d57561e7a26ced35ff15e3f8 Mon Sep 17 00:00:00 2001 From: jupfi Date: Wed, 2 Aug 2023 11:04:07 +0200 Subject: [PATCH] Fixed a bug where the pulse had the wrong freq. --- src/nqrduck_spectrometer_limenqr/controller.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/nqrduck_spectrometer_limenqr/controller.py b/src/nqrduck_spectrometer_limenqr/controller.py index 1285438..4760416 100644 --- a/src/nqrduck_spectrometer_limenqr/controller.py +++ b/src/nqrduck_spectrometer_limenqr/controller.py @@ -80,7 +80,8 @@ class LimeNQRController(BaseSpectrometerController): # time domain x and y data tdx = lime.HDF.tdx[evidx] - lime.HDF.tdx[evidx][0] - tdy = np.abs(lime.HDF.tdy[evidx] / lime.nav) + tdy = lime.HDF.tdy[evidx] / lime.nav + tdy = tdy - np.mean(tdy) measurement_data = Measurement( tdx, @@ -194,7 +195,16 @@ class LimeNQRController(BaseSpectrometerController): TXPulse.TX_PULSE_SHAPE ).value pulse_amplitude = abs(pulse_shape.get_pulse_amplitude(event.duration)) + # We need modulate the pulse amplitude by the IF frequency + # Create the complex exponential to shift the frequency + tdx = np.linspace(0, float(event.duration), int(float(event.duration) * lime.sra)) + shift_signal = np.cos(2 * np.pi * self.module.model.if_frequency * tdx) + + # Apply the shift by multiplying the time domain signal + pulse_amplitude = (pulse_amplitude * shift_signal) + pulse_amplitude /= np.max(pulse_amplitude) + if len(lime.pfr) == 0: # Add the TX pulse to the pulse frequency list (lime.pfr) lime.pfr = [ @@ -315,7 +325,7 @@ class LimeNQRController(BaseSpectrometerController): offset = self.module.model.OFFSET_FIRST_PULSE * (1 / lime.sra) rx_duration = event.duration - rx_begin = previous_events_duration + offset + CORRECTION_FACTOR + rx_begin = float(previous_events_duration) + offset + CORRECTION_FACTOR if rx_duration: rx_stop = rx_begin + float(rx_duration) return rx_begin * 1e6, rx_stop * 1e6