From 51af43d74c6f10e4786315a86a1c731bd2d1a8cd Mon Sep 17 00:00:00 2001 From: jupfi Date: Wed, 2 Aug 2023 21:34:07 +0200 Subject: [PATCH] Fixed problem with pulse clipping. --- src/nqrduck_spectrometer_limenqr/controller.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/nqrduck_spectrometer_limenqr/controller.py b/src/nqrduck_spectrometer_limenqr/controller.py index 81eeae3..bb462f0 100644 --- a/src/nqrduck_spectrometer_limenqr/controller.py +++ b/src/nqrduck_spectrometer_limenqr/controller.py @@ -203,8 +203,14 @@ class LimeNQRController(BaseSpectrometerController): # Apply the shift by multiplying the time domain signal pulse_amplitude = (pulse_amplitude * shift_signal) - # Normalize the pulse amplitude - pulse_amplitude /= np.max(pulse_amplitude) + # Apply the relative amplitude + pulse_amplitude *= parameter.get_option_by_name(TXPulse.RELATIVE_AMPLITUDE).value + + # Clip the pulse amplitude to a minimum and maximum value of -0.99 and 0.99 + # this is kind of ugly but it prevents some kind of issue with the pulse clipping + # I'm not sure why this happens but it seems to be related to the pulse shape + # rectangular pulses seem to be the most effected by this + pulse_amplitude = np.clip(pulse_amplitude, -0.99, 0.99) if len(lime.pfr) == 0: # Add the TX pulse to the pulse frequency list (lime.pfr)