From f0933c77052b4d6e2d3acfe238dc8753e29f4aaf Mon Sep 17 00:00:00 2001 From: jupfi Date: Mon, 17 Jul 2023 11:29:36 +0200 Subject: [PATCH] Added measurement class, changed signal type. --- .../base_spectrometer_model.py | 1 + src/nqrduck_spectrometer/controller.py | 2 +- src/nqrduck_spectrometer/measurement.py | 39 +++++++++++++++++++ .../{pulse_sequence.py => pulsesequence.py} | 0 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/nqrduck_spectrometer/measurement.py rename src/nqrduck_spectrometer/{pulse_sequence.py => pulsesequence.py} (100%) diff --git a/src/nqrduck_spectrometer/base_spectrometer_model.py b/src/nqrduck_spectrometer/base_spectrometer_model.py index 44a26d4..1325745 100644 --- a/src/nqrduck_spectrometer/base_spectrometer_model.py +++ b/src/nqrduck_spectrometer/base_spectrometer_model.py @@ -35,6 +35,7 @@ class BaseSpectrometerModel(ModuleModel): def get_setting(self): return float(self.value) + class PulseParameter: def __init__(self, name): diff --git a/src/nqrduck_spectrometer/controller.py b/src/nqrduck_spectrometer/controller.py index a3a5a4d..3834d87 100644 --- a/src/nqrduck_spectrometer/controller.py +++ b/src/nqrduck_spectrometer/controller.py @@ -40,7 +40,7 @@ class SpectrometerController(ModuleController): self._module.view.create_menu_entry() - def process_signals(self, key: str, value: str): + def process_signals(self, key: str, value: None): if key == "start_measurement": self.on_measurement_start() diff --git a/src/nqrduck_spectrometer/measurement.py b/src/nqrduck_spectrometer/measurement.py new file mode 100644 index 0000000..844a308 --- /dev/null +++ b/src/nqrduck_spectrometer/measurement.py @@ -0,0 +1,39 @@ +class Measurement(): + """This class defines how measurement data should look. + It includes pulse parameters necessary for further signal processing. + Every spectrometer should adhere to this data structure in order to be compatible with the rest of the nqrduck. + """ + + def __init__(self, tdx, tdy, target_frequency) -> None: + self.tdx = tdx + self.tdy = tdy + self.target_frequency = target_frequency + + # Measurement data + @property + def tdx(self): + """Time axis for the x axis of the measurement data.""" + return self._tdx + + @tdx.setter + def tdx(self, value): + self._tdx = value + + @property + def tdy(self): + """Time axis for the y axis of the measurement data.""" + return self._tdy + + @tdy.setter + def tdy(self, value): + self._tdy = value + + # Pulse parameters + @property + def target_frequency(self): + """Target frequency of the measurement.""" + return self._target_frequency + + @target_frequency.setter + def target_frequency(self, value): + self._target_frequency = value diff --git a/src/nqrduck_spectrometer/pulse_sequence.py b/src/nqrduck_spectrometer/pulsesequence.py similarity index 100% rename from src/nqrduck_spectrometer/pulse_sequence.py rename to src/nqrduck_spectrometer/pulsesequence.py