Skip to content

Commit

Permalink
Update terascan_gui.py
Browse files Browse the repository at this point in the history
  • Loading branch information
lange50 committed Apr 28, 2025
1 parent 4e0a184 commit e077744
Showing 1 changed file with 8 additions and 33 deletions.
41 changes: 8 additions & 33 deletions src/qudi/gui/terascan/terascan_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,30 +190,10 @@ def _scan_stopped(self) -> None:
self._mw._statusbar.showMessage('Ready')
self._mw._progress_bar.setValue(100)

def _update_plot(self):
# self._mw.start_stop_button.setText('Start Measurement')
# Make a local snapshot of the data

x_array = np.array(self._terascan_logic().wavelength_data)
y_array = np.array(self._terascan_logic().counts_data[:len(x_array)])
mask = self._terascan_logic().ttl_data

min_length = min(len(x_array), len(y_array), len(mask))
x_array = x_array[:min_length]
y_array = y_array[:min_length]
mask = mask[:min_length]

x_array = x_array[mask]
y_array = y_array[mask]

if x_array.shape[0] != y_array.shape[0]:
return # skip this update
if x_array.shape[0] == 0 or y_array.shape[0] == 0:
return

# downsample
# x_array = x_array[::10]
# y_array = y_array[::10]
@QtCore.Slot()
def __update_gui(self):
x_array = self.data.valid_wavelength_data
y_array = self.data.valid_counts_data

# If running average is enabled, apply a rolling average
if self._mw.checkbox_running_avg.isChecked():
Expand All @@ -223,7 +203,10 @@ def _update_plot(self):
y_array = np.convolve(y_array, kernel, mode='same')


self._mw.data_item.setData(x=x_array, y=y_array)
self._mw.data_item.setData(
x=x_array,
y=y_array,
)


@QtCore.Slot(int)
Expand All @@ -235,14 +218,6 @@ def _update_data(self, data: TerascanLogicdata) -> None:
""" Update the data from the logic module """
self.data = data


@QtCore.Slot()
def __update_gui(self) -> None:
""" Update the GUI with the latest data from the logic module """
# Update the setText button
self._update_ui()
self._update_plot()



class TerascanMainWindow(QtWidgets.QMainWindow):
Expand Down

0 comments on commit e077744

Please sign in to comment.