From 6c01242112f2d01e746aa0b2d7c012ae97b42bb1 Mon Sep 17 00:00:00 2001 From: jupfi Date: Tue, 11 Jul 2023 11:18:29 +0200 Subject: [PATCH] Added basic pulse parameters --- .../base_spectrometer_model.py | 10 ++- .../base_spectrometer_pulseparameters.py | 60 ++++++++++++++++++ .../base_spectrometer_view.py | 2 +- .../pulseparameter/wip_no_txpulse.png | Bin 0 -> 1182 bytes .../resources/pulseparameter/wip_txpulse.png | Bin 0 -> 6364 bytes 5 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 src/nqrduck_spectrometer/base_spectrometer_pulseparameters.py create mode 100644 src/nqrduck_spectrometer/resources/pulseparameter/wip_no_txpulse.png create mode 100644 src/nqrduck_spectrometer/resources/pulseparameter/wip_txpulse.png diff --git a/src/nqrduck_spectrometer/base_spectrometer_model.py b/src/nqrduck_spectrometer/base_spectrometer_model.py index 76bac23..b0d86f7 100644 --- a/src/nqrduck_spectrometer/base_spectrometer_model.py +++ b/src/nqrduck_spectrometer/base_spectrometer_model.py @@ -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 diff --git a/src/nqrduck_spectrometer/base_spectrometer_pulseparameters.py b/src/nqrduck_spectrometer/base_spectrometer_pulseparameters.py new file mode 100644 index 0000000..df16022 --- /dev/null +++ b/src/nqrduck_spectrometer/base_spectrometer_pulseparameters.py @@ -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 + + \ No newline at end of file diff --git a/src/nqrduck_spectrometer/base_spectrometer_view.py b/src/nqrduck_spectrometer/base_spectrometer_view.py index 014354e..d4a9643 100644 --- a/src/nqrduck_spectrometer/base_spectrometer_view.py +++ b/src/nqrduck_spectrometer/base_spectrometer_view.py @@ -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) diff --git a/src/nqrduck_spectrometer/resources/pulseparameter/wip_no_txpulse.png b/src/nqrduck_spectrometer/resources/pulseparameter/wip_no_txpulse.png new file mode 100644 index 0000000000000000000000000000000000000000..0f98d22bd0b7c6070bb8958a11c9ae0c7590353d GIT binary patch literal 1182 zcmeAS@N?(olHy`uVBq!ia0vp^CqS5k4M?tyST~P>fw3ji**U<|*;%2WC_gPTCzXLg zV`A+@TaUvIGDqWsmj-Dml?eo%2$=h3ky2k&t5OKZR;Sf`YSZf+C%35_JsMb`Yw=@a zL}@|cwW|k11z7AIVq)ir#4b7VU$s@tP)_Fiad(kMp{CrRh%V zj3g|@0$SN_er^7L@O|FeLr+?!i+D2J)$jXk$kkHTn0B{tU%%|~N+y>1joN$Pt~YC# z>3`{Uu5KC2mt1D?>$$!+nf1yW4yrqwrG|4|65(Qf@V955COgj^riZ5Mw_mgKlW*WD zow|#WkFRl~QtJBOdv-71yuJSXmS4XaS9~hkb7K1mA7HewC3(BM0BIoj>AbrhNO2Z; zL>4nJ=qZCRW5rVYGN2%PiKnkC`*U_KL4Ee_DL2!BLXst}5hc#~xw)x%B@E6*sfi`2 zDGKG8B^e6tp1uL$jeOz^3`}L7E{-7;x8C0J?+z`MIsWncnL8qmCndbtymA7&544z^ zn7g+9Md23iDu%;rjxNbSn8Pov}4n#_}jdak2bQ2x#29 z<;(YH+h2FTulwUxx@DJrOIqQMN%wC(^qPP3O-XfF@AETftW&n^s#{?dTzeyh>CF*? zX|vCG%H$Q@{&w}%)ZBx&FTcH$nw2z>eU!KA+4EJOedUCstQ>5s zckha*HNF?I+bDEC_tkXgSfBxkx_@WO6&<;Cd>iYl°`ugg`1rz=1`~9okuQtCr zXCM`~JNj?XUz;BJWrq!tZNp~STrJr3tHk1jjHp0b?uxm6CwALr+h={UINST`^v7ej qp8h}hKW^o|6?PX{sS}lFI_nvBKPdRRr2XD?kcpnIelF{r5}E)HdGlrf literal 0 HcmV?d00001 diff --git a/src/nqrduck_spectrometer/resources/pulseparameter/wip_txpulse.png b/src/nqrduck_spectrometer/resources/pulseparameter/wip_txpulse.png new file mode 100644 index 0000000000000000000000000000000000000000..9782dc9573b8718cb1aef5298c4b2633e2dfc45d GIT binary patch literal 6364 zcmai2byO43+umTX5ds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