diff --git a/src/nqrduck_spectrometer_limenqr/controller.py b/src/nqrduck_spectrometer_limenqr/controller.py index a478e6b..dabbe5c 100644 --- a/src/nqrduck_spectrometer_limenqr/controller.py +++ b/src/nqrduck_spectrometer_limenqr/controller.py @@ -1,6 +1,7 @@ """Controller module for the Lime NQR spectrometer.""" import logging +from datetime import datetime import tempfile from pathlib import Path import numpy as np @@ -64,6 +65,7 @@ class LimeNQRController(BaseSpectrometerController): dwell_time = UnitConverter.to_float(dwell_time) * 1e6 logger.debug("Dwell time: %s", dwell_time) logger.debug(f"Last tdx value: {measurement_data.tdx[-1]}") + if dwell_time: n_data_points = int(measurement_data.tdx[-1] / dwell_time) logger.debug("Resampling to %s data points", n_data_points) @@ -71,15 +73,15 @@ class LimeNQRController(BaseSpectrometerController): 0, measurement_data.tdx[-1], n_data_points, endpoint=False ) tdy = resample(measurement_data.tdy, n_data_points) + name = measurement_data.name measurement_data = Measurement( + name, tdx, tdy, self.module.model.target_frequency, IF_frequency=self.module.model.if_frequency, ) - - if measurement_data: self.emit_measurement_data(measurement_data) self.emit_status_message("Finished Measurement") @@ -193,7 +195,11 @@ class LimeNQRController(BaseSpectrometerController): evidx = self.find_evaluation_range_indices(hdf, rx_begin, rx_stop) tdx, tdy = self.extract_measurement_data(lime, hdf, evidx) fft_shift = self.get_fft_shift() + # Measurement name date + module + target frequency + averages + sequence name + name = f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - LimeNQR - {self.module.model.target_frequency / 1e6} MHz - {self.module.model.averages} averages - {self.module.model.pulse_programmer.model.pulse_sequence.name}.quack" + logger.debug(f"Measurement name: {name}") return Measurement( + name, tdx, tdy, self.module.model.target_frequency, @@ -641,7 +647,7 @@ class LimeNQRController(BaseSpectrometerController): result ) # Reversed to maintain the original order if needed elsewhere - def translate_rx_event(self, lime : PyLimeConfig) -> tuple: + def translate_rx_event(self, lime: PyLimeConfig) -> tuple: """This method translates the RX event of the pulse sequence to the limr object. Args: @@ -702,7 +708,7 @@ class LimeNQRController(BaseSpectrometerController): previous_events = events[: events.index(rx_event)] return sum(event.duration for event in previous_events) - def calculate_offset(self, lime :PyLimeConfig) -> float: + def calculate_offset(self, lime: PyLimeConfig) -> float: """This method calculates the offset for the RX event. Args: