mirror of
https://github.com/nqrduck/nqrduck-spectrometer-limenqr.git
synced 2024-12-22 15:37:46 +00:00
Changed spectrometer driver.
This commit is contained in:
parent
797234e9a2
commit
224e15f44a
4 changed files with 32 additions and 40 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -24,4 +24,6 @@ venv/
|
||||||
# Contrib files without permission
|
# Contrib files without permission
|
||||||
src/nqrduck_spectrometer_limenqr/contrib/limr.py
|
src/nqrduck_spectrometer_limenqr/contrib/limr.py
|
||||||
src/nqrduck_spectrometer_limenqr/contrib/pulseN_test_USB.cpp
|
src/nqrduck_spectrometer_limenqr/contrib/pulseN_test_USB.cpp
|
||||||
src/nqrduck_spectrometer_limenqr/contrib/pulseN_test_USB
|
src/nqrduck_spectrometer_limenqr/contrib/pulseN_test_USB
|
||||||
|
src/nqrduck_spectrometer_limenqr/contrib/pulseN_test_USB_TX2
|
||||||
|
src/nqrduck_spectrometer_limenqr/contrib/pulseN_test_USB_TX2.cpp
|
|
@ -1,7 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
import tempfile
|
import tempfile
|
||||||
from scipy.fftpack import fft, fftshift, fftfreq
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from nqrduck.module.module_controller import ModuleController
|
from nqrduck.module.module_controller import ModuleController
|
||||||
|
@ -27,7 +25,7 @@ class LimeNQRController(BaseSpectrometerController):
|
||||||
from .contrib.limr import limr
|
from .contrib.limr import limr
|
||||||
|
|
||||||
self_path = Path(__file__).parent
|
self_path = Path(__file__).parent
|
||||||
driver_path = str(self_path / "contrib/pulseN_test_USB.cpp")
|
driver_path = str(self_path / "contrib/pulseN_test_USB_TX2.cpp")
|
||||||
lime = limr(driver_path)
|
lime = limr(driver_path)
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
logger.error("Error while importing limr. %s", e)
|
logger.error("Error while importing limr. %s", e)
|
||||||
|
@ -91,6 +89,14 @@ class LimeNQRController(BaseSpectrometerController):
|
||||||
self.module.nqrduck_signal.emit("measurement_data", measurement_data)
|
self.module.nqrduck_signal.emit("measurement_data", measurement_data)
|
||||||
|
|
||||||
def update_settings(self, lime):
|
def update_settings(self, lime):
|
||||||
|
"""This method sets the parameters of the limr object according to the settings set in the spectrometer module.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
lime (limr): The limr object that is used to communicate with the pulseN driver
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
limr: The updated limr object"""
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Updating settings for spectrometer: %s for measurement",
|
"Updating settings for spectrometer: %s for measurement",
|
||||||
self.module.model.name,
|
self.module.model.name,
|
||||||
|
@ -241,6 +247,14 @@ class LimeNQRController(BaseSpectrometerController):
|
||||||
return lime
|
return lime
|
||||||
|
|
||||||
def translate_rx_event(self, lime):
|
def translate_rx_event(self, lime):
|
||||||
|
"""This method translates the RX event of the pulse sequence to the limr object.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
lime (limr): The limr object that is used to communicate with the pulseN driver
|
||||||
|
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
tuple: A tuple containing the start and stop time of the RX event in µs"""
|
||||||
# This is a correction factor for the RX event. The offset of the first pulse is 2.2µs longer than from the specified samples.
|
# This is a correction factor for the RX event. The offset of the first pulse is 2.2µs longer than from the specified samples.
|
||||||
CORRECTION_FACTOR = 2.2e-6
|
CORRECTION_FACTOR = 2.2e-6
|
||||||
events = self.module.model.pulse_programmer.model.pulse_sequence.events
|
events = self.module.model.pulse_programmer.model.pulse_sequence.events
|
||||||
|
@ -257,7 +271,7 @@ class LimeNQRController(BaseSpectrometerController):
|
||||||
|
|
||||||
if (
|
if (
|
||||||
parameter.name == self.module.model.RX
|
parameter.name == self.module.model.RX
|
||||||
and parameter.options["RX"].state
|
and parameter.options["RX"].value
|
||||||
):
|
):
|
||||||
# Get the length of all previous events
|
# Get the length of all previous events
|
||||||
previous_events = events[: events.index(event)]
|
previous_events = events[: events.index(event)]
|
||||||
|
@ -275,7 +289,12 @@ class LimeNQRController(BaseSpectrometerController):
|
||||||
|
|
||||||
else: return None, None
|
else: return None, None
|
||||||
|
|
||||||
def set_frequency(self, value):
|
def set_frequency(self, value : float):
|
||||||
|
"""This method sets the target frequency of the spectrometer.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value (float): The target frequency in MHz
|
||||||
|
"""
|
||||||
logger.debug("Setting frequency to: %s", value)
|
logger.debug("Setting frequency to: %s", value)
|
||||||
try:
|
try:
|
||||||
self.module.model.target_frequency = float(value)
|
self.module.model.target_frequency = float(value)
|
||||||
|
@ -285,7 +304,11 @@ class LimeNQRController(BaseSpectrometerController):
|
||||||
self.module.nqrduck_signal.emit("notification", ["Error", "Could not set frequency to: " + value])
|
self.module.nqrduck_signal.emit("notification", ["Error", "Could not set frequency to: " + value])
|
||||||
self.module.nqrduck_signal.emit("failure_set_frequency", value)
|
self.module.nqrduck_signal.emit("failure_set_frequency", value)
|
||||||
|
|
||||||
def set_averages(self, value):
|
def set_averages(self, value : int):
|
||||||
|
"""This method sets the number of averages for the spectrometer.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
value (int): The number of averages"""
|
||||||
logger.debug("Setting averages to: %s", value)
|
logger.debug("Setting averages to: %s", value)
|
||||||
try:
|
try:
|
||||||
self.module.model.averages = int(value)
|
self.module.model.averages = int(value)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from PyQt6.QtWidgets import QWidget
|
|
||||||
from nqrduck_spectrometer.base_spectrometer_view import BaseSpectrometerView
|
from nqrduck_spectrometer.base_spectrometer_view import BaseSpectrometerView
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
# Form implementation generated from reading ui file '../Modules/nqrduck-spectrometer-limenqr/src/nqrduck_spectrometer_limenqr/resources/limenqr_widget.ui'
|
|
||||||
#
|
|
||||||
# Created by: PyQt6 UI code generator 6.5.1
|
|
||||||
#
|
|
||||||
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
|
||||||
# run again. Do not edit this file unless you know what you are doing.
|
|
||||||
|
|
||||||
|
|
||||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
|
||||||
|
|
||||||
|
|
||||||
class Ui_Form(object):
|
|
||||||
def setupUi(self, Form):
|
|
||||||
Form.setObjectName("Form")
|
|
||||||
Form.resize(800, 600)
|
|
||||||
self.gridLayoutWidget = QtWidgets.QWidget(parent=Form)
|
|
||||||
self.gridLayoutWidget.setGeometry(QtCore.QRect(-1, -1, 811, 611))
|
|
||||||
self.gridLayoutWidget.setObjectName("gridLayoutWidget")
|
|
||||||
self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget)
|
|
||||||
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
|
||||||
self.gridLayout.setObjectName("gridLayout")
|
|
||||||
self.pushButton = QtWidgets.QPushButton(parent=self.gridLayoutWidget)
|
|
||||||
self.pushButton.setObjectName("pushButton")
|
|
||||||
self.gridLayout.addWidget(self.pushButton, 0, 0, 1, 1)
|
|
||||||
|
|
||||||
self.retranslateUi(Form)
|
|
||||||
QtCore.QMetaObject.connectSlotsByName(Form)
|
|
||||||
|
|
||||||
def retranslateUi(self, Form):
|
|
||||||
_translate = QtCore.QCoreApplication.translate
|
|
||||||
Form.setWindowTitle(_translate("Form", "Form"))
|
|
||||||
self.pushButton.setText(_translate("Form", "Quack!"))
|
|
Loading…
Reference in a new issue