Updated pulse icons.
|
@ -164,6 +164,16 @@ class Function:
|
||||||
logger.error("Could not convert %s to a float", end_x)
|
logger.error("Could not convert %s to a float", end_x)
|
||||||
raise SyntaxError("Could not convert %s to a float" % end_x)
|
raise SyntaxError("Could not convert %s to a float" % end_x)
|
||||||
|
|
||||||
|
def get_pixmap(self):
|
||||||
|
"""This is the default pixmap for every function. If one wants to have a custom pixmap, this method has to be overwritten.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
QPixmap -- The default pixmap for every function"""
|
||||||
|
self_path = Path(__file__).parent
|
||||||
|
image_path = self_path / "resources/pulseparameter/TXCustom.png"
|
||||||
|
pixmap = QPixmap(str(image_path))
|
||||||
|
return pixmap
|
||||||
|
|
||||||
|
|
||||||
class Parameter:
|
class Parameter:
|
||||||
def __init__(self, name: str, symbol: str, value: float) -> None:
|
def __init__(self, name: str, symbol: str, value: float) -> None:
|
||||||
|
@ -197,6 +207,12 @@ class RectFunction(Function):
|
||||||
expr = sympy.sympify("1")
|
expr = sympy.sympify("1")
|
||||||
super().__init__(expr)
|
super().__init__(expr)
|
||||||
|
|
||||||
|
def get_pixmap(self):
|
||||||
|
self_path = Path(__file__).parent
|
||||||
|
image_path = self_path / "resources/pulseparameter/TXRect.png"
|
||||||
|
pixmap = QPixmap(str(image_path))
|
||||||
|
return pixmap
|
||||||
|
|
||||||
|
|
||||||
class SincFunction(Function):
|
class SincFunction(Function):
|
||||||
name = "Sinc"
|
name = "Sinc"
|
||||||
|
@ -208,6 +224,12 @@ class SincFunction(Function):
|
||||||
self.start_x = -np.pi
|
self.start_x = -np.pi
|
||||||
self.end_x = np.pi
|
self.end_x = np.pi
|
||||||
|
|
||||||
|
def get_pixmap(self):
|
||||||
|
self_path = Path(__file__).parent
|
||||||
|
image_path = self_path / "resources/pulseparameter/TXSinc.png"
|
||||||
|
pixmap = QPixmap(str(image_path))
|
||||||
|
return pixmap
|
||||||
|
|
||||||
|
|
||||||
class GaussianFunction(Function):
|
class GaussianFunction(Function):
|
||||||
name = "Gaussian"
|
name = "Gaussian"
|
||||||
|
@ -220,6 +242,12 @@ class GaussianFunction(Function):
|
||||||
self.start_x = -np.pi
|
self.start_x = -np.pi
|
||||||
self.end_x = np.pi
|
self.end_x = np.pi
|
||||||
|
|
||||||
|
def get_pixmap(self):
|
||||||
|
self_path = Path(__file__).parent
|
||||||
|
image_path = self_path / "resources/pulseparameter/TXGauss.png"
|
||||||
|
pixmap = QPixmap(str(image_path))
|
||||||
|
return pixmap
|
||||||
|
|
||||||
|
|
||||||
# class TriangleFunction(Function):
|
# class TriangleFunction(Function):
|
||||||
# def __init__(self) -> None:
|
# def __init__(self) -> None:
|
||||||
|
@ -234,7 +262,6 @@ class CustomFunction(Function):
|
||||||
expr = sympy.sympify(" 2 * x**2 + 3 * x + 1")
|
expr = sympy.sympify(" 2 * x**2 + 3 * x + 1")
|
||||||
super().__init__(expr)
|
super().__init__(expr)
|
||||||
|
|
||||||
|
|
||||||
class Option:
|
class Option:
|
||||||
"""Defines options for the pulse parameters which can then be set accordingly."""
|
"""Defines options for the pulse parameters which can then be set accordingly."""
|
||||||
|
|
||||||
|
@ -307,6 +334,9 @@ class FunctionOption(Option):
|
||||||
obj.value = Function.from_json(data["value"])
|
obj.value = Function.from_json(data["value"])
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
def get_pixmap(self):
|
||||||
|
return self.value.get_pixmap()
|
||||||
|
|
||||||
|
|
||||||
class TXPulse(BaseSpectrometerModel.PulseParameter):
|
class TXPulse(BaseSpectrometerModel.PulseParameter):
|
||||||
RELATIVE_AMPLITUDE = "Relative TX Amplitude"
|
RELATIVE_AMPLITUDE = "Relative TX Amplitude"
|
||||||
|
@ -318,13 +348,13 @@ class TXPulse(BaseSpectrometerModel.PulseParameter):
|
||||||
self.add_option(NumericOption(self.RELATIVE_AMPLITUDE, 0))
|
self.add_option(NumericOption(self.RELATIVE_AMPLITUDE, 0))
|
||||||
self.add_option(NumericOption(self.TX_PHASE, 0))
|
self.add_option(NumericOption(self.TX_PHASE, 0))
|
||||||
self.add_option(
|
self.add_option(
|
||||||
FunctionOption(self.TX_PULSE_SHAPE, [RectFunction(), SincFunction(), GaussianFunction()]),
|
FunctionOption(self.TX_PULSE_SHAPE, [RectFunction(), SincFunction(), GaussianFunction(), CustomFunction()]),
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_pixmap(self):
|
def get_pixmap(self):
|
||||||
self_path = Path(__file__).parent
|
self_path = Path(__file__).parent
|
||||||
if self.get_option_by_name(self.RELATIVE_AMPLITUDE).value > 0:
|
if self.get_option_by_name(self.RELATIVE_AMPLITUDE).value > 0:
|
||||||
image_path = self_path / "resources/pulseparameter/TXOn.png"
|
return self.get_option_by_name(self.TX_PULSE_SHAPE).get_pixmap()
|
||||||
else:
|
else:
|
||||||
image_path = self_path / "resources/pulseparameter/TXOff.png"
|
image_path = self_path / "resources/pulseparameter/TXOff.png"
|
||||||
pixmap = QPixmap(str(image_path))
|
pixmap = QPixmap(str(image_path))
|
||||||
|
|
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 315 B |
BIN
src/nqrduck_spectrometer/resources/pulseparameter/TXCustom.png
Normal file
After Width: | Height: | Size: 346 B |
BIN
src/nqrduck_spectrometer/resources/pulseparameter/TXGauss.png
Normal file
After Width: | Height: | Size: 356 B |
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 277 B |
BIN
src/nqrduck_spectrometer/resources/pulseparameter/TXSinc.png
Normal file
After Width: | Height: | Size: 387 B |