mirror of
https://github.com/nqrduck/nqrduck-spectrometer.git
synced 2024-12-22 08:17:49 +00:00
Added basic pulse parameters
This commit is contained in:
parent
8b0afc8d2d
commit
6c01242112
5 changed files with 69 additions and 3 deletions
|
@ -14,8 +14,8 @@ class BaseSpectrometerModel(ModuleModel):
|
|||
def add_setting(self, name, value, description) -> None:
|
||||
self.settings[name] = self.Setting(name, value, description)
|
||||
|
||||
def add_pulse_parameter_option(self, name, options) -> None:
|
||||
self.pulse_parameter_options[name] = options
|
||||
def add_pulse_parameter_option(self, name, pulse_parameter_class) -> None:
|
||||
self.pulse_parameter_options[name] = pulse_parameter_class
|
||||
|
||||
class Setting:
|
||||
"""A setting for the spectrometer is a value that is the same for all events in a pulse sequence.
|
||||
|
@ -34,5 +34,11 @@ class BaseSpectrometerModel(ModuleModel):
|
|||
class PulseParameter:
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
|
||||
def get_pixmap(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def get_options(self):
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
from PyQt6.QtGui import QPixmap
|
||||
from pathlib import Path
|
||||
from .base_spectrometer_model import BaseSpectrometerModel
|
||||
|
||||
class TXPulse(BaseSpectrometerModel.PulseParameter):
|
||||
def __init__(self, name) -> None:
|
||||
super().__init__(name)
|
||||
self.tx_state = False
|
||||
self.tx_phase = 0
|
||||
|
||||
# Create a button
|
||||
self.button = QPushButton(self)
|
||||
self.button.setGeometry(0, 0, 200, 200)
|
||||
|
||||
# Set a custom image for the button
|
||||
image_path = "resources/wip_no_pulse.png"
|
||||
pixmap = QPixmap(image_path)
|
||||
self.button.setIcon(pixmap)
|
||||
self.button.setIconSize(pixmap.size())
|
||||
|
||||
class RectPulse():
|
||||
def __init__(self, name) -> None:
|
||||
super().__init__(name)
|
||||
|
||||
class SincPulse():
|
||||
def __init__(self, name) -> None:
|
||||
super().__init__(name)
|
||||
|
||||
class GaussianPulse():
|
||||
def __init__(self, name) -> None:
|
||||
super().__init__(name)
|
||||
|
||||
class RXReadout(BaseSpectrometerModel.PulseParameter):
|
||||
def __init__(self, name) -> None:
|
||||
super().__init__(name)
|
||||
self.rx_freq = 0
|
||||
self.rx_phase = 0
|
||||
|
||||
|
||||
class Gate(BaseSpectrometerModel.PulseParameter):
|
||||
def __init__(self, name) -> None:
|
||||
super().__init__(name)
|
||||
self.state = False
|
||||
|
||||
def get_pixmap(self):
|
||||
self_path = Path(__file__).parent
|
||||
if self.state is False:
|
||||
image_path = self_path / "resources/pulseparameter/wip_no_txpulse.png"
|
||||
elif self.state is True:
|
||||
image_path = self_path / "resources/pulseparameter/wip_txpulse.png"
|
||||
pixmap = QPixmap(str(image_path))
|
||||
return pixmap
|
||||
|
||||
def get_options(self):
|
||||
return (bool, self.state)
|
||||
|
||||
def set_options(self, options):
|
||||
self.state = options
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ class BaseSpectrometerView(ModuleView):
|
|||
logger.debug("Adding setting to settings view: %s", setting.name)
|
||||
# Create a label for the setting
|
||||
label = QLabel(setting.name)
|
||||
label.setMinimumWidth(70)
|
||||
label.setMinimumWidth(120)
|
||||
# Add an QLineEdit for the setting
|
||||
line_edit = QLineEdit(str(setting.value))
|
||||
line_edit.setMinimumWidth(100)
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
Loading…
Reference in a new issue