Skip to content

Commit

Permalink
rotate threshold lines
Browse files Browse the repository at this point in the history
  • Loading branch information
bleykauf committed May 31, 2024
1 parent e2233b6 commit 36b29f9
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions linien-gui/linien_gui/ui/plot_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ def __init__(self, *args, **kwargs):
self.combined_signal.setData([0, N_POINTS - 1], [1, 1])

# these lines are used for configuration of the relocking system
control_threshold_pen = pg.mkPen("m", width=2)
error_threshold_pen = pg.mkPen("y", width=2)
monitor_threshold_pen = pg.mkPen("y", width=2)
control_threshold_pen = pg.mkPen("m", width=2, style=QtCore.Qt.DashLine)
error_threshold_pen = pg.mkPen("y", width=2, style=QtCore.Qt.DashLine)
monitor_threshold_pen = pg.mkPen("y", width=2, style=QtCore.Qt.DashLine)
self.control_signal_threshold_min = pg.InfiniteLine(
pen=control_threshold_pen, angle=90
)
Expand Down Expand Up @@ -823,13 +823,21 @@ def resizeEvent(self, event, *args, **kwargs):
self._should_reposition_reset_view_button = True

def show_control_thresholds(self, show: bool, min_: float, max_: float) -> None:
sweep_center = self.app.parameters.sweep_center.value
sweep_amplitude = self.app.parameters.sweep_amplitude.value
sweep_min = sweep_center - sweep_amplitude
sweep_max = sweep_center + sweep_amplitude
spacing = (N_POINTS - 1) / abs(sweep_max - sweep_min) # pts / V
self.control_signal_threshold_min.setValue(spacing * (min_ - sweep_min))
self.control_signal_threshold_max.setValue(spacing * (max_ - sweep_min))
if self.app.parameters.lock.value:
self.control_signal_threshold_min.setAngle(0)
self.control_signal_threshold_max.setAngle(0)
else:
sweep_center = self.app.parameters.sweep_center.value
sweep_amplitude = self.app.parameters.sweep_amplitude.value
sweep_min = sweep_center - sweep_amplitude
sweep_max = sweep_center + sweep_amplitude
spacing = (N_POINTS - 1) / abs(sweep_max - sweep_min) # pts / V
min_ = spacing * (min_ - sweep_min)
max_ = spacing * (max_ - sweep_min)
self.control_signal_threshold_min.setAngle(90)
self.control_signal_threshold_max.setAngle(90)
self.control_signal_threshold_min.setValue(min_)
self.control_signal_threshold_max.setValue(max_)
self.control_signal_threshold_min.setVisible(show)
self.control_signal_threshold_max.setVisible(show)

Expand Down

0 comments on commit 36b29f9

Please sign in to comment.