mirror of
https://github.com/nqrduck/nqrduck-spectrometer-simulator.git
synced 2024-12-30 11:18:07 +00:00
Changed to settings with categories.
This commit is contained in:
parent
b01f1a5334
commit
0c6dab95c9
2 changed files with 207 additions and 37 deletions
|
@ -214,8 +214,8 @@ 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_transmit=float(
|
||||
model.get_setting_by_name(model.Q_FACTOR_TRANSMIT).value
|
||||
),
|
||||
q_factor_receive=float(
|
||||
model.get_setting_by_name(model.Q_FACTOR_RECEIVE).value
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
import logging
|
||||
from nqrduck_spectrometer.base_spectrometer_model import BaseSpectrometerModel
|
||||
from nqrduck_spectrometer.pulseparameters import TXPulse, RXReadout
|
||||
from nqrduck_spectrometer.settings import (
|
||||
FloatSetting,
|
||||
IntSetting,
|
||||
BooleanSetting,
|
||||
SelectionSetting,
|
||||
StringSetting,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -17,7 +24,7 @@ class SimulatorModel(BaseSpectrometerModel):
|
|||
LENGTH_COIL = "Length coil (m)"
|
||||
DIAMETER_COIL = "Diameter coil (m)"
|
||||
NUMBER_TURNS = "Number turns"
|
||||
Q_FACTOR_TRANSMITT = "Q factor Transmitt"
|
||||
Q_FACTOR_TRANSMIT = "Q factor Transmit"
|
||||
Q_FACTOR_RECEIVE = "Q factor Receive"
|
||||
POWER_AMPLIFIER_POWER = "PA power (W)"
|
||||
GAIN = "Gain"
|
||||
|
@ -27,7 +34,7 @@ class SimulatorModel(BaseSpectrometerModel):
|
|||
LOSS_RX = "Loss RX (dB)"
|
||||
CONVERSION_FACTOR = "Conversion factor"
|
||||
|
||||
# Sample settinggs, this will be done in a seperate module later on
|
||||
# Sample settings, this will be done in a separate module later on
|
||||
NAME = "Name"
|
||||
DENSITY = "Density (g/cm^3)"
|
||||
MOLAR_MASS = "Molar mass (g/mol)"
|
||||
|
@ -59,53 +66,216 @@ class SimulatorModel(BaseSpectrometerModel):
|
|||
super().__init__(module)
|
||||
|
||||
# Simulation settings
|
||||
self.add_setting(
|
||||
number_of_points_setting = IntSetting(
|
||||
self.NUMBER_POINTS,
|
||||
8192,
|
||||
"Number of points used for the simulation. This influences the dwell time in combination with the total event simulation given by the pulse sequence. ",
|
||||
"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.add_setting(
|
||||
number_of_points_setting,
|
||||
self.SIMULATION,
|
||||
)
|
||||
self.add_setting(
|
||||
self.NUMBER_ISOCHROMATS, 1000, "Number of isochromats", self.SIMULATION
|
||||
|
||||
number_of_isochromats_setting = IntSetting(
|
||||
self.NUMBER_ISOCHROMATS,
|
||||
1000,
|
||||
"Number of isochromats used for the simulation. This influences the computation time.",
|
||||
)
|
||||
self.add_setting(number_of_isochromats_setting, self.SIMULATION)
|
||||
|
||||
initial_magnetization_setting = FloatSetting(
|
||||
self.INITIAL_MAGNETIZATION,
|
||||
1,
|
||||
"Initial magnetization",
|
||||
)
|
||||
self.add_setting(initial_magnetization_setting, self.SIMULATION)
|
||||
|
||||
# This doesn't really do anything yet
|
||||
gradient_setting = FloatSetting(
|
||||
self.GRADIENT,
|
||||
1,
|
||||
"Gradient",
|
||||
)
|
||||
self.add_setting(gradient_setting, self.SIMULATION)
|
||||
|
||||
noise_setting = FloatSetting(
|
||||
self.NOISE,
|
||||
2,
|
||||
"Noise",
|
||||
)
|
||||
self.add_setting(noise_setting, self.SIMULATION)
|
||||
|
||||
# Hardware settings
|
||||
coil_length_setting = FloatSetting(
|
||||
self.LENGTH_COIL,
|
||||
30e-3,
|
||||
"Length coil",
|
||||
)
|
||||
self.add_setting(coil_length_setting, self.HARDWARE)
|
||||
|
||||
coil_diameter_setting = FloatSetting(
|
||||
self.DIAMETER_COIL,
|
||||
8e-3,
|
||||
"Diameter coil",
|
||||
)
|
||||
self.add_setting(coil_diameter_setting, self.HARDWARE)
|
||||
|
||||
number_turns_setting = FloatSetting(
|
||||
self.NUMBER_TURNS,
|
||||
8,
|
||||
"Number turns",
|
||||
)
|
||||
self.add_setting(number_turns_setting, self.HARDWARE)
|
||||
|
||||
q_factor_transmit_setting = FloatSetting(
|
||||
self.Q_FACTOR_TRANSMIT,
|
||||
80,
|
||||
"Q factor Transmit",
|
||||
)
|
||||
self.add_setting(q_factor_transmit_setting, self.HARDWARE)
|
||||
|
||||
q_factor_receive_setting = FloatSetting(
|
||||
self.Q_FACTOR_RECEIVE,
|
||||
80,
|
||||
"Q factor Receive",
|
||||
)
|
||||
self.add_setting(q_factor_receive_setting, self.HARDWARE)
|
||||
|
||||
power_amplifier_power_setting = FloatSetting(
|
||||
self.POWER_AMPLIFIER_POWER,
|
||||
110,
|
||||
"Power amplifier power",
|
||||
)
|
||||
self.add_setting(
|
||||
self.INITIAL_MAGNETIZATION, 1, "Initial magnetization", self.SIMULATION
|
||||
power_amplifier_power_setting, self.HARDWARE
|
||||
)
|
||||
self.add_setting(self.GRADIENT, 1, "Gradient", self.SIMULATION)
|
||||
self.add_setting(self.NOISE, 2, "Noise", self.SIMULATION)
|
||||
self.add_setting(self.LENGTH_COIL, 30e-3, "Length coil", self.HARDWARE)
|
||||
self.add_setting(self.DIAMETER_COIL, 8e-3, "Diameter coil", self.HARDWARE)
|
||||
self.add_setting(self.NUMBER_TURNS, 8, "Number turns", self.HARDWARE)
|
||||
self.add_setting(self.Q_FACTOR_TRANSMITT, 80, "Q factor Transmitt", self.HARDWARE)
|
||||
self.add_setting(self.Q_FACTOR_RECEIVE, 80, "Q factor Receive", self.HARDWARE)
|
||||
self.add_setting(
|
||||
self.POWER_AMPLIFIER_POWER, 110, "Power amplifier power", self.HARDWARE
|
||||
|
||||
gain_setting = FloatSetting(
|
||||
self.GAIN,
|
||||
6000,
|
||||
"Gain of the complete measurement chain",
|
||||
)
|
||||
self.add_setting(
|
||||
self.GAIN, 6000, "Gain of the complete measurement chain", self.HARDWARE
|
||||
gain_setting, self.HARDWARE
|
||||
)
|
||||
|
||||
temperature_setting = FloatSetting(
|
||||
self.TEMPERATURE,
|
||||
300,
|
||||
"Temperature",
|
||||
)
|
||||
self.add_setting(temperature_setting, self.EXPERIMENTAL_Setup)
|
||||
|
||||
loss_tx_setting = FloatSetting(
|
||||
self.LOSS_TX,
|
||||
25,
|
||||
"Loss TX in dB",
|
||||
)
|
||||
self.add_setting(loss_tx_setting, self.EXPERIMENTAL_Setup)
|
||||
|
||||
loss_rx_setting = FloatSetting(
|
||||
self.LOSS_RX,
|
||||
25,
|
||||
"Loss RX in dB",
|
||||
)
|
||||
self.add_setting(loss_rx_setting, self.EXPERIMENTAL_Setup)
|
||||
|
||||
conversion_factor_setting = FloatSetting(
|
||||
self.CONVERSION_FACTOR,
|
||||
2884,
|
||||
"Conversion factor (spectrometer units / V)",
|
||||
)
|
||||
self.add_setting(self.TEMPERATURE, 300, "Temperature", self.EXPERIMENTAL_Setup)
|
||||
self.add_setting(self.LOSS_TX, 25, "Loss TX", self.EXPERIMENTAL_Setup)
|
||||
self.add_setting(self.LOSS_RX, 25, "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
|
||||
conversion_factor_setting,
|
||||
self.EXPERIMENTAL_Setup,
|
||||
) # Conversion factor for the LimeSDR based spectrometer
|
||||
|
||||
# Sample settings
|
||||
self.add_setting(self.NAME, "BiPh3", "Name", self.SAMPLE)
|
||||
self.add_setting(self.DENSITY, 1.585e6, "Density", self.SAMPLE)
|
||||
self.add_setting(self.MOLAR_MASS, 440.3, "Molar mass", self.SAMPLE)
|
||||
self.add_setting(
|
||||
self.RESONANT_FREQUENCY, 83.56e6, "Resonant frequency", self.SAMPLE
|
||||
sample_name_setting = StringSetting(
|
||||
self.NAME,
|
||||
"BiPh3",
|
||||
"Name",
|
||||
)
|
||||
self.add_setting(self.GAMMA, 4.342e7, "Gamma", self.SAMPLE)
|
||||
self.add_setting(self.NUCLEAR_SPIN, 9 / 2, "Nuclear spin", self.SAMPLE)
|
||||
self.add_setting(self.SPIN_FACTOR, 2, "Spin factor", self.SAMPLE)
|
||||
self.add_setting(self.POWDER_FACTOR, 0.75, "Powder factor", self.SAMPLE)
|
||||
self.add_setting(self.FILLING_FACTOR, 0.7, "Filling factor", self.SAMPLE)
|
||||
self.add_setting(self.T1, 83.5e-5, "T1", self.SAMPLE)
|
||||
self.add_setting(self.T2, 396e-6, "T2", self.SAMPLE)
|
||||
self.add_setting(self.T2_STAR, 50e-6, "T2*", self.SAMPLE)
|
||||
self.add_setting(sample_name_setting, self.SAMPLE)
|
||||
|
||||
density_setting = FloatSetting(
|
||||
self.DENSITY,
|
||||
1.585e6,
|
||||
"Density",
|
||||
)
|
||||
self.add_setting(density_setting, self.SAMPLE)
|
||||
|
||||
molar_mass_setting = FloatSetting(
|
||||
self.MOLAR_MASS,
|
||||
440.3,
|
||||
"Molar mass",
|
||||
)
|
||||
self.add_setting(molar_mass_setting, self.SAMPLE)
|
||||
|
||||
resonant_frequency_setting = FloatSetting(
|
||||
self.RESONANT_FREQUENCY,
|
||||
83.56e6,
|
||||
"Resonant frequency",
|
||||
)
|
||||
self.add_setting(
|
||||
resonant_frequency_setting, self.SAMPLE
|
||||
)
|
||||
|
||||
gamma_setting = FloatSetting(
|
||||
self.GAMMA,
|
||||
4.342e7,
|
||||
"Gamma",
|
||||
)
|
||||
self.add_setting(gamma_setting, self.SAMPLE)
|
||||
|
||||
nuclear_spin_setting = FloatSetting(
|
||||
self.NUCLEAR_SPIN,
|
||||
9 / 2,
|
||||
"Nuclear spin",
|
||||
)
|
||||
self.add_setting(nuclear_spin_setting, self.SAMPLE)
|
||||
|
||||
spin_factor_setting = FloatSetting(
|
||||
self.SPIN_FACTOR,
|
||||
2,
|
||||
"Spin factor",
|
||||
)
|
||||
self.add_setting(spin_factor_setting, self.SAMPLE)
|
||||
|
||||
powder_factor_setting = FloatSetting(
|
||||
self.POWDER_FACTOR,
|
||||
0.75,
|
||||
"Powder factor",
|
||||
)
|
||||
self.add_setting(powder_factor_setting, self.SAMPLE)
|
||||
|
||||
filling_factor_setting = FloatSetting(
|
||||
self.FILLING_FACTOR,
|
||||
0.7,
|
||||
"Filling factor",
|
||||
)
|
||||
self.add_setting(filling_factor_setting, self.SAMPLE)
|
||||
|
||||
t1_setting = FloatSetting(
|
||||
self.T1,
|
||||
83.5e-5,
|
||||
"T1",
|
||||
)
|
||||
self.add_setting(t1_setting, self.SAMPLE)
|
||||
|
||||
t2_setting = FloatSetting(
|
||||
self.T2,
|
||||
396e-6,
|
||||
"T2",
|
||||
)
|
||||
self.add_setting(t2_setting, self.SAMPLE)
|
||||
|
||||
t2_star_setting = FloatSetting(
|
||||
self.T2_STAR,
|
||||
50e-6,
|
||||
"T2*",
|
||||
)
|
||||
self.add_setting(t2_star_setting, self.SAMPLE)
|
||||
|
||||
# Pulse parameter options
|
||||
self.add_pulse_parameter_option(self.TX, TXPulse)
|
||||
|
|
Loading…
Reference in a new issue