mirror of
https://github.com/nqrduck/quackseq.git
synced 2024-11-12 22:11:54 +00:00
Added some information for views.
This commit is contained in:
parent
1eebd21022
commit
a4a573c6e3
5 changed files with 19 additions and 9 deletions
|
@ -107,6 +107,7 @@ class NumericOption(Option):
|
|||
self.is_float = is_float
|
||||
self.min_value = min_value
|
||||
self.max_value = max_value
|
||||
self.slider = slider
|
||||
|
||||
def set_value(self, value):
|
||||
"""Sets the value of the option."""
|
||||
|
@ -134,6 +135,7 @@ class NumericOption(Option):
|
|||
"is_float": self.is_float,
|
||||
"min_value": self.min_value,
|
||||
"max_value": self.max_value,
|
||||
"slider": self.slider,
|
||||
}
|
||||
|
||||
@classmethod
|
||||
|
@ -182,7 +184,6 @@ class FunctionOption(Option):
|
|||
value: The value of the option.
|
||||
"""
|
||||
self.value = value
|
||||
self.value_changed.emit()
|
||||
|
||||
def get_function_by_name(self, name):
|
||||
"""Returns the function with the given name.
|
||||
|
|
|
@ -104,12 +104,12 @@ class TXPulse(PulseParameter):
|
|||
self.add_option(NumericOption(self.TX_PHASE, 0))
|
||||
self.add_option(
|
||||
NumericOption(
|
||||
self.N_PHASE_CYCLES, 1, is_float=False, min_value=1, max_value=360
|
||||
self.N_PHASE_CYCLES, 1, is_float=False, min_value=1, max_value=360, slider=False
|
||||
)
|
||||
)
|
||||
self.add_option(
|
||||
NumericOption(
|
||||
self.PHASE_CYCLE_LEVEL, 0, is_float=False, min_value=0, max_value=10
|
||||
self.PHASE_CYCLE_LEVEL, 0, is_float=False, min_value=0, max_value=10, slider=False
|
||||
)
|
||||
)
|
||||
self.add_option(
|
||||
|
|
|
@ -63,6 +63,7 @@ class PulseSequence:
|
|||
"""
|
||||
if event.name in self.get_event_names():
|
||||
raise ValueError(f"Event with name {event.name} already exists in the pulse sequence")
|
||||
|
||||
self.events.append(event)
|
||||
|
||||
def create_event(self, event_name: str, duration: str) -> "Event":
|
||||
|
@ -211,8 +212,8 @@ class QuackSequence(PulseSequence):
|
|||
If you want to implement your own spectrometer specific pulse sequence, you can inherit from the PulseSequence class.
|
||||
"""
|
||||
|
||||
TX_PULSE = "TXPulse"
|
||||
RX_READOUT = "RXParameters"
|
||||
TX_PULSE = "TX"
|
||||
RX_READOUT = "RX"
|
||||
|
||||
def __init__(self, name: str, version: str = None) -> None:
|
||||
"""Initializes the pulse sequence."""
|
||||
|
|
|
@ -25,11 +25,11 @@ class QuackSettings(OrderedDict):
|
|||
return categories
|
||||
|
||||
def get_settings_by_category(self, category):
|
||||
settings = []
|
||||
settings = dict()
|
||||
|
||||
for setting in self.values():
|
||||
for key, setting in self.items():
|
||||
if setting.category == category:
|
||||
settings.append(setting)
|
||||
settings[key] = setting
|
||||
|
||||
return settings
|
||||
|
||||
|
|
|
@ -31,10 +31,10 @@ class Setting():
|
|||
description (str): A description of the setting.
|
||||
default: The default value of the setting.
|
||||
"""
|
||||
super().__init__()
|
||||
self.name = name
|
||||
self.category = category
|
||||
self.description = description
|
||||
self.default = default
|
||||
if default is not None:
|
||||
self.value = default
|
||||
# Update the description with the default value
|
||||
|
@ -57,6 +57,8 @@ class NumericalSetting(Setting):
|
|||
self.description_limit_info(description, min_value, max_value),
|
||||
default,
|
||||
)
|
||||
self.min_value = min_value
|
||||
self.max_value = max_value
|
||||
|
||||
def description_limit_info(self, description: str, min_value, max_value) -> str:
|
||||
"""Updates the description with the limits of the setting if there are any.
|
||||
|
@ -89,6 +91,7 @@ class FloatSetting(NumericalSetting):
|
|||
description (str) : A description of the setting
|
||||
min_value : The minimum value of the setting
|
||||
max_value : The maximum value of the setting
|
||||
slider : If the setting should be displayed as a slider (only in the GUI not used in this GUI)
|
||||
"""
|
||||
|
||||
DEFAULT_LENGTH = 100
|
||||
|
@ -101,9 +104,12 @@ class FloatSetting(NumericalSetting):
|
|||
description: str,
|
||||
min_value: float = None,
|
||||
max_value: float = None,
|
||||
slider = False
|
||||
) -> None:
|
||||
"""Create a new float setting."""
|
||||
super().__init__(name, category, description, default, min_value, max_value)
|
||||
self.slider = slider
|
||||
|
||||
@property
|
||||
def value(self):
|
||||
"""The value of the setting. In this case, a float."""
|
||||
|
@ -135,9 +141,11 @@ class IntSetting(NumericalSetting):
|
|||
description: str,
|
||||
min_value=None,
|
||||
max_value=None,
|
||||
slider = False
|
||||
) -> None:
|
||||
"""Create a new int setting."""
|
||||
super().__init__(name, category, description, default, min_value, max_value)
|
||||
self.slider = slider
|
||||
|
||||
|
||||
@property
|
||||
|
|
Loading…
Reference in a new issue