Changed to new spectrometer settings.

This commit is contained in:
jupfi 2024-03-02 20:30:08 +01:00
parent 5a44a17611
commit 7ff28685ab
2 changed files with 83 additions and 28 deletions

View file

@ -19,7 +19,7 @@ You can find more information about the installation of dependencies in the [Lim
Additional dependencies should be installed by the pyproject.toml file when installing this module. Additional dependencies should be installed by the pyproject.toml file when installing this module.
## Setup ### Setup
To install the module you need the NQRduck core. You can find the installation instructions for the NQRduck core [here](https://github.com/nqrduck/nqrduck). To install the module you need the NQRduck core. You can find the installation instructions for the NQRduck core [here](https://github.com/nqrduck/nqrduck).
Ideally you should install the module in a virtual environment. You can create a virtual environment by running the following command in the terminal: Ideally you should install the module in a virtual environment. You can create a virtual environment by running the following command in the terminal:

View file

@ -1,6 +1,7 @@
import logging import logging
from nqrduck_spectrometer.base_spectrometer_model import BaseSpectrometerModel from nqrduck_spectrometer.base_spectrometer_model import BaseSpectrometerModel
from nqrduck_spectrometer.pulseparameters import TXPulse, RXReadout from nqrduck_spectrometer.pulseparameters import TXPulse, RXReadout
from nqrduck_spectrometer.settings import FloatSetting, IntSetting, BooleanSetting, SelectionSetting
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -52,37 +53,91 @@ class LimeNQRModel(BaseSpectrometerModel):
def __init__(self, module) -> None: def __init__(self, module) -> None:
super().__init__(module) super().__init__(module)
# Acquisition settings # Acquisition settings
self.add_setting(self.CHANNEL, 0, "TX/RX Channel", self.ACQUISITION) channel_options = ["1", "2"]
self.add_setting(self.TX_MATCHING, 0, "TX Matching", self.ACQUISITION) channel_setting = SelectionSetting(self.CHANNEL, channel_options, "1", "TX/RX Channel")
self.add_setting(self.RX_MATCHING, 0, "RX Matching", self.ACQUISITION) self.add_setting(channel_setting, self.ACQUISITION)
self.add_setting(self.SAMPLING_FREQUENCY, 30.72e6 , "Sampling frequency", self.ACQUISITION)
self.add_setting(self.IF_FREQUENCY, 5e6, "IF Frequency", self.ACQUISITION) tx_matching_options = ["1", "2"]
self.if_frequency = 1.2e6 tx_matching_setting = SelectionSetting(self.TX_MATCHING, tx_matching_options, "1", "TX Matching")
self.add_setting(self.ACQUISITION_TIME, 82e-6, "Acquisition time - this is from the beginning of the pulse sequence", self.ACQUISITION) self.add_setting(tx_matching_setting, self.ACQUISITION)
rx_matching_options = ["1", "2"]
rx_matching_setting = SelectionSetting(self.RX_MATCHING, rx_matching_options, "1", "RX Matching")
self.add_setting(rx_matching_setting, self.ACQUISITION)
sampling_frequency_setting = FloatSetting(self.SAMPLING_FREQUENCY, 30.72e6, "Sampling frequency")
self.add_setting(sampling_frequency_setting, self.ACQUISITION)
if_frequency_setting = FloatSetting(self.IF_FREQUENCY, 5e6, "IF Frequency")
self.add_setting(if_frequency_setting, self.ACQUISITION)
self.if_frequency = 5e6
acquisition_time_setting = FloatSetting(self.ACQUISITION_TIME, 82e-6, "Acquisition time - this is from the beginning of the pulse sequence")
self.add_setting(acquisition_time_setting, self.ACQUISITION)
# Gate Settings # Gate Settings
self.add_setting(self.GATE_ENABLE, True, "Enable", self.GATE_SETTINGS) gate_enable_setting = BooleanSetting(self.GATE_ENABLE, True, "Enable")
self.add_setting(self.GATE_PADDING_LEFT, 10, "Gate padding left", self.GATE_SETTINGS) self.add_setting(gate_enable_setting, self.GATE_SETTINGS)
self.add_setting(self.GATE_PADDING_RIGHT, 10, "Gate padding right", self.GATE_SETTINGS)
self.add_setting(self.GATE_SHIFT, 53, "Gate shift", self.GATE_SETTINGS) gate_padding_left_setting = IntSetting(self.GATE_PADDING_LEFT, 10, "Gate padding left")
self.add_setting(gate_padding_left_setting, self.GATE_SETTINGS)
gate_padding_right_setting = IntSetting(self.GATE_PADDING_RIGHT, 10, "Gate padding right")
self.add_setting(gate_padding_right_setting, self.GATE_SETTINGS)
gate_shift_setting = IntSetting(self.GATE_SHIFT, 53, "Gate shift")
self.add_setting(gate_shift_setting, self.GATE_SETTINGS)
# RX/TX settings # RX/TX settings
self.add_setting(self.RX_GAIN, 55, "RX Gain", self.RX_TX_SETTINGS) rx_gain_setting = IntSetting(self.RX_GAIN, 55, "RX Gain")
self.add_setting(self.TX_GAIN, 30, "TX Gain", self.RX_TX_SETTINGS) self.add_setting(rx_gain_setting, self.RX_TX_SETTINGS)
self.add_setting(self.RX_LPF_BW, 30.72e6/2, "RX LPF BW", self.RX_TX_SETTINGS)
self.add_setting(self.TX_LPF_BW, 130.0e6, "TX LPF BW", self.RX_TX_SETTINGS) tx_gain_setting = IntSetting(self.TX_GAIN, 30, "TX Gain")
self.add_setting(tx_gain_setting, self.RX_TX_SETTINGS)
rx_lpf_bw_setting = FloatSetting(self.RX_LPF_BW, 30.72e6/2, "RX LPF BW")
self.add_setting(rx_lpf_bw_setting, self.RX_TX_SETTINGS)
tx_lpf_bw_setting = FloatSetting(self.TX_LPF_BW, 130.0e6, "TX LPF BW")
self.add_setting(tx_lpf_bw_setting, self.RX_TX_SETTINGS)
# Calibration settings # Calibration settings
self.add_setting(self.TX_I_DC_CORRECTION, -45, "TX I DC correction", self.CALIBRATION) tx_i_dc_correction_setting = IntSetting(self.TX_I_DC_CORRECTION, -45, "TX I DC correction")
self.add_setting(self.TX_Q_DC_CORRECTION, 0, "TX Q DC correction", self.CALIBRATION) self.add_setting(tx_i_dc_correction_setting, self.CALIBRATION)
self.add_setting(self.TX_I_GAIN_CORRECTION, 2047, "TX I Gain correction", self.CALIBRATION)
self.add_setting(self.TX_Q_GAIN_CORRECTION, 2039, "TX Q Gain correction", self.CALIBRATION) tx_q_dc_correction_setting = IntSetting(self.TX_Q_DC_CORRECTION, 0, "TX Q DC correction")
self.add_setting(self.TX_PHASE_ADJUSTMENT, 3, "TX phase adjustment", self.CALIBRATION) self.add_setting(tx_q_dc_correction_setting, self.CALIBRATION)
self.add_setting(self.RX_I_DC_CORRECTION, 0, "RX I DC correction", self.CALIBRATION)
self.add_setting(self.RX_Q_DC_CORRECTION, 0, "RX Q DC correction", self.CALIBRATION) tx_i_gain_correction_setting = IntSetting(self.TX_I_GAIN_CORRECTION, 2047, "TX I Gain correction")
self.add_setting(self.RX_I_GAIN_CORRECTION, 2047, "RX I Gain correction", self.CALIBRATION) self.add_setting(tx_i_gain_correction_setting, 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) tx_q_gain_correction_setting = IntSetting(self.TX_Q_GAIN_CORRECTION, 2039, "TX Q Gain correction")
self.add_setting(tx_q_gain_correction_setting, self.CALIBRATION)
tx_phase_adjustment_setting = IntSetting(self.TX_PHASE_ADJUSTMENT, 3, "TX phase adjustment")
self.add_setting(tx_phase_adjustment_setting, self.CALIBRATION)
rx_i_dc_correction_setting = IntSetting(self.RX_I_DC_CORRECTION, 0, "RX I DC correction")
self.add_setting(rx_i_dc_correction_setting, self.CALIBRATION)
rx_q_dc_correction_setting = IntSetting(self.RX_Q_DC_CORRECTION, 0, "RX Q DC correction")
self.add_setting(rx_q_dc_correction_setting, self.CALIBRATION)
rx_i_gain_correction_setting = IntSetting(self.RX_I_GAIN_CORRECTION, 2047, "RX I Gain correction")
self.add_setting(rx_i_gain_correction_setting, self.CALIBRATION)
rx_q_gain_correction_setting = IntSetting(self.RX_Q_GAIN_CORRECTION, 2047, "RX Q Gain correction")
self.add_setting(rx_q_gain_correction_setting, self.CALIBRATION)
rx_phase_adjustment_setting = IntSetting(self.RX_PHASE_ADJUSTMENT, 0, "RX phase adjustment")
self.add_setting(rx_phase_adjustment_setting, self.CALIBRATION)
# Signal Processing settings # 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) rx_offset_setting = FloatSetting(self.RX_OFFSET, 2.4e-6, "The offset of the RX event, this changes all the time")
self.add_setting(self.FFT_SHIFT, False, "FFT shift", self.SIGNAL_PROCESSING) self.add_setting(rx_offset_setting, self.SIGNAL_PROCESSING)
fft_shift_setting = BooleanSetting(self.FFT_SHIFT, False, "FFT shift")
self.add_setting(fft_shift_setting, self.SIGNAL_PROCESSING)
# Pulse parameter options # Pulse parameter options
self.add_pulse_parameter_option(self.TX, TXPulse) self.add_pulse_parameter_option(self.TX, TXPulse)