From e9326c7590b02ad22f565b24193da380665b861d Mon Sep 17 00:00:00 2001 From: jupfi Date: Thu, 14 Dec 2023 15:13:29 +0100 Subject: [PATCH] Added Q Factor and Conversion Factor. --- .../controller.py | 15 +++++++++++--- src/nqrduck_spectrometer_simulator/model.py | 20 ++++++++++++++----- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/nqrduck_spectrometer_simulator/controller.py b/src/nqrduck_spectrometer_simulator/controller.py index 1b89a3a..04ec2e6 100644 --- a/src/nqrduck_spectrometer_simulator/controller.py +++ b/src/nqrduck_spectrometer_simulator/controller.py @@ -30,7 +30,7 @@ class SimulatorController(BaseSpectrometerController): simulation = self.get_simulation(sample, pulse_array) - result = simulation.simulate() * 1/1622137.746 + result = simulation.simulate() tdx = ( np.linspace(0, float(self.calculate_simulation_length()), len(result)) * 1e6 @@ -41,11 +41,11 @@ class SimulatorController(BaseSpectrometerController): if rx_begin and rx_stop: evidx = np.where((tdx > rx_begin) & (tdx < rx_stop))[0] tdx = tdx[evidx] - result = result[evidx] + result = result[evidx] * 1e-2 # Unit correction measurement_data = Measurement( tdx, - result, + result / simulation.averages, sample.resonant_frequency, # frequency_shift=self.module.model.if_frequency, ) @@ -214,6 +214,12 @@ class SimulatorController(BaseSpectrometerController): length_coil=float(model.get_setting_by_name(model.LENGTH_COIL).value), diameter_coil=float(model.get_setting_by_name(model.DIAMETER_COIL).value), number_turns=float(model.get_setting_by_name(model.NUMBER_TURNS).value), + q_factor_transmitt=float( + model.get_setting_by_name(model.Q_FACTOR_TRANSMITT).value + ), + q_factor_receive=float( + model.get_setting_by_name(model.Q_FACTOR_RECEIVE).value + ), power_amplifier_power=float( model.get_setting_by_name(model.POWER_AMPLIFIER_POWER).value ), @@ -222,6 +228,9 @@ class SimulatorController(BaseSpectrometerController): averages=int(model.averages), loss_TX=float(model.get_setting_by_name(model.LOSS_TX).value), loss_RX=float(model.get_setting_by_name(model.LOSS_RX).value), + conversion_factor=float( + model.get_setting_by_name(model.CONVERSION_FACTOR).value + ), ) return simulation diff --git a/src/nqrduck_spectrometer_simulator/model.py b/src/nqrduck_spectrometer_simulator/model.py index dd12363..4fd8fa9 100644 --- a/src/nqrduck_spectrometer_simulator/model.py +++ b/src/nqrduck_spectrometer_simulator/model.py @@ -12,15 +12,20 @@ class SimulatorModel(BaseSpectrometerModel): INITIAL_MAGNETIZATION = "Initial magnetization" GRADIENT = "Gradient (mT/m))" NOISE = "Noise (uV)" + + # Hardware settings LENGTH_COIL = "Length coil (m)" DIAMETER_COIL = "Diameter coil (m)" NUMBER_TURNS = "Number turns" + Q_FACTOR_TRANSMITT = "Q factor Transmitt" + Q_FACTOR_RECEIVE = "Q factor Receive" POWER_AMPLIFIER_POWER = "PA power (W)" GAIN = "Gain" TEMPERATURE = "Temperature (K)" AVERAGES = "Averages" LOSS_TX = "Loss TX (dB)" LOSS_RX = "Loss RX (dB)" + CONVERSION_FACTOR = "Conversion factor" # Sample settinggs, this will be done in a seperate module later on NAME = "Name" @@ -56,7 +61,7 @@ class SimulatorModel(BaseSpectrometerModel): # Simulation settings self.add_setting( self.NUMBER_POINTS, - 1024, + 4096, "Number of points used for the simulation. This influences the dwell time in combination with the total event simulation given by the pulse sequence. ", self.SIMULATION, ) @@ -67,19 +72,24 @@ class SimulatorModel(BaseSpectrometerModel): self.INITIAL_MAGNETIZATION, 1, "Initial magnetization", self.SIMULATION ) self.add_setting(self.GRADIENT, 1, "Gradient", self.SIMULATION) - self.add_setting(self.NOISE, 2000, "Noise", self.SIMULATION) + self.add_setting(self.NOISE, 2, "Noise", self.SIMULATION) self.add_setting(self.LENGTH_COIL, 6e-3, "Length coil", self.HARDWARE) self.add_setting(self.DIAMETER_COIL, 3e-3, "Diameter coil", self.HARDWARE) self.add_setting(self.NUMBER_TURNS, 9, "Number turns", self.HARDWARE) + self.add_setting(self.Q_FACTOR_TRANSMITT, 100, "Q factor Transmitt", self.HARDWARE) + self.add_setting(self.Q_FACTOR_RECEIVE, 100, "Q factor Receive", self.HARDWARE) self.add_setting( - self.POWER_AMPLIFIER_POWER, 500, "Power amplifier power", self.HARDWARE + self.POWER_AMPLIFIER_POWER, 110, "Power amplifier power", self.HARDWARE ) self.add_setting( self.GAIN, 6000, "Gain of the complete measurement chain", self.HARDWARE ) self.add_setting(self.TEMPERATURE, 300, "Temperature", self.EXPERIMENTAL_Setup) - self.add_setting(self.LOSS_TX, 12, "Loss TX", self.EXPERIMENTAL_Setup) - self.add_setting(self.LOSS_RX, 12, "Loss RX", self.EXPERIMENTAL_Setup) + self.add_setting(self.LOSS_TX, 30, "Loss TX", self.EXPERIMENTAL_Setup) + self.add_setting(self.LOSS_RX, 30, "Loss RX", self.EXPERIMENTAL_Setup) + self.add_setting( + self.CONVERSION_FACTOR, 2884, "Conversion factor (spectrometer units / V)", self.EXPERIMENTAL_Setup + ) # Conversion factor for the LimeSDR based spectrometer # Sample settings self.add_setting(self.NAME, "BiPh3", "Name", self.SAMPLE)