Added name to measurement.

This commit is contained in:
jupfi 2024-05-05 15:17:40 +02:00
parent 1a6342e4cb
commit 1bceba1a0f

View file

@ -1,6 +1,7 @@
"""Controller module for the Lime NQR spectrometer.""" """Controller module for the Lime NQR spectrometer."""
import logging import logging
from datetime import datetime
import tempfile import tempfile
from pathlib import Path from pathlib import Path
import numpy as np import numpy as np
@ -64,6 +65,7 @@ class LimeNQRController(BaseSpectrometerController):
dwell_time = UnitConverter.to_float(dwell_time) * 1e6 dwell_time = UnitConverter.to_float(dwell_time) * 1e6
logger.debug("Dwell time: %s", dwell_time) logger.debug("Dwell time: %s", dwell_time)
logger.debug(f"Last tdx value: {measurement_data.tdx[-1]}") logger.debug(f"Last tdx value: {measurement_data.tdx[-1]}")
if dwell_time: if dwell_time:
n_data_points = int(measurement_data.tdx[-1] / dwell_time) n_data_points = int(measurement_data.tdx[-1] / dwell_time)
logger.debug("Resampling to %s data points", n_data_points) 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 0, measurement_data.tdx[-1], n_data_points, endpoint=False
) )
tdy = resample(measurement_data.tdy, n_data_points) tdy = resample(measurement_data.tdy, n_data_points)
name = measurement_data.name
measurement_data = Measurement( measurement_data = Measurement(
name,
tdx, tdx,
tdy, tdy,
self.module.model.target_frequency, self.module.model.target_frequency,
IF_frequency=self.module.model.if_frequency, IF_frequency=self.module.model.if_frequency,
) )
if measurement_data: if measurement_data:
self.emit_measurement_data(measurement_data) self.emit_measurement_data(measurement_data)
self.emit_status_message("Finished Measurement") self.emit_status_message("Finished Measurement")
@ -193,7 +195,11 @@ class LimeNQRController(BaseSpectrometerController):
evidx = self.find_evaluation_range_indices(hdf, rx_begin, rx_stop) evidx = self.find_evaluation_range_indices(hdf, rx_begin, rx_stop)
tdx, tdy = self.extract_measurement_data(lime, hdf, evidx) tdx, tdy = self.extract_measurement_data(lime, hdf, evidx)
fft_shift = self.get_fft_shift() 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( return Measurement(
name,
tdx, tdx,
tdy, tdy,
self.module.model.target_frequency, self.module.model.target_frequency,
@ -641,7 +647,7 @@ class LimeNQRController(BaseSpectrometerController):
result result
) # Reversed to maintain the original order if needed elsewhere ) # 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. """This method translates the RX event of the pulse sequence to the limr object.
Args: Args:
@ -702,7 +708,7 @@ class LimeNQRController(BaseSpectrometerController):
previous_events = events[: events.index(rx_event)] previous_events = events[: events.index(rx_event)]
return sum(event.duration for event in previous_events) 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. """This method calculates the offset for the RX event.
Args: Args: