1
|
|
|
# -*- coding: utf-8 -*- |
2
|
|
|
|
3
|
|
|
""" |
4
|
|
|
This file contains the QuDi main GUI for pulsed measurements. |
5
|
|
|
|
6
|
|
|
QuDi is free software: you can redistribute it and/or modify |
7
|
|
|
it under the terms of the GNU General Public License as published by |
8
|
|
|
the Free Software Foundation, either version 3 of the License, or |
9
|
|
|
(at your option) any later version. |
10
|
|
|
|
11
|
|
|
QuDi is distributed in the hope that it will be useful, |
12
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
|
|
|
GNU General Public License for more details. |
15
|
|
|
|
16
|
|
|
You should have received a copy of the GNU General Public License |
17
|
|
|
along with QuDi. If not, see <http://www.gnu.org/licenses/>. |
18
|
|
|
|
19
|
|
|
Copyright (c) the Qudi Developers. See the COPYRIGHT.txt file at the |
20
|
|
|
top-level directory of this distribution and at <https://github.com/Ulm-IQO/qudi/> |
21
|
|
|
""" |
22
|
|
|
|
23
|
|
|
from qtpy import QtGui |
24
|
|
|
from qtpy import QtCore |
25
|
|
|
from qtpy import QtWidgets |
26
|
|
|
from qtpy import uic |
27
|
|
|
import numpy as np |
28
|
|
|
import os |
29
|
|
|
from collections import OrderedDict |
30
|
|
|
import pyqtgraph as pg |
31
|
|
|
import re |
32
|
|
|
import inspect |
33
|
|
|
import datetime |
34
|
|
|
|
35
|
|
|
|
36
|
|
|
from gui.guibase import GUIBase |
37
|
|
|
from gui.colordefs import QudiPalettePale as palette |
38
|
|
|
from gui.colordefs import QudiPalette as palettedark |
39
|
|
|
#from gui.pulsed.pulse_editor import PulseEditor |
40
|
|
|
from core.util.mutex import Mutex |
41
|
|
|
from core.util import units |
42
|
|
|
from gui.pulsed.pulse_editors import BlockEditor, BlockOrganizer |
43
|
|
|
|
44
|
|
|
|
45
|
|
|
#FIXME: Display the Pulse |
46
|
|
|
#FIXME: save the length in sample points (bins) |
47
|
|
|
#FIXME: adjust the length to the bins |
48
|
|
|
#FIXME: Later that should be able to round up the values directly within |
49
|
|
|
|
50
|
|
|
|
51
|
|
|
class PulsedMeasurementMainWindow(QtWidgets.QMainWindow): |
52
|
|
|
def __init__(self): |
53
|
|
|
# Get the path to the *.ui file |
54
|
|
|
this_dir = os.path.dirname(__file__) |
55
|
|
|
ui_file = os.path.join(this_dir, 'ui_pulsed_noeditor.ui') |
56
|
|
|
|
57
|
|
|
# Load it |
58
|
|
|
super(PulsedMeasurementMainWindow, self).__init__() |
59
|
|
|
|
60
|
|
|
uic.loadUi(ui_file, self) |
61
|
|
|
self.show() |
62
|
|
|
|
63
|
|
|
class PulseAnalysisTab(QtWidgets.QWidget): |
64
|
|
|
def __init__(self): |
65
|
|
|
# Get the path to the *.ui file |
66
|
|
|
this_dir = os.path.dirname(__file__) |
67
|
|
|
ui_file = os.path.join(this_dir, 'ui_pulse_analysis.ui') |
68
|
|
|
# Load it |
69
|
|
|
super().__init__() |
70
|
|
|
uic.loadUi(ui_file, self) |
71
|
|
|
|
72
|
|
|
class PulseGeneratorTab(QtWidgets.QWidget): |
73
|
|
|
def __init__(self): |
74
|
|
|
# Get the path to the *.ui file |
75
|
|
|
this_dir = os.path.dirname(__file__) |
76
|
|
|
ui_file = os.path.join(this_dir, 'ui_pulse_editor.ui') |
77
|
|
|
# Load it |
78
|
|
|
super().__init__() |
79
|
|
|
uic.loadUi(ui_file, self) |
80
|
|
|
|
81
|
|
|
class PulseExtractionTab(QtWidgets.QWidget): |
82
|
|
|
def __init__(self): |
83
|
|
|
# Get the path to the *.ui file |
84
|
|
|
this_dir = os.path.dirname(__file__) |
85
|
|
|
ui_file = os.path.join(this_dir, 'ui_pulse_extraction.ui') |
86
|
|
|
# Load it |
87
|
|
|
super().__init__() |
88
|
|
|
uic.loadUi(ui_file, self) |
89
|
|
|
|
90
|
|
|
class AnalysisSettingDialog(QtWidgets.QDialog): |
91
|
|
|
def __init__(self): |
92
|
|
|
# Get the path to the *.ui file |
93
|
|
|
this_dir = os.path.dirname(__file__) |
94
|
|
|
ui_file = os.path.join(this_dir, 'ui-pulsed-main-gui-settings-analysis.ui') |
95
|
|
|
|
96
|
|
|
# Load it |
97
|
|
|
super(AnalysisSettingDialog, self).__init__() |
98
|
|
|
|
99
|
|
|
uic.loadUi(ui_file, self) |
100
|
|
|
|
101
|
|
|
class PulsedMeasurementGui(GUIBase): |
102
|
|
|
""" This is the main GUI Class for pulsed measurements. """ |
103
|
|
|
|
104
|
|
|
_modclass = 'PulsedMeasurementGui' |
105
|
|
|
_modtype = 'gui' |
106
|
|
|
|
107
|
|
|
## declare connectors |
108
|
|
|
_in = {'pulsedmasterlogic': 'PulsedMasterLogic', |
109
|
|
|
'savelogic': 'SaveLogic'} |
110
|
|
|
|
111
|
|
|
def __init__(self, config, **kwargs): |
112
|
|
|
super().__init__(config=config, **kwargs) |
113
|
|
|
|
114
|
|
|
self.log.info('The following configuration was found.') |
115
|
|
|
|
116
|
|
|
# checking for the right configuration |
117
|
|
|
for key in config.keys(): |
118
|
|
|
self.log.info('{}: {}'.format(key,config[key])) |
119
|
|
|
|
120
|
|
|
# that variable is for testing issues and can be deleted if not needed: |
121
|
|
|
self._write_chunkwise = False |
122
|
|
|
|
123
|
|
View Code Duplication |
def on_activate(self, e=None): |
|
|
|
|
124
|
|
|
""" Initialize, connect and configure the pulsed measurement GUI. |
125
|
|
|
|
126
|
|
|
@param object e: Fysom.event object from Fysom class. |
127
|
|
|
An object created by the state machine module Fysom, |
128
|
|
|
which is connected to a specific event (have a look in |
129
|
|
|
the Base Class). This object contains the passed event, |
130
|
|
|
the state before the event happened and the destination |
131
|
|
|
of the state which should be reached after the event |
132
|
|
|
had happened. |
133
|
|
|
|
134
|
|
|
Establish general connectivity and activate the different tabs of the |
135
|
|
|
GUI. |
136
|
|
|
""" |
137
|
|
|
self._pulsed_master_logic = self.get_in_connector('pulsedmasterlogic') |
138
|
|
|
self._save_logic = self.get_in_connector('savelogic') |
139
|
|
|
|
140
|
|
|
self._mw = PulsedMeasurementMainWindow() |
141
|
|
|
self._pa = PulseAnalysisTab() |
142
|
|
|
self._pg = PulseGeneratorTab() |
143
|
|
|
self._pe = PulseExtractionTab() |
144
|
|
|
|
145
|
|
|
self._mw.tabWidget.addTab(self._pa, 'Analysis') |
146
|
|
|
self._mw.tabWidget.addTab(self._pe, 'Pulse Extraction') |
147
|
|
|
self._mw.tabWidget.addTab(self._pg, 'Pulse Generator') |
148
|
|
|
|
149
|
|
|
self.setup_toolbar() |
150
|
|
|
self._activate_analysis_settings_ui(e) |
151
|
|
|
self._activate_analysis_ui(e) |
152
|
|
|
self.setup_extraction_ui() |
153
|
|
|
|
154
|
|
|
self._activate_pulse_generator_ui(e) |
155
|
|
|
|
156
|
|
|
self.show() |
157
|
|
|
|
158
|
|
|
def on_deactivate(self, e): |
159
|
|
|
""" Undo the Definition, configuration and initialisation of the pulsed |
160
|
|
|
measurement GUI. |
161
|
|
|
|
162
|
|
|
@param object e: Fysom.event object from Fysom class. A more detailed |
163
|
|
|
explanation can be found in the method initUI. |
164
|
|
|
|
165
|
|
|
This deactivation disconnects all the graphic modules, which were |
166
|
|
|
connected in the initUI method. |
167
|
|
|
""" |
168
|
|
|
self._deactivate_analysis_settings_ui(e) |
169
|
|
|
self._deactivate_analysis_ui(e) |
170
|
|
|
|
171
|
|
|
self._deactivate_pulse_generator_ui(e) |
172
|
|
|
|
173
|
|
|
self._mw.close() |
174
|
|
|
|
175
|
|
|
def show(self): |
176
|
|
|
"""Make main window visible and put it above all other windows. """ |
177
|
|
|
QtWidgets.QMainWindow.show(self._mw) |
178
|
|
|
self._mw.activateWindow() |
179
|
|
|
self._mw.raise_() |
180
|
|
|
|
181
|
|
|
def get_current_function_list(self): |
182
|
|
|
""" Retrieve the functions, which are chosen by the user. |
183
|
|
|
|
184
|
|
|
@return: list[] with strings of the used functions. Names are based on |
185
|
|
|
the passed func_config dict from the logic. Depending on the |
186
|
|
|
settings, a current function list is generated. |
187
|
|
|
""" |
188
|
|
|
# current_functions = [] |
189
|
|
|
# |
190
|
|
|
# for index in range(len(list(self._pulsed_master_logic._generator_logic.func_config))): |
191
|
|
|
# name_checkbox = 'checkbox_' + str(index) |
192
|
|
|
# checkbox = getattr(self._bs, name_checkbox) |
193
|
|
|
# if checkbox.isChecked(): |
194
|
|
|
# name_label = 'func_' + str(index) |
195
|
|
|
# func = getattr(self._bs, name_label) |
196
|
|
|
# current_functions.append(func.text()) |
197
|
|
|
# return current_functions |
198
|
|
|
return list(self._pulsed_master_logic._generator_logic.func_config) |
199
|
|
|
|
200
|
|
|
def get_current_block_list(self): |
201
|
|
|
return self._pulsed_master_logic._generator_logic.saved_pulse_blocks |
202
|
|
|
|
203
|
|
|
########################################################################### |
204
|
|
|
### Methods related to Tab 'Pulse Generator' in the Pulsed Window: ### |
205
|
|
|
########################################################################### |
206
|
|
|
def _activate_pulse_generator_ui(self, e): |
207
|
|
|
""" Initialize, connect and configure the 'Pulse Generator' Tab. |
208
|
|
|
|
209
|
|
|
@param object e: Fysom.event object from Fysom class. A more detailed |
210
|
|
|
explanation can be found in the method initUI. |
211
|
|
|
""" |
212
|
|
|
# connect signals of input widgets |
213
|
|
|
self._pg.gen_sample_freq_DSpinBox.editingFinished.connect(self.generator_settings_changed, QtCore.Qt.QueuedConnection) |
214
|
|
|
self._pg.gen_laserchannel_ComboBox.currentIndexChanged.connect(self.generator_settings_changed, QtCore.Qt.QueuedConnection) |
215
|
|
|
self._pg.gen_activation_config_ComboBox.currentIndexChanged.connect(self.generator_settings_changed, QtCore.Qt.QueuedConnection) |
216
|
|
|
# connect signals of buttons |
217
|
|
|
self._pg.sample_ensemble_PushButton.clicked.connect(self.sample_ensemble_clicked) |
218
|
|
|
# self._pg.sample_sequence_PushButton.clicked.connect(self.sample_sequence_clicked) |
219
|
|
|
self._pg.sauplo_ensemble_PushButton.clicked.connect(self.sauplo_ensemble_clicked) |
220
|
|
|
|
221
|
|
|
self._pg.block_add_last_PushButton.clicked.connect(self.block_add_last_clicked) |
222
|
|
|
self._pg.block_del_last_PushButton.clicked.connect(self.block_del_last_clicked) |
223
|
|
|
self._pg.block_add_sel_PushButton.clicked.connect(self.block_add_sel_clicked) |
224
|
|
|
self._pg.block_del_sel_PushButton.clicked.connect(self.block_del_sel_clicked) |
225
|
|
|
self._pg.block_clear_PushButton.clicked.connect(self.block_clear_clicked) |
226
|
|
|
self._pg.organizer_add_last_PushButton.clicked.connect(self.organizer_add_last_clicked) |
227
|
|
|
self._pg.organizer_del_last_PushButton.clicked.connect(self.organizer_del_last_clicked) |
228
|
|
|
self._pg.organizer_add_sel_PushButton.clicked.connect(self.organizer_add_sel_clicked) |
229
|
|
|
self._pg.organizer_del_sel_PushButton.clicked.connect(self.organizer_del_sel_clicked) |
230
|
|
|
self._pg.organizer_clear_PushButton.clicked.connect(self.organizer_clear_clicked) |
231
|
|
|
|
232
|
|
|
self._pg.curr_block_generate_PushButton.clicked.connect(self.editor_generate_block_clicked) |
233
|
|
|
self._pg.curr_block_del_PushButton.clicked.connect(self.editor_delete_block_clicked) |
234
|
|
|
self._pg.curr_block_load_PushButton.clicked.connect(self.editor_load_block_clicked) |
235
|
|
|
self._pg.curr_ensemble_generate_PushButton.clicked.connect(self.editor_generate_ensemble_clicked) |
236
|
|
|
self._pg.curr_ensemble_del_PushButton.clicked.connect(self.editor_delete_ensemble_clicked) |
237
|
|
|
self._pg.curr_ensemble_load_PushButton.clicked.connect(self.editor_load_ensemble_clicked) |
238
|
|
|
|
239
|
|
|
# connect update signals from pulsed_master_logic |
240
|
|
|
self._pulsed_master_logic.sigBlockEnsembleSampled.connect(self.sample_ensemble_finished) |
241
|
|
|
# self._pulsed_master_logic.sigSequenceSampled.connect(self.sample_sequence_finished) |
242
|
|
|
self._pulsed_master_logic.sigSavedPulseBlocksUpdated.connect(self.update_block_dict) |
243
|
|
|
self._pulsed_master_logic.sigSavedBlockEnsemblesUpdated.connect(self.update_ensemble_dict) |
244
|
|
|
# self._pulsed_master_logic.sigSavedSequencesUpdated.connect(self.update_sequence_list) |
245
|
|
|
self._pulsed_master_logic.sigGeneratorSettingsUpdated.connect(self.update_generator_settings) |
246
|
|
|
|
247
|
|
|
self._pulsed_master_logic.sigCurrentPulseBlockUpdated.connect(self.load_block_in_editor) |
248
|
|
|
self._pulsed_master_logic.sigCurrentBlockEnsembleUpdated.connect(self.load_ensemble_in_editor) |
249
|
|
|
# self._pulsed_master_logic.sigCurrentSequenceUpdated.connect(self.) |
250
|
|
|
|
251
|
|
|
self.block_organizer = BlockOrganizer(self._pg.block_organizer_TableWidget) |
252
|
|
|
self.block_editor = BlockEditor(self._pg.block_editor_TableWidget) |
253
|
|
|
self.functions_to_show = ['Idle', 'DC', 'Sin'] |
254
|
|
|
# Apply hardware constraints to input widgets |
255
|
|
|
self._gen_apply_hardware_constraints() |
256
|
|
|
|
257
|
|
|
# Fill initial values from logic into input widgets |
258
|
|
|
self._pulsed_master_logic.request_generator_init_values() |
259
|
|
|
return |
260
|
|
|
|
261
|
|
|
|
262
|
|
|
def _deactivate_pulse_generator_ui(self, e): |
263
|
|
|
""" Disconnects the configuration for 'Pulse Generator Tab. |
264
|
|
|
|
265
|
|
|
@param object e: Fysom.event object from Fysom class. A more detailed |
266
|
|
|
explanation can be found in the method initUI. |
267
|
|
|
""" |
268
|
|
|
# disconnect signals of input widgets |
269
|
|
|
self._pg.gen_sample_freq_DSpinBox.editingFinished.disconnect() |
270
|
|
|
self._pg.gen_laserchannel_ComboBox.currentIndexChanged.disconnect() |
271
|
|
|
self._pg.gen_activation_config_ComboBox.currentIndexChanged.disconnect() |
272
|
|
|
# disconnect signals of buttons |
273
|
|
|
self._pg.sample_ensemble_PushButton.clicked.disconnect() |
274
|
|
|
# self._pg.sample_sequence_PushButton.clicked.disconnect() |
275
|
|
|
self._pg.sauplo_ensemble_PushButton.clicked.disconnect() |
276
|
|
|
self._pg.block_add_last_PushButton.clicked.disconnect() |
277
|
|
|
self._pg.block_del_last_PushButton.clicked.disconnect() |
278
|
|
|
self._pg.block_add_sel_PushButton.clicked.disconnect() |
279
|
|
|
self._pg.block_del_sel_PushButton.clicked.disconnect() |
280
|
|
|
self._pg.block_clear_PushButton.clicked.disconnect() |
281
|
|
|
self._pg.organizer_add_last_PushButton.clicked.disconnect() |
282
|
|
|
self._pg.organizer_del_last_PushButton.clicked.disconnect() |
283
|
|
|
self._pg.organizer_add_sel_PushButton.clicked.disconnect() |
284
|
|
|
self._pg.organizer_del_sel_PushButton.clicked.disconnect() |
285
|
|
|
self._pg.organizer_clear_PushButton.clicked.disconnect() |
286
|
|
|
self._pg.curr_block_generate_PushButton.clicked.disconnect() |
287
|
|
|
self._pg.curr_block_del_PushButton.clicked.disconnect() |
288
|
|
|
self._pg.curr_block_load_PushButton.clicked.disconnect() |
289
|
|
|
self._pg.curr_ensemble_generate_PushButton.clicked.disconnect() |
290
|
|
|
self._pg.curr_ensemble_del_PushButton.clicked.disconnect() |
291
|
|
|
self._pg.curr_ensemble_load_PushButton.clicked.disconnect() |
292
|
|
|
# disconnect update signals from pulsed_master_logic |
293
|
|
|
self._pulsed_master_logic.sigBlockEnsembleSampled.disconnect() |
294
|
|
|
# self._pulsed_master_logic.sigSequenceSampled.disconnect() |
295
|
|
|
self._pulsed_master_logic.sigSavedPulseBlocksUpdated.disconnect() |
296
|
|
|
self._pulsed_master_logic.sigSavedBlockEnsemblesUpdated.disconnect() |
297
|
|
|
# self._pulsed_master_logic.sigSavedSequencesUpdated.disconnect() |
298
|
|
|
self._pulsed_master_logic.sigGeneratorSettingsUpdated.disconnect() |
299
|
|
|
# self._pulsed_master_logic.sigCurrentPulseBlockUpdated.disconnect() |
300
|
|
|
# self._pulsed_master_logic.sigCurrentBlockEnsembleUpdated.disconnect() |
301
|
|
|
# self._pulsed_master_logic.sigCurrentSequenceUpdated.disconnect() |
302
|
|
|
return |
303
|
|
|
|
304
|
|
View Code Duplication |
def _gen_apply_hardware_constraints(self): |
|
|
|
|
305
|
|
|
""" |
306
|
|
|
Retrieve the constraints from pulser hardware and apply these constraints to the pulse |
307
|
|
|
generator GUI elements. |
308
|
|
|
""" |
309
|
|
|
# block signals |
310
|
|
|
self._pg.gen_activation_config_ComboBox.blockSignals(True) |
311
|
|
|
self._pg.gen_sample_freq_DSpinBox.blockSignals(True) |
312
|
|
|
# apply constraints |
313
|
|
|
pulser_constr, dummy = self._pulsed_master_logic.get_hardware_constraints() |
314
|
|
|
self._pg.gen_activation_config_ComboBox.addItems(list(pulser_constr['activation_config'])) |
315
|
|
|
self._pg.gen_sample_freq_DSpinBox.setMinimum(pulser_constr['sample_rate']['min']) |
316
|
|
|
self._pg.gen_sample_freq_DSpinBox.setMaximum(pulser_constr['sample_rate']['max']) |
317
|
|
|
# unblock signals |
318
|
|
|
self._pg.gen_activation_config_ComboBox.blockSignals(False) |
319
|
|
|
self._pg.gen_sample_freq_DSpinBox.blockSignals(False) |
320
|
|
|
return |
321
|
|
|
|
322
|
|
|
def generator_settings_changed(self): |
323
|
|
|
""" |
324
|
|
|
|
325
|
|
|
@return: |
326
|
|
|
""" |
327
|
|
|
sample_rate = self._pg.gen_sample_freq_DSpinBox.value() |
328
|
|
|
laser_channel = self._pg.gen_laserchannel_ComboBox.currentText() |
329
|
|
|
activation_config_name = self._pg.gen_activation_config_ComboBox.currentText() |
330
|
|
|
amplitude_dict = self._pulsed_master_logic._generator_logic.amplitude_dict |
331
|
|
|
|
332
|
|
|
self._pulsed_master_logic.generator_settings_changed(activation_config_name, laser_channel, |
333
|
|
|
sample_rate, amplitude_dict) |
334
|
|
|
return |
335
|
|
|
|
336
|
|
View Code Duplication |
def update_generator_settings(self, activation_config_name, activation_config, sample_rate, |
|
|
|
|
337
|
|
|
amplitude_dict, laser_channel): |
338
|
|
|
""" |
339
|
|
|
|
340
|
|
|
@param activation_config_name: |
341
|
|
|
@param activation_config: |
342
|
|
|
@param sample_rate: |
343
|
|
|
@param amplitude_dict: |
344
|
|
|
@param laser_channel: |
345
|
|
|
@return: |
346
|
|
|
""" |
347
|
|
|
# block signals |
348
|
|
|
self._pg.gen_sample_freq_DSpinBox.blockSignals(True) |
349
|
|
|
self._pg.gen_laserchannel_ComboBox.blockSignals(True) |
350
|
|
|
self._pg.gen_activation_config_ComboBox.blockSignals(True) |
351
|
|
|
# activation config |
352
|
|
|
index = self._pg.gen_activation_config_ComboBox.findText(activation_config_name) |
353
|
|
|
self._pg.gen_activation_config_ComboBox.setCurrentIndex(index) |
354
|
|
|
display_str = '' |
355
|
|
|
for chnl in activation_config: |
356
|
|
|
display_str += chnl + ' | ' |
357
|
|
|
display_str = display_str[:-3] |
358
|
|
|
self._pg.gen_activation_config_LineEdit.setText(display_str) |
359
|
|
|
self._pg.gen_analog_channels_SpinBox.setValue( |
360
|
|
|
len([chnl for chnl in activation_config if 'a_ch' in chnl])) |
361
|
|
|
self._pg.gen_digital_channels_SpinBox.setValue( |
362
|
|
|
len([chnl for chnl in activation_config if 'd_ch' in chnl])) |
363
|
|
|
# laser channel |
364
|
|
|
self._pg.gen_laserchannel_ComboBox.clear() |
365
|
|
|
self._pg.gen_laserchannel_ComboBox.addItems(activation_config) |
366
|
|
|
index = self._pg.gen_laserchannel_ComboBox.findText(laser_channel) |
367
|
|
|
self._pg.gen_laserchannel_ComboBox.setCurrentIndex(index) |
368
|
|
|
# sample rate |
369
|
|
|
self._pg.gen_sample_freq_DSpinBox.setValue(sample_rate) |
370
|
|
|
# set activation config in block editor |
371
|
|
|
if self.block_editor.activation_config != activation_config: |
372
|
|
|
self.block_editor.set_configs(activation_config) |
373
|
|
|
# unblock signals |
374
|
|
|
self._pg.gen_sample_freq_DSpinBox.blockSignals(False) |
375
|
|
|
self._pg.gen_laserchannel_ComboBox.blockSignals(False) |
376
|
|
|
self._pg.gen_activation_config_ComboBox.blockSignals(False) |
377
|
|
|
return |
378
|
|
|
|
379
|
|
|
def block_add_last_clicked(self): |
380
|
|
|
""" |
381
|
|
|
|
382
|
|
|
@return: |
383
|
|
|
""" |
384
|
|
|
self.block_editor.insert_rows(self._pg.block_editor_TableWidget.rowCount(), 1) |
385
|
|
|
return |
386
|
|
|
|
387
|
|
|
def block_del_last_clicked(self): |
388
|
|
|
""" |
389
|
|
|
|
390
|
|
|
@return: |
391
|
|
|
""" |
392
|
|
|
self.block_editor.delete_row(self._pg.block_editor_TableWidget.rowCount()) |
393
|
|
|
return |
394
|
|
|
|
395
|
|
|
def block_add_sel_clicked(self): |
396
|
|
|
""" |
397
|
|
|
|
398
|
|
|
@return: |
399
|
|
|
""" |
400
|
|
|
index = self._pg.block_editor_TableWidget.currentRow() |
401
|
|
|
self.block_editor.insert_rows(index + 1, 1) |
402
|
|
|
return |
403
|
|
|
|
404
|
|
|
def block_del_sel_clicked(self): |
405
|
|
|
""" |
406
|
|
|
|
407
|
|
|
@return: |
408
|
|
|
""" |
409
|
|
|
index = self._pg.block_editor_TableWidget.currentRow() |
410
|
|
|
self.block_editor.delete_row(index) |
411
|
|
|
return |
412
|
|
|
|
413
|
|
|
def block_clear_clicked(self): |
414
|
|
|
""" |
415
|
|
|
|
416
|
|
|
@return: |
417
|
|
|
""" |
418
|
|
|
self.block_editor.clear_table() |
419
|
|
|
return |
420
|
|
|
|
421
|
|
|
def organizer_add_last_clicked(self): |
422
|
|
|
""" |
423
|
|
|
|
424
|
|
|
@return: |
425
|
|
|
""" |
426
|
|
|
self.block_organizer.insert_rows(self._pg.block_organizer_TableWidget.rowCount(), 1) |
427
|
|
|
return |
428
|
|
|
|
429
|
|
|
def organizer_del_last_clicked(self): |
430
|
|
|
""" |
431
|
|
|
|
432
|
|
|
@return: |
433
|
|
|
""" |
434
|
|
|
self.block_organizer.delete_row(self._pg.block_organizer_TableWidget.rowCount() - 1) |
435
|
|
|
return |
436
|
|
|
|
437
|
|
|
def organizer_add_sel_clicked(self): |
438
|
|
|
""" |
439
|
|
|
|
440
|
|
|
@return: |
441
|
|
|
""" |
442
|
|
|
index = self._pg.block_organizer_TableWidget.currentRow() |
443
|
|
|
self.block_organizer.insert_rows(index + 1, 1) |
444
|
|
|
return |
445
|
|
|
|
446
|
|
|
def organizer_del_sel_clicked(self): |
447
|
|
|
""" |
448
|
|
|
|
449
|
|
|
@return: |
450
|
|
|
""" |
451
|
|
|
index = self._pg.block_organizer_TableWidget.currentRow() |
452
|
|
|
self.block_organizer.delete_row(index) |
453
|
|
|
return |
454
|
|
|
|
455
|
|
|
def organizer_clear_clicked(self): |
456
|
|
|
""" |
457
|
|
|
|
458
|
|
|
@return: |
459
|
|
|
""" |
460
|
|
|
self.block_organizer.clear_table() |
461
|
|
|
return |
462
|
|
|
|
463
|
|
|
def editor_generate_block_clicked(self): |
464
|
|
|
name = self._pg.curr_block_name_LineEdit.text() |
465
|
|
|
if name == '': |
466
|
|
|
self.log.error('No name has been entered for the PulseBlock to be generated.') |
467
|
|
|
return |
468
|
|
|
block_object = self.block_editor.generate_block_object(name) |
469
|
|
|
self._pulsed_master_logic.save_pulse_block(name, block_object) |
470
|
|
|
return |
471
|
|
|
|
472
|
|
|
def editor_delete_block_clicked(self): |
473
|
|
|
name = self._pg.saved_blocks_ComboBox.currentText() |
474
|
|
|
self._pulsed_master_logic.delete_pulse_block(name) |
475
|
|
|
return |
476
|
|
|
|
477
|
|
|
def editor_load_block_clicked(self): |
478
|
|
|
name = self._pg.saved_blocks_ComboBox.currentText() |
479
|
|
|
self._pulsed_master_logic.load_pulse_block(name) |
480
|
|
|
return |
481
|
|
|
|
482
|
|
|
def editor_generate_ensemble_clicked(self): |
483
|
|
|
name = self._pg.curr_ensemble_name_LineEdit.text() |
484
|
|
|
if name == '': |
485
|
|
|
self.log.error('No name has been entered for the PulseBlockEnsemble to be generated.') |
486
|
|
|
return |
487
|
|
|
rotating_frame = self._pg.curr_ensemble_rot_frame_CheckBox.isChecked() |
488
|
|
|
ensemble_object = self.block_organizer.generate_ensemble_object(name, rotating_frame) |
489
|
|
|
self._pulsed_master_logic.save_block_ensemble(name, ensemble_object) |
490
|
|
|
return |
491
|
|
|
|
492
|
|
|
def editor_delete_ensemble_clicked(self): |
493
|
|
|
name = self._pg.saved_ensembles_ComboBox.currentText() |
494
|
|
|
self._pulsed_master_logic.delete_block_ensemble(name) |
495
|
|
|
return |
496
|
|
|
|
497
|
|
|
def editor_load_ensemble_clicked(self): |
498
|
|
|
name = self._pg.saved_ensembles_ComboBox.currentText() |
499
|
|
|
self._pulsed_master_logic.load_block_ensemble(name) |
500
|
|
|
return |
501
|
|
|
|
502
|
|
|
def load_block_in_editor(self, block_obj): |
503
|
|
|
self.block_editor.load_pulse_block(block_obj) |
504
|
|
|
return |
505
|
|
|
|
506
|
|
|
def load_ensemble_in_editor(self, ensemble_obj): |
507
|
|
|
self.block_organizer.load_pulse_block_ensemble(ensemble_obj) |
508
|
|
|
return |
509
|
|
|
|
510
|
|
|
def update_block_dict(self, block_dict): |
511
|
|
|
""" |
512
|
|
|
|
513
|
|
|
@param block_dict: |
514
|
|
|
@return: |
515
|
|
|
""" |
516
|
|
|
self.block_organizer.set_block_dict(block_dict) |
517
|
|
|
self._pg.saved_blocks_ComboBox.blockSignals(True) |
518
|
|
|
self._pg.saved_blocks_ComboBox.clear() |
519
|
|
|
self._pg.saved_blocks_ComboBox.addItems(list(block_dict)) |
520
|
|
|
self._pg.saved_blocks_ComboBox.blockSignals(False) |
521
|
|
|
return |
522
|
|
|
|
523
|
|
|
def update_ensemble_dict(self, ensemble_dict): |
524
|
|
|
""" |
525
|
|
|
|
526
|
|
|
@param ensemble_dict: |
527
|
|
|
@return: |
528
|
|
|
""" |
529
|
|
|
# block signals |
530
|
|
|
self._pg.gen_ensemble_ComboBox.blockSignals(True) |
531
|
|
|
self._pg.saved_ensembles_ComboBox.blockSignals(True) |
532
|
|
|
# update gen_sequence_ComboBox items |
533
|
|
|
self._pg.gen_ensemble_ComboBox.clear() |
534
|
|
|
self._pg.gen_ensemble_ComboBox.addItems(list(ensemble_dict)) |
535
|
|
|
self._pg.saved_ensembles_ComboBox.clear() |
536
|
|
|
self._pg.saved_ensembles_ComboBox.addItems(list(ensemble_dict)) |
537
|
|
|
# unblock signals |
538
|
|
|
self._pg.gen_ensemble_ComboBox.blockSignals(False) |
539
|
|
|
self._pg.saved_ensembles_ComboBox.blockSignals(False) |
540
|
|
|
return |
541
|
|
|
|
542
|
|
|
# def update_sequence_list(self, sequence_list): |
543
|
|
|
# """ |
544
|
|
|
# |
545
|
|
|
# @param sequence_list: |
546
|
|
|
# @return: |
547
|
|
|
# """ |
548
|
|
|
# # block signals |
549
|
|
|
# self._pg.gen_sequence_ComboBox.blockSignals(True) |
550
|
|
|
# # update gen_sequence_ComboBox items |
551
|
|
|
# self._pg.gen_sequence_ComboBox.clear() |
552
|
|
|
# self._pg.gen_sequence_ComboBox.addItems(sequence_list) |
553
|
|
|
# # unblock signals |
554
|
|
|
# self._pg.gen_sequence_ComboBox.blockSignals(False) |
555
|
|
|
# return |
556
|
|
|
|
557
|
|
|
def sample_ensemble_clicked(self): |
558
|
|
|
""" |
559
|
|
|
This method is called when the user clicks on "sample" |
560
|
|
|
""" |
561
|
|
|
# Get the ensemble name from the ComboBox |
562
|
|
|
ensemble_name = self._pg.gen_ensemble_ComboBox.currentText() |
563
|
|
|
# disable button |
564
|
|
|
self._pg.sample_ensemble_PushButton.setEnabled(False) |
565
|
|
|
# Sample the ensemble via logic module |
566
|
|
|
self._pulsed_master_logic.sample_block_ensemble(ensemble_name, True, self._write_chunkwise) |
567
|
|
|
return |
568
|
|
|
|
569
|
|
|
def sample_ensemble_finished(self, ensemble_name): |
570
|
|
|
""" |
571
|
|
|
|
572
|
|
|
@return: |
573
|
|
|
""" |
574
|
|
|
# enable button |
575
|
|
|
self._pg.sample_ensemble_PushButton.setEnabled(True) |
576
|
|
|
return |
577
|
|
|
|
578
|
|
|
def sauplo_ensemble_clicked(self): |
579
|
|
|
""" |
580
|
|
|
|
581
|
|
|
@return: |
582
|
|
|
""" |
583
|
|
|
# Get the ensemble name from the ComboBox |
584
|
|
|
ensemble_name = self._pg.gen_ensemble_ComboBox.currentText() |
585
|
|
|
# disable button |
586
|
|
|
self._pg.sample_ensemble_PushButton.setEnabled(False) |
587
|
|
|
self._pg.upload_ensemble_PushButton.setEnabled(False) |
588
|
|
|
self._pg.load_ensemble_PushButton.setEnabled(False) |
589
|
|
|
# Sample the ensemble via logic module |
590
|
|
|
self._pulsed_master_logic.sample_block_ensemble(ensemble_name, True, self._write_chunkwise, True) |
591
|
|
|
return |
592
|
|
|
|
593
|
|
|
# def sample_sequence_clicked(self): |
594
|
|
|
# """ |
595
|
|
|
# This method is called when the user clicks on "sample" |
596
|
|
|
# """ |
597
|
|
|
# # Get the sequence name from the ComboBox |
598
|
|
|
# sequence_name = self._pg.gen_sequence_ComboBox.currentText() |
599
|
|
|
# # Sample the sequence via logic module |
600
|
|
|
# self._pulsed_master_logic.sample_sequence(sequence_name, True, self._write_chunkwise) |
601
|
|
|
# # disable button |
602
|
|
|
# self._pg.sample_sequence_PushButton.setEnabled(False) |
603
|
|
|
# return |
604
|
|
|
|
605
|
|
|
# def sample_sequence_finished(self, sequence_name): |
606
|
|
|
# """ |
607
|
|
|
# |
608
|
|
|
# @return: |
609
|
|
|
# """ |
610
|
|
|
# # enable button |
611
|
|
|
# self._pg.sample_sequence_PushButton.setEnabled(True) |
612
|
|
|
# return |
613
|
|
|
|
614
|
|
|
########################################################################### |
615
|
|
|
### Methods related to Settings for the 'Analysis' Tab: ### |
616
|
|
|
########################################################################### |
617
|
|
|
#FIXME: Implement the setting for 'Analysis' tab. |
618
|
|
View Code Duplication |
def _activate_analysis_settings_ui(self, e): |
|
|
|
|
619
|
|
|
""" Initialize, connect and configure the Settings of 'Analysis' Tab. |
620
|
|
|
|
621
|
|
|
@param object e: Fysom.event object from Fysom class. A more detailed |
622
|
|
|
explanation can be found in the method initUI. |
623
|
|
|
""" |
624
|
|
|
self._as = AnalysisSettingDialog() |
625
|
|
|
self._as.accepted.connect(self.update_analysis_settings) |
626
|
|
|
self._as.rejected.connect(self.keep_former_analysis_settings) |
627
|
|
|
self._as.buttonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self.update_analysis_settings) |
628
|
|
|
|
629
|
|
|
if 'ana_param_x_axis_name_LineEdit' in self._statusVariables: |
630
|
|
|
self._as.ana_param_x_axis_name_LineEdit.setText(self._statusVariables['ana_param_x_axis_name_LineEdit']) |
631
|
|
|
if 'ana_param_x_axis_unit_LineEdit' in self._statusVariables: |
632
|
|
|
self._as.ana_param_x_axis_unit_LineEdit.setText(self._statusVariables['ana_param_x_axis_unit_LineEdit']) |
633
|
|
|
if 'ana_param_y_axis_name_LineEdit' in self._statusVariables: |
634
|
|
|
self._as.ana_param_y_axis_name_LineEdit.setText(self._statusVariables['ana_param_y_axis_name_LineEdit']) |
635
|
|
|
if 'ana_param_y_axis_unit_LineEdit' in self._statusVariables: |
636
|
|
|
self._as.ana_param_y_axis_unit_LineEdit.setText(self._statusVariables['ana_param_y_axis_unit_LineEdit']) |
637
|
|
|
if 'ana_param_second_plot_x_axis_name_LineEdit' in self._statusVariables: |
638
|
|
|
self._as.ana_param_second_plot_x_axis_name_LineEdit.setText(self._statusVariables['ana_param_second_plot_x_axis_name_LineEdit']) |
639
|
|
|
if 'ana_param_second_plot_x_axis_unit_LineEdit' in self._statusVariables: |
640
|
|
|
self._as.ana_param_second_plot_x_axis_unit_LineEdit.setText(self._statusVariables['ana_param_second_plot_x_axis_unit_LineEdit']) |
641
|
|
|
if 'ana_param_second_plot_y_axis_name_LineEdit' in self._statusVariables: |
642
|
|
|
self._as.ana_param_second_plot_y_axis_name_LineEdit.setText(self._statusVariables['ana_param_second_plot_y_axis_name_LineEdit']) |
643
|
|
|
if 'ana_param_second_plot_y_axis_unit_LineEdit' in self._statusVariables: |
644
|
|
|
self._as.ana_param_second_plot_y_axis_unit_LineEdit.setText(self._statusVariables['ana_param_second_plot_y_axis_unit_LineEdit']) |
645
|
|
|
self.update_analysis_settings() |
646
|
|
|
return |
647
|
|
|
|
648
|
|
|
|
649
|
|
View Code Duplication |
def _deactivate_analysis_settings_ui(self, e): |
|
|
|
|
650
|
|
|
""" Disconnects the configuration of the Settings for 'Analysis' Tab. |
651
|
|
|
|
652
|
|
|
@param object e: Fysom.event object from Fysom class. A more detailed |
653
|
|
|
explanation can be found in the method initUI. |
654
|
|
|
""" |
655
|
|
|
self._statusVariables['ana_param_x_axis_name_LineEdit'] = self._as.ana_param_x_axis_name_LineEdit.text() |
656
|
|
|
self._statusVariables['ana_param_x_axis_unit_LineEdit'] = self._as.ana_param_x_axis_unit_LineEdit.text() |
657
|
|
|
self._statusVariables['ana_param_y_axis_name_LineEdit'] = self._as.ana_param_y_axis_name_LineEdit.text() |
658
|
|
|
self._statusVariables['ana_param_y_axis_unit_LineEdit'] = self._as.ana_param_y_axis_unit_LineEdit.text() |
659
|
|
|
self._statusVariables['ana_param_second_plot_x_axis_name_LineEdit'] = self._as.ana_param_second_plot_x_axis_name_LineEdit.text() |
660
|
|
|
self._statusVariables['ana_param_second_plot_x_axis_unit_LineEdit'] = self._as.ana_param_second_plot_x_axis_unit_LineEdit.text() |
661
|
|
|
self._statusVariables['ana_param_second_plot_y_axis_name_LineEdit'] = self._as.ana_param_second_plot_y_axis_name_LineEdit.text() |
662
|
|
|
self._statusVariables['ana_param_second_plot_y_axis_unit_LineEdit'] = self._as.ana_param_second_plot_y_axis_unit_LineEdit.text() |
663
|
|
|
return |
664
|
|
|
|
665
|
|
|
|
666
|
|
View Code Duplication |
def update_analysis_settings(self): |
|
|
|
|
667
|
|
|
""" Apply the new settings """ |
668
|
|
|
self._pa.pulse_analysis_PlotWidget.setLabel( |
669
|
|
|
axis='bottom', |
670
|
|
|
text=self._as.ana_param_x_axis_name_LineEdit.text(), |
671
|
|
|
units=self._as.ana_param_x_axis_unit_LineEdit.text()) |
672
|
|
|
self._pa.pulse_analysis_PlotWidget.setLabel( |
673
|
|
|
axis='left', |
674
|
|
|
text=self._as.ana_param_y_axis_name_LineEdit.text(), |
675
|
|
|
units=self._as.ana_param_y_axis_unit_LineEdit.text()) |
676
|
|
|
self._pa.pulse_analysis_second_PlotWidget.setLabel( |
677
|
|
|
axis='bottom', |
678
|
|
|
text=self._as.ana_param_second_plot_x_axis_name_LineEdit.text(), |
679
|
|
|
units=self._as.ana_param_second_plot_x_axis_unit_LineEdit.text()) |
680
|
|
|
self._pa.pulse_analysis_second_PlotWidget.setLabel( |
681
|
|
|
axis='left', |
682
|
|
|
text=self._as.ana_param_second_plot_y_axis_name_LineEdit.text(), |
683
|
|
|
units=self._as.ana_param_second_plot_y_axis_unit_LineEdit.text()) |
684
|
|
|
return |
685
|
|
|
|
686
|
|
|
def keep_former_analysis_settings(self): |
687
|
|
|
""" Keep the old settings """ |
688
|
|
|
#FIXME: Implement the behaviour |
689
|
|
|
pass |
690
|
|
|
|
691
|
|
|
def show_analysis_settings(self): |
692
|
|
|
""" Open the Analysis Settings Window. """ |
693
|
|
|
self._as.exec_() |
694
|
|
|
return |
695
|
|
|
|
696
|
|
|
########################################################################### |
697
|
|
|
### Methods related to the Tab 'Analysis' in the Pulsed Window: ### |
698
|
|
|
########################################################################### |
699
|
|
View Code Duplication |
def setup_toolbar(self): |
|
|
|
|
700
|
|
|
# create all the needed control widgets on the fly and connect their |
701
|
|
|
# actions to each other: |
702
|
|
|
self._mw.pulser_on_off_PushButton = QtWidgets.QPushButton() |
703
|
|
|
self._mw.pulser_on_off_PushButton.setText('Pulser ON') |
704
|
|
|
self._mw.pulser_on_off_PushButton.setToolTip('Switch the device on and off.') |
705
|
|
|
self._mw.pulser_on_off_PushButton.setCheckable(True) |
706
|
|
|
self._mw.control_ToolBar.addWidget(self._mw.pulser_on_off_PushButton) |
707
|
|
|
|
708
|
|
|
self._mw.clear_device_PushButton = QtWidgets.QPushButton(self._mw) |
709
|
|
|
self._mw.clear_device_PushButton.setText('Clear Pulser') |
710
|
|
|
self._mw.clear_device_PushButton.setToolTip( |
711
|
|
|
'Clear the Pulser Device Memory\nfrom all loaded files.') |
712
|
|
|
self._mw.control_ToolBar.addWidget(self._mw.clear_device_PushButton) |
713
|
|
|
|
714
|
|
|
self._mw.current_loaded_asset_Label = QtWidgets.QLabel(self._mw) |
715
|
|
|
sizepolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, |
716
|
|
|
QtWidgets.QSizePolicy.Fixed) |
717
|
|
|
sizepolicy.setHorizontalStretch(0) |
718
|
|
|
sizepolicy.setVerticalStretch(0) |
719
|
|
|
sizepolicy.setHeightForWidth( |
720
|
|
|
self._mw.current_loaded_asset_Label.sizePolicy().hasHeightForWidth()) |
721
|
|
|
self._mw.current_loaded_asset_Label.setSizePolicy(sizepolicy) |
722
|
|
|
self._mw.current_loaded_asset_Label.setText(' No Asset Loaded') |
723
|
|
|
self._mw.current_loaded_asset_Label.setToolTip('Display the currently loaded asset.') |
724
|
|
|
self._mw.control_ToolBar.addWidget(self._mw.current_loaded_asset_Label) |
725
|
|
|
|
726
|
|
|
self._mw.save_tag_LineEdit = QtWidgets.QLineEdit() |
727
|
|
|
self._mw.save_tag_LineEdit.setMaximumWidth(200) |
728
|
|
|
self._mw.save_ToolBar.addWidget(self._mw.save_tag_LineEdit) |
729
|
|
|
|
730
|
|
View Code Duplication |
def setup_extraction_ui(self): |
|
|
|
|
731
|
|
|
self.lasertrace_image = pg.PlotDataItem(np.array(range(10)), np.zeros(10), pen=palette.c1) |
732
|
|
|
self._pe.laserpulses_PlotWidget.addItem(self.lasertrace_image) |
733
|
|
|
self._pe.laserpulses_PlotWidget.addItem(self.sig_start_line) |
734
|
|
|
self._pe.laserpulses_PlotWidget.addItem(self.sig_end_line) |
735
|
|
|
self._pe.laserpulses_PlotWidget.addItem(self.ref_start_line) |
736
|
|
|
self._pe.laserpulses_PlotWidget.addItem(self.ref_end_line) |
737
|
|
|
self._pe.laserpulses_PlotWidget.setLabel('bottom', 'bins') |
738
|
|
|
|
739
|
|
|
def _activate_analysis_ui(self, e): |
740
|
|
|
""" Initialize, connect and configure the 'Analysis' Tab. |
741
|
|
|
|
742
|
|
|
@param object e: Fysom.event object from Fysom class. A more detailed |
743
|
|
|
explanation can be found in the method initUI. |
744
|
|
|
""" |
745
|
|
|
# FIXME: Implement second plot |
746
|
|
|
self._pa.second_plot_GroupBox.setVisible(False) |
747
|
|
|
# Configure the main pulse analysis display: |
748
|
|
|
self.signal_image = pg.PlotDataItem(np.array(range(10)), np.zeros(10), pen=palette.c1) |
749
|
|
|
self._pa.pulse_analysis_PlotWidget.addItem(self.signal_image) |
750
|
|
|
self.signal_image2 = pg.PlotDataItem(pen=palette.c3) |
751
|
|
|
self._pa.pulse_analysis_PlotWidget.addItem(self.signal_image2) |
752
|
|
|
self._pa.pulse_analysis_PlotWidget.showGrid(x=True, y=True, alpha=0.8) |
753
|
|
|
|
754
|
|
|
# Configure the fit of the data in the main pulse analysis display: |
755
|
|
|
self.fit_image = pg.PlotDataItem(pen=palette.c2) |
756
|
|
|
self._pa.pulse_analysis_PlotWidget.addItem(self.fit_image) |
757
|
|
|
self._pa.fit_param_fit_func_ComboBox.clear() |
758
|
|
|
self._pa.fit_param_fit_func_ComboBox.addItems(self._pulsed_master_logic.get_fit_functions()) |
759
|
|
|
|
760
|
|
|
# Configure the errorbars of the data in the main pulse analysis display: |
761
|
|
|
self.signal_image_error_bars = pg.ErrorBarItem( |
762
|
|
|
x=np.array(range(10)), |
763
|
|
|
y=np.zeros(10), |
764
|
|
|
top=0., |
765
|
|
|
bottom=0., |
766
|
|
|
pen=palette.c1) |
767
|
|
|
self.signal_image_error_bars2 = pg.ErrorBarItem( |
768
|
|
|
x=np.array(range(10)), |
769
|
|
|
y=np.zeros(10), |
770
|
|
|
top=0., |
771
|
|
|
bottom=0., |
772
|
|
|
pen=palette.c3) |
773
|
|
|
|
774
|
|
|
# Configure the second pulse analysis display: |
775
|
|
|
self.second_plot_image = pg.PlotDataItem(np.array(range(10)), np.zeros(10), pen=palette.c1) |
776
|
|
|
self._pa.pulse_analysis_second_PlotWidget.addItem(self.second_plot_image) |
777
|
|
|
self._pa.pulse_analysis_second_PlotWidget.showGrid(x=True, y=True, alpha=0.8) |
778
|
|
|
|
779
|
|
|
# Configure the lasertrace plot display: |
780
|
|
|
self.sig_start_line = pg.InfiniteLine(pos=0, pen=QtGui.QPen(palette.c3), movable=True) |
781
|
|
|
self.sig_start_line.setHoverPen(QtGui.QPen(palette.c2)) |
782
|
|
|
self.sig_end_line = pg.InfiniteLine(pos=0, pen=QtGui.QPen(palette.c3), movable=True) |
783
|
|
|
self.sig_end_line.setHoverPen(QtGui.QPen(palette.c2)) |
784
|
|
|
self.ref_start_line = pg.InfiniteLine(pos=0, pen=QtGui.QPen(palettedark.c4), movable=True) |
785
|
|
|
self.ref_start_line.setHoverPen(QtGui.QPen(palette.c4)) |
786
|
|
|
self.ref_end_line = pg.InfiniteLine(pos=0, pen=QtGui.QPen(palettedark.c4), movable=True) |
787
|
|
|
self.ref_end_line.setHoverPen(QtGui.QPen(palette.c4)) |
788
|
|
|
# Configure the measuring error display: |
789
|
|
|
self.measuring_error_image = pg.PlotDataItem( |
790
|
|
|
np.array(range(10)), |
791
|
|
|
np.zeros(10), |
792
|
|
|
pen=palette.c1) |
793
|
|
|
self.measuring_error_image2 = pg.PlotDataItem( |
794
|
|
|
np.array(range(10)), |
795
|
|
|
np.zeros(10), |
796
|
|
|
pen=palette.c3) |
797
|
|
|
self._pe.measuring_error_PlotWidget.addItem(self.measuring_error_image) |
798
|
|
|
self._pe.measuring_error_PlotWidget.addItem(self.measuring_error_image2) |
799
|
|
|
self._pe.measuring_error_PlotWidget.setLabel('left', 'measuring error', units='a.u.') |
800
|
|
|
self._pe.measuring_error_PlotWidget.setLabel('bottom', 'tau', units='ns') |
801
|
|
|
|
802
|
|
|
|
803
|
|
|
# set boundaries |
804
|
|
|
self._pe.slider_conv_std_dev.setRange(1, 200) |
805
|
|
|
self._pe.conv_std_dev.setRange(1, 200) |
806
|
|
|
|
807
|
|
|
# --------------------------------------------------------------------- |
808
|
|
|
# Connect signals |
809
|
|
|
# --------------------------------------------------------------------- |
810
|
|
|
# connect update signals from logic |
811
|
|
|
self._pulsed_master_logic.sigSignalDataUpdated.connect(self.signal_data_updated) |
812
|
|
|
self._pulsed_master_logic.sigLaserDataUpdated.connect(self.laser_data_updated) |
813
|
|
|
self._pulsed_master_logic.sigLaserToShowUpdated.connect(self.laser_to_show_updated) |
814
|
|
|
self._pulsed_master_logic.sigElapsedTimeUpdated.connect(self.elapsed_time_updated) |
815
|
|
|
self._pulsed_master_logic.sigFitUpdated.connect(self.fit_data_updated) |
816
|
|
|
self._pulsed_master_logic.sigMeasurementStatusUpdated.connect(self.measurement_status_updated) |
817
|
|
|
self._pulsed_master_logic.sigPulserRunningUpdated.connect(self.pulser_running_updated) |
818
|
|
|
self._pulsed_master_logic.sigFastCounterSettingsUpdated.connect(self.fast_counter_settings_updated) |
819
|
|
|
self._pulsed_master_logic.sigMeasurementSequenceSettingsUpdated.connect(self.measurement_sequence_settings_updated) |
820
|
|
|
self._pulsed_master_logic.sigPulserSettingsUpdated.connect(self.pulse_generator_settings_updated) |
821
|
|
|
self._pulsed_master_logic.sigUploadedAssetsUpdated.connect(self.update_uploaded_assets) |
822
|
|
|
self._pulsed_master_logic.sigLoadedAssetUpdated.connect(self.update_loaded_asset) |
823
|
|
|
self._pulsed_master_logic.sigExtMicrowaveSettingsUpdated.connect(self.microwave_settings_updated) |
824
|
|
|
self._pulsed_master_logic.sigExtMicrowaveRunningUpdated.connect(self.microwave_running_updated) |
825
|
|
|
self._pulsed_master_logic.sigTimerIntervalUpdated.connect(self.measurement_timer_updated) |
826
|
|
|
self._pulsed_master_logic.sigAnalysisWindowsUpdated.connect(self.analysis_windows_updated) |
827
|
|
|
self._pulsed_master_logic.sigAnalysisMethodUpdated.connect(self.analysis_method_updated) |
828
|
|
|
|
829
|
|
|
# connect button click signals |
830
|
|
|
self._pg.upload_ensemble_PushButton.clicked.connect(self.upload_ensemble_clicked) |
831
|
|
|
self._pg.load_ensemble_PushButton.clicked.connect(self.load_ensemble_clicked) |
832
|
|
|
# self._pg.upload_sequence_PushButton.clicked.connect(self.upload_sequence_clicked) |
833
|
|
|
# self._pg.load_sequence_PushButton.clicked.connect(self.load_sequence_clicked) |
834
|
|
|
self._mw.pulser_on_off_PushButton.clicked.connect(self.pulser_on_off_clicked) |
835
|
|
|
self._mw.clear_device_PushButton.clicked.connect(self.clear_pulser_clicked) |
836
|
|
|
self._pa.fit_param_PushButton.clicked.connect(self.fit_clicked) |
837
|
|
|
|
838
|
|
|
# connect action trigger signals |
839
|
|
|
self._mw.action_run_stop.triggered.connect(self.measurement_run_stop_clicked) |
840
|
|
|
self._mw.action_continue_pause.triggered.connect(self.measurement_continue_pause_clicked) |
841
|
|
|
self._mw.action_pull_data.triggered.connect(self.pull_data_clicked) |
842
|
|
|
self._mw.action_save.triggered.connect(self.save_clicked) |
843
|
|
|
self._mw.action_Settings_Analysis.triggered.connect(self.show_analysis_settings) |
844
|
|
|
|
845
|
|
|
# connect checkbox click signals |
846
|
|
|
self._pa.ext_control_use_mw_CheckBox.stateChanged.connect(self.ext_mw_params_changed) |
847
|
|
|
self._pa.ana_param_x_axis_defined_CheckBox.stateChanged.connect(self.toggle_laser_xaxis_editor) |
848
|
|
|
self._pa.ana_param_laserpulse_defined_CheckBox.stateChanged.connect(self.toggle_laser_xaxis_editor) |
849
|
|
|
self._pa.ana_param_alternating_CheckBox.stateChanged.connect(self.measurement_sequence_settings_changed) |
850
|
|
|
self._pa.ana_param_ignore_first_CheckBox.stateChanged.connect(self.measurement_sequence_settings_changed) |
851
|
|
|
self._pa.ana_param_ignore_last_CheckBox.stateChanged.connect(self.measurement_sequence_settings_changed) |
852
|
|
|
self._pe.laserpulses_display_raw_CheckBox.stateChanged.connect(self.laser_to_show_changed) |
853
|
|
|
self._pa.ana_param_errorbars_CheckBox.stateChanged.connect(self.toggle_error_bars) |
854
|
|
|
self._pa.pulser_use_interleave_CheckBox.stateChanged.connect(self.pulse_generator_settings_changed) |
855
|
|
|
|
856
|
|
|
# connect spinbox changed signals |
857
|
|
|
self._pa.ana_param_num_laser_pulse_SpinBox.editingFinished.connect(self.measurement_sequence_settings_changed) |
858
|
|
|
self._pa.ana_param_record_length_SpinBox.editingFinished.connect(self.fast_counter_settings_changed) |
859
|
|
|
self._pa.time_param_ana_periode_DoubleSpinBox.editingFinished.connect(self.measurement_timer_changed) |
860
|
|
|
self._pa.ext_control_mw_freq_DoubleSpinBox.editingFinished.connect(self.ext_mw_params_changed) |
861
|
|
|
self._pa.ext_control_mw_power_DoubleSpinBox.editingFinished.connect(self.ext_mw_params_changed) |
862
|
|
|
self._pa.pulser_sample_freq_DSpinBox.editingFinished.connect(self.pulse_generator_settings_changed) |
863
|
|
|
self._pa.ana_param_x_axis_start_ScienDSpinBox.editingFinished.connect(self.measurement_sequence_settings_changed) |
864
|
|
|
self._pa.ana_param_x_axis_inc_ScienDSpinBox.editingFinished.connect(self.measurement_sequence_settings_changed) |
865
|
|
|
self._pe.extract_param_ana_window_start_SpinBox.editingFinished.connect(self.analysis_windows_changed) |
866
|
|
|
self._pe.extract_param_ana_window_width_SpinBox.editingFinished.connect(self.analysis_windows_changed) |
867
|
|
|
self._pe.extract_param_ref_window_start_SpinBox.editingFinished.connect(self.analysis_windows_changed) |
868
|
|
|
self._pe.extract_param_ref_window_width_SpinBox.editingFinished.connect(self.analysis_windows_changed) |
869
|
|
|
self._pe.conv_std_dev.valueChanged.connect(self.conv_std_dev_changed) |
870
|
|
|
|
871
|
|
|
# connect combobox changed signals |
872
|
|
|
self._pa.ana_param_fc_bins_ComboBox.currentIndexChanged.connect(self.fast_counter_settings_changed) |
873
|
|
|
#self._pa.second_plot_ComboBox.currentIndexChanged.connect(self.change_second_plot) |
874
|
|
|
self._pa.pulser_activation_config_ComboBox.currentIndexChanged.connect(self.pulse_generator_settings_changed) |
875
|
|
|
self._pe.laserpulses_ComboBox.currentIndexChanged.connect(self.laser_to_show_changed) |
876
|
|
|
|
877
|
|
|
# connect other widgets changed signals |
878
|
|
|
self.sig_start_line.sigPositionChanged.connect(self.analysis_windows_line_changed) |
879
|
|
|
self.sig_end_line.sigPositionChanged.connect(self.analysis_windows_line_changed) |
880
|
|
|
self.ref_start_line.sigPositionChanged.connect(self.analysis_windows_line_changed) |
881
|
|
|
self.ref_end_line.sigPositionChanged.connect(self.analysis_windows_line_changed) |
882
|
|
|
self._pe.slider_conv_std_dev.sliderReleased.connect(self.slider_conv_std_dev_changed) |
883
|
|
|
|
884
|
|
|
# apply hardware constraints |
885
|
|
|
self._analysis_apply_hardware_constraints() |
886
|
|
|
|
887
|
|
|
# initialize values |
888
|
|
|
self._pulsed_master_logic.request_measurement_init_values() |
889
|
|
|
return |
890
|
|
|
|
891
|
|
|
def _deactivate_analysis_ui(self, e): |
892
|
|
|
""" Disconnects the configuration for 'Analysis' Tab. |
893
|
|
|
|
894
|
|
|
@param object e: Fysom.event object from Fysom class. A more detailed |
895
|
|
|
explanation can be found in the method initUI. |
896
|
|
|
""" |
897
|
|
|
self.measurement_run_stop_clicked(False) |
898
|
|
|
|
899
|
|
|
self._statusVariables['ana_param_x_axis_defined_CheckBox'] = self._pa.ana_param_x_axis_defined_CheckBox.isChecked() |
900
|
|
|
self._statusVariables['ana_param_laserpulse_defined_CheckBox'] = self._pa.ana_param_laserpulse_defined_CheckBox.isChecked() |
901
|
|
|
self._statusVariables['ana_param_ignore_first_CheckBox'] = self._pa.ana_param_ignore_first_CheckBox.isChecked() |
902
|
|
|
self._statusVariables['ana_param_ignore_last_CheckBox'] = self._pa.ana_param_ignore_last_CheckBox.isChecked() |
903
|
|
|
self._statusVariables['ana_param_errorbars_CheckBox'] = self._pa.ana_param_errorbars_CheckBox.isChecked() |
904
|
|
|
self._statusVariables['second_plot_ComboBox_text'] = self._pa.second_plot_ComboBox.currentText() |
905
|
|
|
|
906
|
|
|
# disconnect signals |
907
|
|
|
self._pulsed_master_logic.sigSignalDataUpdated.disconnect() |
908
|
|
|
self._pulsed_master_logic.sigLaserDataUpdated.disconnect() |
909
|
|
|
self._pulsed_master_logic.sigLaserToShowUpdated.disconnect() |
910
|
|
|
self._pulsed_master_logic.sigElapsedTimeUpdated.disconnect() |
911
|
|
|
self._pulsed_master_logic.sigFitUpdated.disconnect() |
912
|
|
|
self._pulsed_master_logic.sigMeasurementStatusUpdated.disconnect() |
913
|
|
|
self._pulsed_master_logic.sigPulserRunningUpdated.disconnect() |
914
|
|
|
self._pulsed_master_logic.sigFastCounterSettingsUpdated.disconnect() |
915
|
|
|
self._pulsed_master_logic.sigMeasurementSequenceSettingsUpdated.disconnect() |
916
|
|
|
self._pulsed_master_logic.sigPulserSettingsUpdated.disconnect() |
917
|
|
|
self._pulsed_master_logic.sigUploadedAssetsUpdated.disconnect() |
918
|
|
|
self._pulsed_master_logic.sigLoadedAssetUpdated.disconnect() |
919
|
|
|
self._pulsed_master_logic.sigExtMicrowaveSettingsUpdated.disconnect() |
920
|
|
|
self._pulsed_master_logic.sigExtMicrowaveRunningUpdated.disconnect() |
921
|
|
|
self._pulsed_master_logic.sigTimerIntervalUpdated.disconnect() |
922
|
|
|
self._pulsed_master_logic.sigAnalysisWindowsUpdated.disconnect() |
923
|
|
|
self._pulsed_master_logic.sigAnalysisMethodUpdated.disconnect() |
924
|
|
|
self._pg.upload_ensemble_PushButton.clicked.disconnect() |
925
|
|
|
self._pg.load_ensemble_PushButton.clicked.disconnect() |
926
|
|
|
# self._pg.upload_sequence_PushButton.clicked.disconnect() |
927
|
|
|
# self._pg.load_sequence_PushButton.clicked.disconnect() |
928
|
|
|
self._mw.pulser_on_off_PushButton.clicked.disconnect() |
929
|
|
|
self._mw.clear_device_PushButton.clicked.disconnect() |
930
|
|
|
self._pa.fit_param_PushButton.clicked.disconnect() |
931
|
|
|
self._mw.action_run_stop.triggered.disconnect() |
932
|
|
|
self._mw.action_continue_pause.triggered.disconnect() |
933
|
|
|
self._mw.action_pull_data.triggered.disconnect() |
934
|
|
|
self._mw.action_save.triggered.disconnect() |
935
|
|
|
self._mw.action_Settings_Analysis.triggered.disconnect() |
936
|
|
|
self._pa.ext_control_use_mw_CheckBox.stateChanged.disconnect() |
937
|
|
|
self._pa.ana_param_x_axis_defined_CheckBox.stateChanged.disconnect() |
938
|
|
|
self._pa.ana_param_laserpulse_defined_CheckBox.stateChanged.disconnect() |
939
|
|
|
self._pa.ana_param_alternating_CheckBox.stateChanged.disconnect() |
940
|
|
|
self._pa.ana_param_ignore_first_CheckBox.stateChanged.disconnect() |
941
|
|
|
self._pa.ana_param_ignore_last_CheckBox.stateChanged.disconnect() |
942
|
|
|
self._pe.laserpulses_display_raw_CheckBox.stateChanged.disconnect() |
943
|
|
|
self._pa.ana_param_errorbars_CheckBox.stateChanged.disconnect() |
944
|
|
|
self._pa.pulser_use_interleave_CheckBox.stateChanged.disconnect() |
945
|
|
|
self._pa.ana_param_num_laser_pulse_SpinBox.editingFinished.disconnect() |
946
|
|
|
self._pa.ana_param_record_length_SpinBox.editingFinished.disconnect() |
947
|
|
|
self._pa.time_param_ana_periode_DoubleSpinBox.editingFinished.disconnect() |
948
|
|
|
self._pa.ext_control_mw_freq_DoubleSpinBox.editingFinished.disconnect() |
949
|
|
|
self._pa.ext_control_mw_power_DoubleSpinBox.editingFinished.disconnect() |
950
|
|
|
self._pa.pulser_sample_freq_DSpinBox.editingFinished.disconnect() |
951
|
|
|
self._pa.ana_param_x_axis_start_ScienDSpinBox.editingFinished.disconnect() |
952
|
|
|
self._pa.ana_param_x_axis_inc_ScienDSpinBox.editingFinished.disconnect() |
953
|
|
|
self._pe.extract_param_ana_window_start_SpinBox.editingFinished.disconnect() |
954
|
|
|
self._pe.extract_param_ana_window_width_SpinBox.editingFinished.disconnect() |
955
|
|
|
self._pe.extract_param_ref_window_start_SpinBox.editingFinished.disconnect() |
956
|
|
|
self._pe.extract_param_ref_window_width_SpinBox.editingFinished.disconnect() |
957
|
|
|
self._pe.conv_std_dev.valueChanged.disconnect() |
958
|
|
|
self._pa.ana_param_fc_bins_ComboBox.currentIndexChanged.disconnect() |
959
|
|
|
#self._pa.second_plot_ComboBox.currentIndexChanged.disconnect() |
960
|
|
|
self._pa.pulser_activation_config_ComboBox.currentIndexChanged.disconnect() |
961
|
|
|
self._pe.laserpulses_ComboBox.currentIndexChanged.disconnect() |
962
|
|
|
self.sig_start_line.sigPositionChanged.disconnect() |
963
|
|
|
self.sig_end_line.sigPositionChanged.disconnect() |
964
|
|
|
self.ref_start_line.sigPositionChanged.disconnect() |
965
|
|
|
self.ref_end_line.sigPositionChanged.disconnect() |
966
|
|
|
self._pe.slider_conv_std_dev.sliderReleased.disconnect() |
967
|
|
|
return |
968
|
|
|
|
969
|
|
View Code Duplication |
def _analysis_apply_hardware_constraints(self): |
|
|
|
|
970
|
|
|
""" |
971
|
|
|
Retrieve the constraints from pulser and fast counter hardware and apply these constraints |
972
|
|
|
to the analysis tab GUI elements. |
973
|
|
|
""" |
974
|
|
|
# block signals |
975
|
|
|
self._pa.pulser_activation_config_ComboBox.blockSignals(True) |
976
|
|
|
self._pa.ana_param_fc_bins_ComboBox.blockSignals(True) |
977
|
|
|
# apply constraints |
978
|
|
|
pulser_constr, fastcounter_constr = self._pulsed_master_logic.get_hardware_constraints() |
979
|
|
|
sample_min = pulser_constr['sample_rate']['min'] |
980
|
|
|
sample_max = pulser_constr['sample_rate']['max'] |
981
|
|
|
sample_step = pulser_constr['sample_rate']['step'] |
982
|
|
|
self._pa.pulser_sample_freq_DSpinBox.setMinimum(sample_min) |
983
|
|
|
self._pa.pulser_sample_freq_DSpinBox.setMaximum(sample_max) |
984
|
|
|
self._pa.pulser_sample_freq_DSpinBox.setSingleStep(sample_step) |
985
|
|
|
self._pa.pulser_activation_config_ComboBox.clear() |
986
|
|
|
self._pa.pulser_activation_config_ComboBox.addItems(list(pulser_constr['activation_config'])) |
987
|
|
|
self._pa.ana_param_fc_bins_ComboBox.clear() |
988
|
|
|
for binwidth in fastcounter_constr['hardware_binwidth_list']: |
989
|
|
|
self._pa.ana_param_fc_bins_ComboBox.addItem(str(binwidth)) |
990
|
|
|
# unblock signals |
991
|
|
|
self._pa.pulser_activation_config_ComboBox.blockSignals(False) |
992
|
|
|
self._pa.ana_param_fc_bins_ComboBox.blockSignals(False) |
993
|
|
|
return |
994
|
|
|
|
995
|
|
|
def measurement_run_stop_clicked(self, isChecked): |
996
|
|
|
""" Manages what happens if pulsed measurement is started or stopped. |
997
|
|
|
|
998
|
|
|
@param bool isChecked: start scan if that is possible |
999
|
|
|
""" |
1000
|
|
|
if isChecked: |
1001
|
|
|
self._pulsed_master_logic.start_measurement() |
1002
|
|
|
else: |
1003
|
|
|
self._pulsed_master_logic.stop_measurement() |
1004
|
|
|
return |
1005
|
|
|
|
1006
|
|
|
#ToDo: I think that is not really working yet. Yeap, true.... |
1007
|
|
|
def measurement_continue_pause_clicked(self, isChecked): |
1008
|
|
|
""" Continues and pauses the measurement. """ |
1009
|
|
|
if isChecked: |
1010
|
|
|
self._pulsed_master_logic.pause_measurement() |
1011
|
|
|
else: |
1012
|
|
|
self._pulsed_master_logic.continue_measurement() |
1013
|
|
|
return |
1014
|
|
|
|
1015
|
|
|
def measurement_status_updated(self, is_running, is_paused): |
1016
|
|
|
""" |
1017
|
|
|
|
1018
|
|
|
@param is_running: |
1019
|
|
|
@param is_paused: |
1020
|
|
|
@return: |
1021
|
|
|
""" |
1022
|
|
|
# block signals |
1023
|
|
|
self._mw.action_run_stop.blockSignals(True) |
1024
|
|
|
self._mw.action_continue_pause.blockSignals(True) |
1025
|
|
|
|
1026
|
|
|
# Enable/Disable widgets |
1027
|
|
|
if is_running: |
1028
|
|
|
self._pa.ext_control_use_mw_CheckBox.setEnabled(False) |
1029
|
|
|
self._pa.ext_control_mw_freq_DoubleSpinBox.setEnabled(False) |
1030
|
|
|
self._pa.ext_control_mw_power_DoubleSpinBox.setEnabled(False) |
1031
|
|
|
self._pa.pulser_sample_freq_DSpinBox.setEnabled(False) |
1032
|
|
|
self._pa.pulser_activation_config_ComboBox.setEnabled(False) |
1033
|
|
|
self._pa.ana_param_fc_bins_ComboBox.setEnabled(False) |
1034
|
|
|
self._pa.ana_param_laserpulse_defined_CheckBox.setEnabled(False) |
1035
|
|
|
self._pa.ana_param_num_laser_pulse_SpinBox.setEnabled(False) |
1036
|
|
|
self._pa.ana_param_record_length_SpinBox.setEnabled(False) |
1037
|
|
|
self._pa.ana_param_ignore_first_CheckBox.setEnabled(False) |
1038
|
|
|
self._pa.ana_param_ignore_last_CheckBox.setEnabled(False) |
1039
|
|
|
self._pa.ana_param_alternating_CheckBox.setEnabled(False) |
1040
|
|
|
self._pa.ana_param_x_axis_defined_CheckBox.setEnabled(False) |
1041
|
|
|
self._pa.ana_param_x_axis_start_ScienDSpinBox.setEnabled(False) |
1042
|
|
|
self._pa.ana_param_x_axis_inc_ScienDSpinBox.setEnabled(False) |
1043
|
|
|
self._pg.load_ensemble_PushButton.setEnabled(False) |
1044
|
|
|
# self._pg.load_sequence_PushButton.setEnabled(False) |
1045
|
|
|
self._mw.pulser_on_off_PushButton.setEnabled(False) |
1046
|
|
|
self._mw.action_continue_pause.setEnabled(True) |
1047
|
|
|
self._mw.action_pull_data.setEnabled(True) |
1048
|
|
|
if not self._mw.action_run_stop.isChecked(): |
1049
|
|
|
self._mw.action_run_stop.toggle() |
1050
|
|
|
else: |
1051
|
|
|
self._pa.ext_control_use_mw_CheckBox.setEnabled(True) |
1052
|
|
|
self._pa.ext_control_mw_freq_DoubleSpinBox.setEnabled(True) |
1053
|
|
|
self._pa.ext_control_mw_power_DoubleSpinBox.setEnabled(True) |
1054
|
|
|
self._pa.pulser_sample_freq_DSpinBox.setEnabled(True) |
1055
|
|
|
self._pa.pulser_activation_config_ComboBox.setEnabled(True) |
1056
|
|
|
self._pa.ana_param_fc_bins_ComboBox.setEnabled(True) |
1057
|
|
|
self._pa.ana_param_laserpulse_defined_CheckBox.setEnabled(True) |
1058
|
|
|
self._pa.ana_param_num_laser_pulse_SpinBox.setEnabled(True) |
1059
|
|
|
self._pa.ana_param_record_length_SpinBox.setEnabled(True) |
1060
|
|
|
self._pa.ana_param_ignore_first_CheckBox.setEnabled(True) |
1061
|
|
|
self._pa.ana_param_ignore_last_CheckBox.setEnabled(True) |
1062
|
|
|
self._pa.ana_param_alternating_CheckBox.setEnabled(True) |
1063
|
|
|
self._pa.ana_param_x_axis_defined_CheckBox.setEnabled(True) |
1064
|
|
|
self._pa.ana_param_x_axis_start_ScienDSpinBox.setEnabled(True) |
1065
|
|
|
self._pa.ana_param_x_axis_inc_ScienDSpinBox.setEnabled(True) |
1066
|
|
|
self._pg.load_ensemble_PushButton.setEnabled(True) |
1067
|
|
|
# self._pg.load_sequence_PushButton.setEnabled(True) |
1068
|
|
|
self._mw.pulser_on_off_PushButton.setEnabled(True) |
1069
|
|
|
self._mw.action_continue_pause.setEnabled(False) |
1070
|
|
|
self._mw.action_pull_data.setEnabled(False) |
1071
|
|
|
if self._mw.action_run_stop.isChecked(): |
1072
|
|
|
self._mw.action_run_stop.toggle() |
1073
|
|
|
if is_paused: |
1074
|
|
|
if not self._mw.action_continue_pause.isChecked(): |
1075
|
|
|
self._mw.action_continue_pause.toggle() |
1076
|
|
|
else: |
1077
|
|
|
if self._mw.action_continue_pause.isChecked(): |
1078
|
|
|
self._mw.action_continue_pause.toggle() |
1079
|
|
|
# unblock signals |
1080
|
|
|
self._mw.action_run_stop.blockSignals(False) |
1081
|
|
|
self._mw.action_continue_pause.blockSignals(False) |
1082
|
|
|
return |
1083
|
|
|
|
1084
|
|
|
def pull_data_clicked(self): |
1085
|
|
|
""" Pulls and analysis the data when the 'action_pull_data'-button is clicked. """ |
1086
|
|
|
self._pulsed_master_logic.manually_pull_data() |
1087
|
|
|
return |
1088
|
|
|
|
1089
|
|
View Code Duplication |
def signal_data_updated(self, x_data, y_signal_data, y2_signal_data, y_error_data, y2_error_data): |
|
|
|
|
1090
|
|
|
""" |
1091
|
|
|
|
1092
|
|
|
@param x_data: |
1093
|
|
|
@param y_signal_data: |
1094
|
|
|
@param y2_signal_data: |
1095
|
|
|
@param y_error_data: |
1096
|
|
|
@param y2_error_data: |
1097
|
|
|
@return: |
1098
|
|
|
""" |
1099
|
|
|
show_error_bars = self._pa.ana_param_errorbars_CheckBox.isChecked() |
1100
|
|
|
is_alternating = self._pa.ana_param_alternating_CheckBox.isChecked() |
1101
|
|
|
if show_error_bars: |
1102
|
|
|
beamwidth = np.inf |
1103
|
|
|
for i in range(len(x_data) - 1): |
1104
|
|
|
width = x_data[i + 1] - x_data[i] |
1105
|
|
|
width = width / 3 |
1106
|
|
|
if width <= beamwidth: |
1107
|
|
|
beamwidth = width |
1108
|
|
|
# create ErrorBarItems |
1109
|
|
|
self.signal_image_error_bars.setData(x=x_data, y=y_signal_data, top=y_error_data, |
1110
|
|
|
bottom=y_error_data, beam=beamwidth) |
1111
|
|
|
if is_alternating: |
1112
|
|
|
self.signal_image_error_bars2.setData(x=x_data, y=y2_signal_data, top=y2_error_data, |
1113
|
|
|
bottom=y2_error_data, beam=beamwidth) |
1114
|
|
|
if not self.signal_image_error_bars in self._pa.pulse_analysis_PlotWidget.items(): |
1115
|
|
|
self._pa.pulse_analysis_PlotWidget.addItem(self.signal_image_error_bars) |
1116
|
|
|
if is_alternating: |
1117
|
|
|
self._pa.pulse_analysis_PlotWidget.addItem(self.signal_image_error_bars2) |
1118
|
|
|
else: |
1119
|
|
|
if self.signal_image_error_bars in self._pa.pulse_analysis_PlotWidget.items(): |
1120
|
|
|
self._pa.pulse_analysis_PlotWidget.removeItem(self.signal_image_error_bars) |
1121
|
|
|
if is_alternating: |
1122
|
|
|
self._pa.pulse_analysis_PlotWidget.addItem(self.signal_image_error_bars2) |
1123
|
|
|
|
1124
|
|
|
# dealing with the actual signal |
1125
|
|
|
self.signal_image.setData(x=x_data, y=y_signal_data) |
1126
|
|
|
if is_alternating: |
1127
|
|
|
self.signal_image2.setData(x=x_data, y=y2_signal_data) |
1128
|
|
|
|
1129
|
|
|
# dealing with the error plot |
1130
|
|
|
self.measuring_error_image.setData(x=x_data, y=y_error_data) |
1131
|
|
|
if is_alternating: |
1132
|
|
|
self.measuring_error_image2.setData(x=x_data, y=y2_error_data) |
1133
|
|
|
return |
1134
|
|
|
|
1135
|
|
|
# FIXME: Implement that |
1136
|
|
|
def save_clicked(self): |
1137
|
|
|
"""Saves the current data""" |
1138
|
|
|
self._mw.action_save.setEnabled(False) |
1139
|
|
|
save_tag = self._mw.save_tag_LineEdit.text() |
1140
|
|
|
self._pulsed_master_logic.save_measurement_data(save_tag) |
1141
|
|
|
self._mw.action_save.setEnabled(True) |
1142
|
|
|
return |
1143
|
|
|
|
1144
|
|
|
def fit_clicked(self): |
1145
|
|
|
"""Fits the current data""" |
1146
|
|
|
current_fit_function = self._pa.fit_param_fit_func_ComboBox.currentText() |
1147
|
|
|
self._pulsed_master_logic.do_fit(current_fit_function) |
1148
|
|
|
return |
1149
|
|
|
|
1150
|
|
View Code Duplication |
def fit_data_updated(self, fit_function, fit_data_x, fit_data_y, param_dict, result_dict): |
|
|
|
|
1151
|
|
|
""" |
1152
|
|
|
|
1153
|
|
|
@param fit_function: |
1154
|
|
|
@param fit_data_x: |
1155
|
|
|
@param fit_data_y: |
1156
|
|
|
@param param_dict: |
1157
|
|
|
@param result_dict: |
1158
|
|
|
@return: |
1159
|
|
|
""" |
1160
|
|
|
# block signals |
1161
|
|
|
self._pa.fit_param_fit_func_ComboBox.blockSignals(True) |
1162
|
|
|
# set widgets |
1163
|
|
|
self._pa.fit_param_results_TextBrowser.clear() |
1164
|
|
|
fit_text = units.create_formatted_output(param_dict) |
1165
|
|
|
self._pa.fit_param_results_TextBrowser.setPlainText(fit_text) |
1166
|
|
|
self.fit_image.setData(x=fit_data_x, y=fit_data_y) |
1167
|
|
|
if fit_function == 'No Fit' and self.fit_image in self._pa.pulse_analysis_PlotWidget.items(): |
1168
|
|
|
self._pa.pulse_analysis_PlotWidget.removeItem(self.fit_image) |
1169
|
|
|
elif fit_function != 'No Fit' and self.fit_image not in self._pa.pulse_analysis_PlotWidget.items(): |
1170
|
|
|
self._pa.pulse_analysis_PlotWidget.addItem(self.fit_image) |
1171
|
|
|
if self._pa.fit_param_fit_func_ComboBox.currentText() != fit_function: |
1172
|
|
|
index = self._pa.fit_param_fit_func_ComboBox.findText(fit_function) |
1173
|
|
|
if index >= 0: |
1174
|
|
|
self._pa.fit_param_fit_func_ComboBox.setCurrentIndex(index) |
1175
|
|
|
# unblock signals |
1176
|
|
|
self._pa.fit_param_fit_func_ComboBox.blockSignals(False) |
1177
|
|
|
return |
1178
|
|
|
|
1179
|
|
|
def elapsed_time_updated(self, elapsed_time, elapsed_time_str): |
1180
|
|
|
""" |
1181
|
|
|
Refreshes the elapsed time and sweeps of the measurement. |
1182
|
|
|
|
1183
|
|
|
@param elapsed_time: |
1184
|
|
|
@param elapsed_time_str: |
1185
|
|
|
@return: |
1186
|
|
|
""" |
1187
|
|
|
# block signals |
1188
|
|
|
self._pa.time_param_elapsed_time_LineEdit.blockSignals(True) |
1189
|
|
|
# Set widgets |
1190
|
|
|
self._pa.time_param_elapsed_time_LineEdit.setText(elapsed_time_str) |
1191
|
|
|
# unblock signals |
1192
|
|
|
self._pa.time_param_elapsed_time_LineEdit.blockSignals(True) |
1193
|
|
|
return |
1194
|
|
|
|
1195
|
|
View Code Duplication |
def ext_mw_params_changed(self): |
|
|
|
|
1196
|
|
|
""" Shows or hides input widgets which are necessary if an external mw is turned on""" |
1197
|
|
|
use_ext_microwave = self._pa.ext_control_use_mw_CheckBox.isChecked() |
1198
|
|
|
microwave_freq = self._pa.ext_control_mw_freq_DoubleSpinBox.value() |
1199
|
|
|
microwave_power = self._pa.ext_control_mw_power_DoubleSpinBox.value() |
1200
|
|
|
if use_ext_microwave: |
1201
|
|
|
self._pa.ext_control_mw_freq_Label.setEnabled(True) |
1202
|
|
|
self._pa.ext_control_mw_freq_DoubleSpinBox.setEnabled(True) |
1203
|
|
|
self._pa.ext_control_mw_power_Label.setEnabled(True) |
1204
|
|
|
self._pa.ext_control_mw_power_DoubleSpinBox.setEnabled(True) |
1205
|
|
|
|
1206
|
|
|
self._pa.ext_control_mw_freq_Label.setVisible(True) |
1207
|
|
|
self._pa.ext_control_mw_freq_DoubleSpinBox.setVisible(True) |
1208
|
|
|
self._pa.ext_control_mw_power_Label.setVisible(True) |
1209
|
|
|
self._pa.ext_control_mw_power_DoubleSpinBox.setVisible(True) |
1210
|
|
|
else: |
1211
|
|
|
self._pa.ext_control_mw_freq_Label.setEnabled(False) |
1212
|
|
|
self._pa.ext_control_mw_freq_DoubleSpinBox.setEnabled(False) |
1213
|
|
|
self._pa.ext_control_mw_power_Label.setEnabled(False) |
1214
|
|
|
self._pa.ext_control_mw_power_DoubleSpinBox.setEnabled(False) |
1215
|
|
|
|
1216
|
|
|
self._pa.ext_control_mw_freq_Label.setVisible(False) |
1217
|
|
|
self._pa.ext_control_mw_freq_DoubleSpinBox.setVisible(False) |
1218
|
|
|
self._pa.ext_control_mw_power_Label.setVisible(False) |
1219
|
|
|
self._pa.ext_control_mw_power_DoubleSpinBox.setVisible(False) |
1220
|
|
|
|
1221
|
|
|
self._pulsed_master_logic.ext_microwave_settings_changed(microwave_freq, microwave_power, |
1222
|
|
|
use_ext_microwave) |
1223
|
|
|
return |
1224
|
|
|
|
1225
|
|
View Code Duplication |
def microwave_settings_updated(self, frequency, power, use_ext_microwave): |
|
|
|
|
1226
|
|
|
""" |
1227
|
|
|
|
1228
|
|
|
@param frequency: |
1229
|
|
|
@param power: |
1230
|
|
|
@param use_ext_microwave: |
1231
|
|
|
@return: |
1232
|
|
|
""" |
1233
|
|
|
# block signals |
1234
|
|
|
self._pa.ext_control_mw_freq_DoubleSpinBox.blockSignals(True) |
1235
|
|
|
self._pa.ext_control_mw_power_DoubleSpinBox.blockSignals(True) |
1236
|
|
|
self._pa.ext_control_use_mw_CheckBox.blockSignals(True) |
1237
|
|
|
# set widgets |
1238
|
|
|
self._pa.ext_control_mw_freq_DoubleSpinBox.setValue(frequency) |
1239
|
|
|
self._pa.ext_control_mw_power_DoubleSpinBox.setValue(power) |
1240
|
|
|
self._pa.ext_control_use_mw_CheckBox.setChecked(use_ext_microwave) |
1241
|
|
|
# set visibility |
1242
|
|
|
if use_ext_microwave: |
1243
|
|
|
self._pa.ext_control_mw_freq_Label.setEnabled(True) |
1244
|
|
|
self._pa.ext_control_mw_freq_DoubleSpinBox.setEnabled(True) |
1245
|
|
|
self._pa.ext_control_mw_power_Label.setEnabled(True) |
1246
|
|
|
self._pa.ext_control_mw_power_DoubleSpinBox.setEnabled(True) |
1247
|
|
|
|
1248
|
|
|
self._pa.ext_control_mw_freq_Label.setVisible(True) |
1249
|
|
|
self._pa.ext_control_mw_freq_DoubleSpinBox.setVisible(True) |
1250
|
|
|
self._pa.ext_control_mw_power_Label.setVisible(True) |
1251
|
|
|
self._pa.ext_control_mw_power_DoubleSpinBox.setVisible(True) |
1252
|
|
|
else: |
1253
|
|
|
self._pa.ext_control_mw_freq_Label.setEnabled(False) |
1254
|
|
|
self._pa.ext_control_mw_freq_DoubleSpinBox.setEnabled(False) |
1255
|
|
|
self._pa.ext_control_mw_power_Label.setEnabled(False) |
1256
|
|
|
self._pa.ext_control_mw_power_DoubleSpinBox.setEnabled(False) |
1257
|
|
|
|
1258
|
|
|
self._pa.ext_control_mw_freq_Label.setVisible(False) |
1259
|
|
|
self._pa.ext_control_mw_freq_DoubleSpinBox.setVisible(False) |
1260
|
|
|
self._pa.ext_control_mw_power_Label.setVisible(False) |
1261
|
|
|
self._pa.ext_control_mw_power_DoubleSpinBox.setVisible(False) |
1262
|
|
|
# unblock signals |
1263
|
|
|
self._pa.ext_control_mw_freq_DoubleSpinBox.blockSignals(False) |
1264
|
|
|
self._pa.ext_control_mw_power_DoubleSpinBox.blockSignals(False) |
1265
|
|
|
self._pa.ext_control_use_mw_CheckBox.blockSignals(False) |
1266
|
|
|
return |
1267
|
|
|
|
1268
|
|
|
def microwave_running_updated(self, is_running): |
1269
|
|
|
""" |
1270
|
|
|
|
1271
|
|
|
@return: |
1272
|
|
|
""" |
1273
|
|
|
pass |
1274
|
|
|
|
1275
|
|
|
def pulse_generator_settings_changed(self): |
1276
|
|
|
""" |
1277
|
|
|
|
1278
|
|
|
@return: |
1279
|
|
|
""" |
1280
|
|
|
# FIXME: Properly implement amplitude and interleave |
1281
|
|
|
sample_rate_hz = self._pa.pulser_sample_freq_DSpinBox.value() |
1282
|
|
|
activation_config_name = self._pa.pulser_activation_config_ComboBox.currentText() |
1283
|
|
|
analogue_amplitude, dummy = self._pulsed_master_logic._measurement_logic._pulse_generator_device.get_analog_level() |
1284
|
|
|
interleave_on = self._pa.pulser_use_interleave_CheckBox.isChecked() |
1285
|
|
|
self._pulsed_master_logic.pulse_generator_settings_changed(sample_rate_hz, |
1286
|
|
|
activation_config_name, |
1287
|
|
|
analogue_amplitude, |
1288
|
|
|
interleave_on) |
1289
|
|
|
return |
1290
|
|
|
|
1291
|
|
View Code Duplication |
def pulse_generator_settings_updated(self, sample_rate_hz, activation_config_name, |
|
|
|
|
1292
|
|
|
activation_config, analogue_amplitude, interleave_on): |
1293
|
|
|
""" |
1294
|
|
|
|
1295
|
|
|
@param sample_rate_hz: |
1296
|
|
|
@param activation_config_name: |
1297
|
|
|
@param analogue_amplitude: |
1298
|
|
|
@param interleave_on: |
1299
|
|
|
@return: |
1300
|
|
|
""" |
1301
|
|
|
# block signals |
1302
|
|
|
self._pa.pulser_sample_freq_DSpinBox.blockSignals(True) |
1303
|
|
|
self._pa.pulser_activation_config_ComboBox.blockSignals(True) |
1304
|
|
|
self._pa.pulser_activation_config_LineEdit.blockSignals(True) |
1305
|
|
|
self._pa.pulser_use_interleave_CheckBox.blockSignals(True) |
1306
|
|
|
# Set widgets |
1307
|
|
|
# FIXME: Properly implement amplitude and interleave |
1308
|
|
|
self._pa.pulser_sample_freq_DSpinBox.setValue(sample_rate_hz) |
1309
|
|
|
index = self._pa.pulser_activation_config_ComboBox.findText(activation_config_name) |
1310
|
|
|
self._pa.pulser_activation_config_ComboBox.setCurrentIndex(index) |
1311
|
|
|
config_display_str = '' |
1312
|
|
|
for channel in activation_config: |
1313
|
|
|
config_display_str += channel + ' | ' |
1314
|
|
|
config_display_str = config_display_str[:-3] |
1315
|
|
|
self._pa.pulser_activation_config_LineEdit.setText(config_display_str) |
1316
|
|
|
self._pa.pulser_use_interleave_CheckBox.setChecked(interleave_on) |
1317
|
|
|
# unblock signals |
1318
|
|
|
self._pa.pulser_sample_freq_DSpinBox.blockSignals(False) |
1319
|
|
|
self._pa.pulser_activation_config_ComboBox.blockSignals(False) |
1320
|
|
|
self._pa.pulser_activation_config_LineEdit.blockSignals(False) |
1321
|
|
|
self._pa.pulser_use_interleave_CheckBox.blockSignals(False) |
1322
|
|
|
return |
1323
|
|
|
|
1324
|
|
|
def fast_counter_settings_changed(self): |
1325
|
|
|
""" |
1326
|
|
|
|
1327
|
|
|
@return: |
1328
|
|
|
""" |
1329
|
|
|
record_length_s = self._pa.ana_param_record_length_SpinBox.value() |
1330
|
|
|
bin_width_s = float(self._pa.ana_param_fc_bins_ComboBox.currentText()) |
1331
|
|
|
self._pulsed_master_logic.fast_counter_settings_changed(bin_width_s, record_length_s) |
1332
|
|
|
return |
1333
|
|
|
|
1334
|
|
View Code Duplication |
def fast_counter_settings_updated(self, bin_width_s, record_length_s): |
|
|
|
|
1335
|
|
|
""" |
1336
|
|
|
|
1337
|
|
|
@param bin_width_s: |
1338
|
|
|
@param record_length_s: |
1339
|
|
|
@return: |
1340
|
|
|
""" |
1341
|
|
|
# block signals |
1342
|
|
|
self._pa.ana_param_record_length_SpinBox.blockSignals(True) |
1343
|
|
|
self._pa.ana_param_fc_bins_ComboBox.blockSignals(True) |
1344
|
|
|
# set widgets |
1345
|
|
|
self._pa.ana_param_record_length_SpinBox.setValue(record_length_s) |
1346
|
|
|
index = self._pa.ana_param_fc_bins_ComboBox.findText(str(bin_width_s)) |
1347
|
|
|
self._pa.ana_param_fc_bins_ComboBox.setCurrentIndex(index) |
1348
|
|
|
# unblock signals |
1349
|
|
|
self._pa.ana_param_record_length_SpinBox.blockSignals(False) |
1350
|
|
|
self._pa.ana_param_fc_bins_ComboBox.blockSignals(False) |
1351
|
|
|
return |
1352
|
|
|
|
1353
|
|
View Code Duplication |
def measurement_sequence_settings_changed(self): |
|
|
|
|
1354
|
|
|
""" |
1355
|
|
|
|
1356
|
|
|
@return: |
1357
|
|
|
""" |
1358
|
|
|
laser_ignore_list = [] |
1359
|
|
|
if self._pa.ana_param_ignore_first_CheckBox.isChecked(): |
1360
|
|
|
laser_ignore_list.append(0) |
1361
|
|
|
if self._pa.ana_param_ignore_last_CheckBox.isChecked(): |
1362
|
|
|
laser_ignore_list.append(-1) |
1363
|
|
|
alternating = self._pa.ana_param_alternating_CheckBox.isChecked() |
1364
|
|
|
num_of_lasers = self._pa.ana_param_num_laser_pulse_SpinBox.value() |
1365
|
|
|
xaxis_start = self._pa.ana_param_x_axis_start_ScienDSpinBox.value() |
1366
|
|
|
xaxis_incr = self._pa.ana_param_x_axis_inc_ScienDSpinBox.value() |
1367
|
|
|
laser_trigger_delay = self._as.ana_param_lasertrigger_delay_ScienDSpinBox.value() |
1368
|
|
|
# FIXME: properly implement sequence_length_s |
1369
|
|
|
sequence_length_s = self._pulsed_master_logic._measurement_logic.sequence_length_s |
1370
|
|
|
num_of_ticks = num_of_lasers - len(laser_ignore_list) |
1371
|
|
|
if alternating: |
1372
|
|
|
num_of_ticks //= 2 |
1373
|
|
|
measurement_ticks = np.arange(xaxis_start, |
1374
|
|
|
xaxis_start + (xaxis_incr * num_of_ticks) - (xaxis_incr / 2), |
1375
|
|
|
xaxis_incr) |
1376
|
|
|
|
1377
|
|
|
self._pulsed_master_logic.measurement_sequence_settings_changed(measurement_ticks, |
1378
|
|
|
num_of_lasers, |
1379
|
|
|
sequence_length_s, |
1380
|
|
|
laser_ignore_list, |
1381
|
|
|
alternating, |
1382
|
|
|
laser_trigger_delay) |
1383
|
|
|
return |
1384
|
|
|
|
1385
|
|
View Code Duplication |
def measurement_sequence_settings_updated(self, measurement_ticks, number_of_lasers, |
|
|
|
|
1386
|
|
|
sequence_length_s, laser_ignore_list, alternating, |
1387
|
|
|
laser_trigger_delay): |
1388
|
|
|
""" |
1389
|
|
|
|
1390
|
|
|
@param measurement_ticks: |
1391
|
|
|
@param number_of_lasers: |
1392
|
|
|
@param sequence_length_s: |
1393
|
|
|
@param laser_ignore_list: |
1394
|
|
|
@param alternating: |
1395
|
|
|
@param laser_trigger_delay: |
1396
|
|
|
@return: |
1397
|
|
|
""" |
1398
|
|
|
# block signals |
1399
|
|
|
self._pa.ana_param_ignore_first_CheckBox.blockSignals(True) |
1400
|
|
|
self._pa.ana_param_ignore_last_CheckBox.blockSignals(True) |
1401
|
|
|
self._pa.ana_param_alternating_CheckBox.blockSignals(True) |
1402
|
|
|
self._pa.ana_param_num_laser_pulse_SpinBox.blockSignals(True) |
1403
|
|
|
self._pa.ana_param_x_axis_start_ScienDSpinBox.blockSignals(True) |
1404
|
|
|
self._pa.ana_param_x_axis_inc_ScienDSpinBox.blockSignals(True) |
1405
|
|
|
self._as.ana_param_lasertrigger_delay_ScienDSpinBox.blockSignals(True) |
1406
|
|
|
self._pe.laserpulses_ComboBox.blockSignals(True) |
1407
|
|
|
# set widgets |
1408
|
|
|
self._pa.ana_param_ignore_first_CheckBox.setChecked(0 in laser_ignore_list) |
1409
|
|
|
self._pa.ana_param_ignore_last_CheckBox.setChecked(-1 in laser_ignore_list) |
1410
|
|
|
self._pa.ana_param_alternating_CheckBox.setChecked(alternating) |
1411
|
|
|
self._pa.ana_param_num_laser_pulse_SpinBox.setValue(number_of_lasers) |
1412
|
|
|
self._as.ana_param_lasertrigger_delay_ScienDSpinBox.setValue(laser_trigger_delay) |
1413
|
|
|
self._pa.ana_param_x_axis_start_ScienDSpinBox.setValue(measurement_ticks[0]) |
1414
|
|
|
self._pa.ana_param_x_axis_inc_ScienDSpinBox.setValue( |
1415
|
|
|
(measurement_ticks[-1] - measurement_ticks[0]) / (len(measurement_ticks)-1)) |
1416
|
|
|
self._pe.laserpulses_ComboBox.addItems([str(i) for i in range(number_of_lasers+1)]) |
1417
|
|
|
# change plots accordingly |
1418
|
|
|
if alternating: |
1419
|
|
|
if self.signal_image2 not in self._pa.pulse_analysis_PlotWidget.items(): |
1420
|
|
|
self._pa.pulse_analysis_PlotWidget.addItem(self.signal_image2) |
1421
|
|
|
if self.signal_image_error_bars in self._pa.pulse_analysis_PlotWidget.items() and self.signal_image_error_bars2 not in self._pa.pulse_analysis_PlotWidget.items(): |
1422
|
|
|
self._pa.pulse_analysis_PlotWidget.addItem(self.signal_image_error_bars2) |
1423
|
|
|
if self.measuring_error_image2 not in self._pe.measuring_error_PlotWidget.items(): |
1424
|
|
|
self._pe.measuring_error_PlotWidget.addItem(self.measuring_error_image2) |
1425
|
|
|
else: |
1426
|
|
|
if self.signal_image2 in self._pa.pulse_analysis_PlotWidget.items(): |
1427
|
|
|
self._pa.pulse_analysis_PlotWidget.removeItem(self.signal_image2) |
1428
|
|
|
if self.signal_image_error_bars2 in self._pa.pulse_analysis_PlotWidget.items(): |
1429
|
|
|
self._pa.pulse_analysis_PlotWidget.removeItem(self.signal_image_error_bars2) |
1430
|
|
|
if self.measuring_error_image2 in self._pe.measuring_error_PlotWidget.items(): |
1431
|
|
|
self._pe.measuring_error_PlotWidget.removeItem(self.measuring_error_image2) |
1432
|
|
|
# unblock signals |
1433
|
|
|
self._pa.ana_param_ignore_first_CheckBox.blockSignals(False) |
1434
|
|
|
self._pa.ana_param_ignore_last_CheckBox.blockSignals(False) |
1435
|
|
|
self._pa.ana_param_alternating_CheckBox.blockSignals(False) |
1436
|
|
|
self._pa.ana_param_num_laser_pulse_SpinBox.blockSignals(False) |
1437
|
|
|
self._pa.ana_param_x_axis_start_ScienDSpinBox.blockSignals(False) |
1438
|
|
|
self._pa.ana_param_x_axis_inc_ScienDSpinBox.blockSignals(False) |
1439
|
|
|
self._as.ana_param_lasertrigger_delay_ScienDSpinBox.blockSignals(False) |
1440
|
|
|
self._pe.laserpulses_ComboBox.blockSignals(False) |
1441
|
|
|
return |
1442
|
|
|
|
1443
|
|
View Code Duplication |
def toggle_laser_xaxis_editor(self): |
|
|
|
|
1444
|
|
|
""" Shows or hides input widgets which are necessary if the x axis id defined or not.""" |
1445
|
|
|
if self._pa.ana_param_x_axis_defined_CheckBox.isChecked(): |
1446
|
|
|
self._pa.ana_param_x_axis_start_Label.setVisible(True) |
1447
|
|
|
self._pa.ana_param_x_axis_start_ScienDSpinBox.setVisible(True) |
1448
|
|
|
self._pa.ana_param_x_axis_inc_Label.setVisible(True) |
1449
|
|
|
self._pa.ana_param_x_axis_inc_ScienDSpinBox.setVisible(True) |
1450
|
|
|
self._pa.ana_param_x_axis_start_ScienDSpinBox.setEnabled(True) |
1451
|
|
|
self._pa.ana_param_x_axis_inc_ScienDSpinBox.setEnabled(True) |
1452
|
|
|
else: |
1453
|
|
|
self._pa.ana_param_x_axis_start_Label.setVisible(False) |
1454
|
|
|
self._pa.ana_param_x_axis_start_ScienDSpinBox.setVisible(False) |
1455
|
|
|
self._pa.ana_param_x_axis_inc_Label.setVisible(False) |
1456
|
|
|
self._pa.ana_param_x_axis_inc_ScienDSpinBox.setVisible(False) |
1457
|
|
|
self._pa.ana_param_x_axis_start_ScienDSpinBox.setEnabled(False) |
1458
|
|
|
self._pa.ana_param_x_axis_inc_ScienDSpinBox.setEnabled(False) |
1459
|
|
|
|
1460
|
|
|
if self._pa.ana_param_laserpulse_defined_CheckBox.isChecked(): |
1461
|
|
|
self._pa.ana_param_num_laserpulses_Label.setVisible(True) |
1462
|
|
|
self._pa.ana_param_num_laser_pulse_SpinBox.setVisible(True) |
1463
|
|
|
self._pa.ana_param_record_length_Label.setVisible(True) |
1464
|
|
|
self._pa.ana_param_record_length_SpinBox.setVisible(True) |
1465
|
|
|
self._pa.ana_param_num_laser_pulse_SpinBox.setEnabled(True) |
1466
|
|
|
self._pa.ana_param_record_length_SpinBox.setEnabled(True) |
1467
|
|
|
else: |
1468
|
|
|
self._pa.ana_param_num_laserpulses_Label.setVisible(False) |
1469
|
|
|
self._pa.ana_param_num_laser_pulse_SpinBox.setVisible(False) |
1470
|
|
|
self._pa.ana_param_record_length_Label.setVisible(False) |
1471
|
|
|
self._pa.ana_param_record_length_SpinBox.setVisible(False) |
1472
|
|
|
self._pa.ana_param_num_laser_pulse_SpinBox.setEnabled(False) |
1473
|
|
|
self._pa.ana_param_record_length_SpinBox.setEnabled(False) |
1474
|
|
|
return |
1475
|
|
|
|
1476
|
|
View Code Duplication |
def toggle_error_bars(self): |
|
|
|
|
1477
|
|
|
""" |
1478
|
|
|
|
1479
|
|
|
@return: |
1480
|
|
|
""" |
1481
|
|
|
show_bars = self._pa.ana_param_errorbars_CheckBox.isChecked() |
1482
|
|
|
is_alternating = self.signal_image2 in self._pa.pulse_analysis_PlotWidget.items() |
1483
|
|
|
if show_bars: |
1484
|
|
|
if self.signal_image_error_bars not in self._pa.pulse_analysis_PlotWidget.items(): |
1485
|
|
|
self._pa.pulse_analysis_PlotWidget.addItem(self.signal_image_error_bars) |
1486
|
|
|
if is_alternating and self.signal_image_error_bars2 not in self._pa.pulse_analysis_PlotWidget.items(): |
1487
|
|
|
self._pa.pulse_analysis_PlotWidget.addItem(self.signal_image_error_bars2) |
1488
|
|
|
else: |
1489
|
|
|
if self.signal_image_error_bars in self._pa.pulse_analysis_PlotWidget.items(): |
1490
|
|
|
self._pa.pulse_analysis_PlotWidget.removeItem(self.signal_image_error_bars) |
1491
|
|
|
if is_alternating and self.signal_image_error_bars2 in self._pa.pulse_analysis_PlotWidget.items(): |
1492
|
|
|
self._pa.pulse_analysis_PlotWidget.removeItem(self.signal_image_error_bars2) |
1493
|
|
|
return |
1494
|
|
|
|
1495
|
|
|
# def change_second_plot(self): |
1496
|
|
|
# """ This method handles the second plot""" |
1497
|
|
|
# if self._mw.second_plot_ComboBox.currentText()=='None': |
1498
|
|
|
# self._mw.second_plot_GroupBox.setVisible(False) |
1499
|
|
|
# else: |
1500
|
|
|
# self._mw.second_plot_GroupBox.setVisible(True) |
1501
|
|
|
# |
1502
|
|
|
# # Here FFT is seperated from the other option. The reason for that |
1503
|
|
|
# # is preventing of code doubling |
1504
|
|
|
# if self._mw.second_plot_ComboBox.currentText() == 'FFT': |
1505
|
|
|
# fft_x, fft_y = self._pulsed_meas_logic.compute_fft() |
1506
|
|
|
# self.second_plot_image.setData(fft_x, fft_y) |
1507
|
|
|
# self._mw.pulse_analysis_second_PlotWidget.setLogMode(x=False, y=False) |
1508
|
|
|
# |
1509
|
|
|
# self._mw.pulse_analysis_second_PlotWidget.setLabel(axis='bottom', |
1510
|
|
|
# text=self._as.ana_param_second_plot_x_axis_name_LineEdit.text(), |
1511
|
|
|
# units=self._as.ana_param_second_plot_x_axis_unit_LineEdit.text()) |
1512
|
|
|
# self._mw.pulse_analysis_second_PlotWidget.setLabel(axis='left', |
1513
|
|
|
# text=self._as.ana_param_second_plot_y_axis_name_LineEdit.text(), |
1514
|
|
|
# units=self._as.ana_param_second_plot_y_axis_unit_LineEdit.text()) |
1515
|
|
|
# |
1516
|
|
|
# else: |
1517
|
|
|
# #FIXME: Is not working when there is a 0 in the values, therefore ignoring the first measurment point |
1518
|
|
|
# self.second_plot_image.setData(self._pulsed_meas_logic.signal_plot_x[1:], self._pulsed_meas_logic.signal_plot_y[1:]) |
1519
|
|
|
# |
1520
|
|
|
# if self._as.ana_param_second_plot_x_axis_name_LineEdit.text()== '': |
1521
|
|
|
# self._mw.pulse_analysis_second_PlotWidget.setLabel(axis='left', |
1522
|
|
|
# text=self._as.ana_param_y_axis_name_LineEdit.text(), |
1523
|
|
|
# units=self._as.ana_param_y_axis_unit_LineEdit.text()) |
1524
|
|
|
# self._mw.pulse_analysis_second_PlotWidget.setLabel(axis='bottom', |
1525
|
|
|
# text=self._as.ana_param_x_axis_name_LineEdit.text(), |
1526
|
|
|
# units=self._as.ana_param_x_axis_unit_LineEdit.text()) |
1527
|
|
|
# |
1528
|
|
|
# else: |
1529
|
|
|
# self._mw.pulse_analysis_second_PlotWidget.setLabel(axis='bottom', |
1530
|
|
|
# text=self._as.ana_param_second_plot_x_axis_name_LineEdit.text(), |
1531
|
|
|
# units=self._as.ana_param_second_plot_x_axis_unit_LineEdit.text()) |
1532
|
|
|
# self._mw.pulse_analysis_second_PlotWidget.setLabel(axis='left', |
1533
|
|
|
# text=self._as.ana_param_second_plot_y_axis_name_LineEdit.text(), |
1534
|
|
|
# units=self._as.ana_param_second_plot_y_axis_unit_LineEdit.text()) |
1535
|
|
|
# |
1536
|
|
|
# if self._mw.second_plot_ComboBox.currentText() == 'unchanged data': |
1537
|
|
|
# self._mw.pulse_analysis_second_PlotWidget.setLogMode(x=False, y=False) |
1538
|
|
|
# |
1539
|
|
|
# elif self._mw.second_plot_ComboBox.currentText() == 'Log(x)': |
1540
|
|
|
# self._mw.pulse_analysis_second_PlotWidget.setLogMode(x=True, y=False) |
1541
|
|
|
# |
1542
|
|
|
# elif self._mw.second_plot_ComboBox.currentText() == 'Log(y)': |
1543
|
|
|
# self._mw.pulse_analysis_second_PlotWidget.setLogMode(x=False,y=True) |
1544
|
|
|
# |
1545
|
|
|
# elif self._mw.second_plot_ComboBox.currentText() == 'Log(x)&Log(y)': |
1546
|
|
|
# self._mw.pulse_analysis_second_PlotWidget.setLogMode(x=True, y=True) |
1547
|
|
|
|
1548
|
|
|
def measurement_timer_changed(self): |
1549
|
|
|
""" This method handles the analysis timing""" |
1550
|
|
|
timer_interval = self._pa.time_param_ana_periode_DoubleSpinBox.value() |
1551
|
|
|
self._pulsed_master_logic.analysis_interval_changed(timer_interval) |
1552
|
|
|
return |
1553
|
|
|
|
1554
|
|
|
def measurement_timer_updated(self, timer_interval_s): |
1555
|
|
|
""" |
1556
|
|
|
|
1557
|
|
|
@param timer_interval_s: |
1558
|
|
|
@return: |
1559
|
|
|
""" |
1560
|
|
|
# block signals |
1561
|
|
|
self._pa.time_param_ana_periode_DoubleSpinBox.blockSignals(True) |
1562
|
|
|
# set widget |
1563
|
|
|
self._pa.time_param_ana_periode_DoubleSpinBox.setValue(timer_interval_s) |
1564
|
|
|
# unblock signals |
1565
|
|
|
self._pa.time_param_ana_periode_DoubleSpinBox.blockSignals(False) |
1566
|
|
|
return |
1567
|
|
|
|
1568
|
|
|
def conv_std_dev_changed(self): |
1569
|
|
|
""" |
1570
|
|
|
Uodate new value of standard deviation of gaussian filter |
1571
|
|
|
""" |
1572
|
|
|
# block signals |
1573
|
|
|
self._pe.slider_conv_std_dev.blockSignals(True) |
1574
|
|
|
# set widgets |
1575
|
|
|
std_dev = self._pe.conv_std_dev.value() |
1576
|
|
|
self._pe.slider_conv_std_dev.setValue(std_dev) |
1577
|
|
|
# unblock signals |
1578
|
|
|
self._pe.slider_conv_std_dev.blockSignals(False) |
1579
|
|
|
|
1580
|
|
|
self._pulsed_master_logic.analysis_method_changed(std_dev) |
1581
|
|
|
return |
1582
|
|
|
|
1583
|
|
|
def slider_conv_std_dev_changed(self): |
1584
|
|
|
""" |
1585
|
|
|
Uodate new value of standard deviation of gaussian filter |
1586
|
|
|
from slider |
1587
|
|
|
""" |
1588
|
|
|
# block signals |
1589
|
|
|
self._pe.conv_std_dev.blockSignals(True) |
1590
|
|
|
# set widgets |
1591
|
|
|
std_dev = self._pe.slider_conv_std_dev.value() |
1592
|
|
|
self._pe.conv_std_dev.setValue(std_dev) |
1593
|
|
|
# unblock signals |
1594
|
|
|
self._pe.conv_std_dev.blockSignals(False) |
1595
|
|
|
|
1596
|
|
|
self._pulsed_master_logic.analysis_method_changed(std_dev) |
1597
|
|
|
return |
1598
|
|
|
|
1599
|
|
View Code Duplication |
def analysis_method_updated(self, gaussfilt_std_dev): |
|
|
|
|
1600
|
|
|
""" |
1601
|
|
|
|
1602
|
|
|
@param gaussfilt_std_dev: |
1603
|
|
|
@return: |
1604
|
|
|
""" |
1605
|
|
|
# block signals |
1606
|
|
|
self._pe.slider_conv_std_dev.blockSignals(True) |
1607
|
|
|
self._pe.conv_std_dev.blockSignals(True) |
1608
|
|
|
# set widgets |
1609
|
|
|
self._pe.slider_conv_std_dev.setValue(gaussfilt_std_dev) |
1610
|
|
|
self._pe.conv_std_dev.setValue(gaussfilt_std_dev) |
1611
|
|
|
# unblock signals |
1612
|
|
|
self._pe.slider_conv_std_dev.blockSignals(False) |
1613
|
|
|
self._pe.conv_std_dev.blockSignals(False) |
1614
|
|
|
return |
1615
|
|
|
|
1616
|
|
View Code Duplication |
def analysis_windows_changed(self): |
|
|
|
|
1617
|
|
|
""" |
1618
|
|
|
|
1619
|
|
|
@return: |
1620
|
|
|
""" |
1621
|
|
|
# block signals |
1622
|
|
|
self.sig_start_line.blockSignals(True) |
1623
|
|
|
self.sig_end_line.blockSignals(True) |
1624
|
|
|
self.ref_start_line.blockSignals(True) |
1625
|
|
|
self.ref_end_line.blockSignals(True) |
1626
|
|
|
# get data |
1627
|
|
|
sig_start = self._pe.extract_param_ana_window_start_SpinBox.value() |
1628
|
|
|
sig_length = self._pe.extract_param_ana_window_width_SpinBox.value() |
1629
|
|
|
ref_start = self._pe.extract_param_ref_window_start_SpinBox.value() |
1630
|
|
|
ref_length = self._pe.extract_param_ref_window_width_SpinBox.value() |
1631
|
|
|
# update plots |
1632
|
|
|
self.sig_start_line.setValue(sig_start) |
1633
|
|
|
self.sig_end_line.setValue(sig_start + sig_length) |
1634
|
|
|
self.ref_start_line.setValue(ref_start) |
1635
|
|
|
self.ref_end_line.setValue(ref_start + ref_length) |
1636
|
|
|
# unblock signals |
1637
|
|
|
self.sig_start_line.blockSignals(False) |
1638
|
|
|
self.sig_end_line.blockSignals(False) |
1639
|
|
|
self.ref_start_line.blockSignals(False) |
1640
|
|
|
self.ref_end_line.blockSignals(False) |
1641
|
|
|
|
1642
|
|
|
self._pulsed_master_logic.analysis_windows_changed(sig_start, sig_length, ref_start, |
1643
|
|
|
ref_length) |
1644
|
|
|
return |
1645
|
|
|
|
1646
|
|
View Code Duplication |
def analysis_windows_line_changed(self): |
|
|
|
|
1647
|
|
|
""" |
1648
|
|
|
|
1649
|
|
|
@return: |
1650
|
|
|
""" |
1651
|
|
|
# block signals |
1652
|
|
|
self._pe.extract_param_ana_window_start_SpinBox.blockSignals(True) |
1653
|
|
|
self._pe.extract_param_ana_window_width_SpinBox.blockSignals(True) |
1654
|
|
|
self._pe.extract_param_ref_window_start_SpinBox.blockSignals(True) |
1655
|
|
|
self._pe.extract_param_ref_window_width_SpinBox.blockSignals(True) |
1656
|
|
|
# get data |
1657
|
|
|
sig_start = self.sig_start_line.value() |
1658
|
|
|
sig_length = self.sig_end_line.value() - sig_start |
1659
|
|
|
ref_start = self.ref_start_line.value() |
1660
|
|
|
ref_length = self.ref_end_line.value() - ref_start |
1661
|
|
|
# set widgets |
1662
|
|
|
self._pe.extract_param_ana_window_start_SpinBox.setValue(sig_start) |
1663
|
|
|
self._pe.extract_param_ana_window_width_SpinBox.setValue(sig_length) |
1664
|
|
|
self._pe.extract_param_ref_window_start_SpinBox.setValue(ref_start) |
1665
|
|
|
self._pe.extract_param_ref_window_width_SpinBox.setValue(ref_length) |
1666
|
|
|
# unblock signals |
1667
|
|
|
self._pe.extract_param_ana_window_start_SpinBox.blockSignals(False) |
1668
|
|
|
self._pe.extract_param_ana_window_width_SpinBox.blockSignals(False) |
1669
|
|
|
self._pe.extract_param_ref_window_start_SpinBox.blockSignals(False) |
1670
|
|
|
self._pe.extract_param_ref_window_width_SpinBox.blockSignals(False) |
1671
|
|
|
return |
1672
|
|
|
|
1673
|
|
View Code Duplication |
def analysis_windows_updated(self, sig_start, sig_length, ref_start, ref_length): |
|
|
|
|
1674
|
|
|
""" |
1675
|
|
|
|
1676
|
|
|
@param sig_start: |
1677
|
|
|
@param sig_length: |
1678
|
|
|
@param ref_start: |
1679
|
|
|
@param ref_length: |
1680
|
|
|
@return: |
1681
|
|
|
""" |
1682
|
|
|
# block signals |
1683
|
|
|
self._pe.extract_param_ana_window_start_SpinBox.blockSignals(True) |
1684
|
|
|
self._pe.extract_param_ana_window_width_SpinBox.blockSignals(True) |
1685
|
|
|
self._pe.extract_param_ref_window_start_SpinBox.blockSignals(True) |
1686
|
|
|
self._pe.extract_param_ref_window_width_SpinBox.blockSignals(True) |
1687
|
|
|
# set widgets |
1688
|
|
|
self._pe.extract_param_ana_window_start_SpinBox.setValue(sig_start) |
1689
|
|
|
self._pe.extract_param_ana_window_width_SpinBox.setValue(sig_length) |
1690
|
|
|
self._pe.extract_param_ref_window_start_SpinBox.setValue(ref_start) |
1691
|
|
|
self._pe.extract_param_ref_window_width_SpinBox.setValue(ref_length) |
1692
|
|
|
# update plots |
1693
|
|
|
self.sig_start_line.setValue(sig_start) |
1694
|
|
|
self.sig_end_line.setValue(sig_start + sig_length) |
1695
|
|
|
self.ref_start_line.setValue(ref_start) |
1696
|
|
|
self.ref_end_line.setValue(ref_start + ref_length) |
1697
|
|
|
# unblock signals |
1698
|
|
|
self._pe.extract_param_ana_window_start_SpinBox.blockSignals(False) |
1699
|
|
|
self._pe.extract_param_ana_window_width_SpinBox.blockSignals(False) |
1700
|
|
|
self._pe.extract_param_ref_window_start_SpinBox.blockSignals(False) |
1701
|
|
|
self._pe.extract_param_ref_window_width_SpinBox.blockSignals(False) |
1702
|
|
|
return |
1703
|
|
|
|
1704
|
|
|
def laser_to_show_changed(self): |
1705
|
|
|
""" |
1706
|
|
|
|
1707
|
|
|
@return: |
1708
|
|
|
""" |
1709
|
|
|
current_laser = self._pe.laserpulses_ComboBox.currentText() |
1710
|
|
|
show_raw_data = self._pe.laserpulses_display_raw_CheckBox.isChecked() |
1711
|
|
|
if current_laser == 'sum': |
1712
|
|
|
show_laser_index = 0 |
1713
|
|
|
else: |
1714
|
|
|
show_laser_index = int(current_laser) |
1715
|
|
|
|
1716
|
|
|
self._pulsed_master_logic.laser_to_show_changed(show_laser_index, show_raw_data) |
1717
|
|
|
return |
1718
|
|
|
|
1719
|
|
View Code Duplication |
def laser_to_show_updated(self, laser_index, show_raw_data): |
|
|
|
|
1720
|
|
|
""" |
1721
|
|
|
|
1722
|
|
|
@param laser_index: |
1723
|
|
|
@param show_raw_data: |
1724
|
|
|
@return: |
1725
|
|
|
""" |
1726
|
|
|
# block signals |
1727
|
|
|
self._pe.laserpulses_ComboBox.blockSignals(True) |
1728
|
|
|
self._pe.laserpulses_display_raw_CheckBox.blockSignals(True) |
1729
|
|
|
# set widgets |
1730
|
|
|
self._pe.laserpulses_ComboBox.setCurrentIndex(laser_index) |
1731
|
|
|
self._pe.laserpulses_display_raw_CheckBox.setChecked(show_raw_data) |
1732
|
|
|
# unblock signals |
1733
|
|
|
self._pe.laserpulses_ComboBox.blockSignals(False) |
1734
|
|
|
self._pe.laserpulses_display_raw_CheckBox.blockSignals(False) |
1735
|
|
|
return |
1736
|
|
|
|
1737
|
|
|
def laser_data_updated(self, x_data, y_data): |
1738
|
|
|
""" |
1739
|
|
|
|
1740
|
|
|
@param x_data: |
1741
|
|
|
@param y_data: |
1742
|
|
|
@return: |
1743
|
|
|
""" |
1744
|
|
|
self.lasertrace_image.setData(x=x_data, y=y_data) |
1745
|
|
|
return |
1746
|
|
|
|
1747
|
|
|
|
1748
|
|
|
|
1749
|
|
|
########################################################################### |
1750
|
|
|
### Methods related to the Tab 'Sequence Generator': ### |
1751
|
|
|
########################################################################### |
1752
|
|
|
def pulser_on_off_clicked(self, checked): |
1753
|
|
|
""" Manually switch the pulser output on/off. """ |
1754
|
|
|
checked = self._mw.pulser_on_off_PushButton.isChecked() |
1755
|
|
|
if checked: |
1756
|
|
|
self._mw.pulser_on_off_PushButton.setText('Pulser OFF') |
1757
|
|
|
self._pulsed_master_logic.toggle_pulse_generator(True) |
1758
|
|
|
else: |
1759
|
|
|
self._mw.pulser_on_off_PushButton.setText('Pulser ON') |
1760
|
|
|
self._pulsed_master_logic.toggle_pulse_generator(False) |
1761
|
|
|
return |
1762
|
|
|
|
1763
|
|
View Code Duplication |
def pulser_running_updated(self, is_running): |
|
|
|
|
1764
|
|
|
""" |
1765
|
|
|
|
1766
|
|
|
@param is_running: |
1767
|
|
|
@return: |
1768
|
|
|
""" |
1769
|
|
|
# block signals |
1770
|
|
|
self._mw.pulser_on_off_PushButton.blockSignals(True) |
1771
|
|
|
# set widgets |
1772
|
|
|
if is_running: |
1773
|
|
|
self._mw.pulser_on_off_PushButton.setText('Pulser OFF') |
1774
|
|
|
if not self._mw.pulser_on_off_PushButton.isChecked(): |
1775
|
|
|
self._mw.pulser_on_off_PushButton.toggle() |
1776
|
|
|
else: |
1777
|
|
|
self._mw.pulser_on_off_PushButton.setText('Pulser ON') |
1778
|
|
|
if self._mw.pulser_on_off_PushButton.isChecked(): |
1779
|
|
|
self._mw.pulser_on_off_PushButton.toggle() |
1780
|
|
|
# unblock signals |
1781
|
|
|
self._mw.pulser_on_off_PushButton.blockSignals(False) |
1782
|
|
|
return |
1783
|
|
|
|
1784
|
|
|
def clear_pulser_clicked(self): |
1785
|
|
|
""" Delete all loaded files in the device's current memory. """ |
1786
|
|
|
self._pulsed_master_logic.clear_pulse_generator() |
1787
|
|
|
return |
1788
|
|
|
|
1789
|
|
|
def upload_ensemble_clicked(self): |
1790
|
|
|
""" |
1791
|
|
|
|
1792
|
|
|
@return: |
1793
|
|
|
""" |
1794
|
|
|
# Get the ensemble name from the ComboBox |
1795
|
|
|
ensemble_name = self._pg.gen_ensemble_ComboBox.currentText() |
1796
|
|
|
# Upload the ensemble via logic module |
1797
|
|
|
self._pulsed_master_logic.upload_asset(ensemble_name) |
1798
|
|
|
# disable button |
1799
|
|
|
self._pg.upload_ensemble_PushButton.setEnabled(False) |
1800
|
|
|
self._pg.load_ensemble_PushButton.setEnabled(False) |
1801
|
|
|
return |
1802
|
|
|
|
1803
|
|
|
# def upload_sequence_clicked(self): |
1804
|
|
|
# """ |
1805
|
|
|
# |
1806
|
|
|
# @return: |
1807
|
|
|
# """ |
1808
|
|
|
# # Get the sequence name from the ComboBox |
1809
|
|
|
# seq_name = self._pg.gen_sequence_ComboBox.currentText() |
1810
|
|
|
# # Upload the asset via logic module |
1811
|
|
|
# self._pulsed_master_logic.upload_asset(seq_name) |
1812
|
|
|
# # disable button |
1813
|
|
|
# self._pg.upload_sequence_PushButton.setEnabled(False) |
1814
|
|
|
# self._pg.load_sequence_PushButton.setEnabled(False) |
1815
|
|
|
# return |
1816
|
|
|
|
1817
|
|
|
def update_uploaded_assets(self, asset_names_list): |
1818
|
|
|
""" |
1819
|
|
|
|
1820
|
|
|
@param asset_names_list: |
1821
|
|
|
@return: |
1822
|
|
|
""" |
1823
|
|
|
# enable buttons |
1824
|
|
|
# self._pg.upload_sequence_PushButton.setEnabled(True) |
1825
|
|
|
self._pg.upload_ensemble_PushButton.setEnabled(True) |
1826
|
|
|
self._pg.load_ensemble_PushButton.setEnabled(True) |
1827
|
|
|
# self._pg.load_sequence_PushButton.setEnabled(True) |
1828
|
|
|
return |
1829
|
|
|
|
1830
|
|
|
def load_ensemble_clicked(self): |
1831
|
|
|
""" |
1832
|
|
|
|
1833
|
|
|
@return: |
1834
|
|
|
""" |
1835
|
|
|
# Get the asset name to be uploaded from the ComboBox |
1836
|
|
|
asset_name = self._pg.gen_ensemble_ComboBox.currentText() |
1837
|
|
|
# Load asset into channles via logic module |
1838
|
|
|
self._pulsed_master_logic.load_asset_into_channels(asset_name, {}, False) |
1839
|
|
|
# disable button |
1840
|
|
|
self._pg.load_ensemble_PushButton.setEnabled(False) |
1841
|
|
|
return |
1842
|
|
|
|
1843
|
|
|
# def load_sequence_clicked(self): |
1844
|
|
|
# """ |
1845
|
|
|
# |
1846
|
|
|
# @return: |
1847
|
|
|
# """ |
1848
|
|
|
# # Get the asset name to be uploaded from the ComboBox |
1849
|
|
|
# asset_name = self._pg.gen_sequence_ComboBox.currentText() |
1850
|
|
|
# # Load asset into channles via logic module |
1851
|
|
|
# self._pulsed_master_logic.load_asset_into_channels(asset_name, {}, False) |
1852
|
|
|
# # disable button |
1853
|
|
|
# self._pg.load_sequence_PushButton.setEnabled(False) |
1854
|
|
|
# return |
1855
|
|
|
|
1856
|
|
View Code Duplication |
def update_loaded_asset(self, asset_name, asset_type): |
|
|
|
|
1857
|
|
|
""" Check the current loaded asset from the logic and update the display. """ |
1858
|
|
|
label = self._mw.current_loaded_asset_Label |
1859
|
|
|
if asset_name is None: |
1860
|
|
|
label.setText(asset_type) |
1861
|
|
|
elif asset_type == 'PulseBlockEnsemble' or asset_type == 'PulseSequence': |
1862
|
|
|
label.setText(' {0} ({1})'.format(asset_name, asset_type)) |
1863
|
|
|
else: |
1864
|
|
|
label.setText(' Unknown asset type') |
1865
|
|
|
# enable buttons |
1866
|
|
|
if asset_type == 'PulseBlockEnsemble': |
1867
|
|
|
self._pg.load_ensemble_PushButton.setEnabled(True) |
1868
|
|
|
elif asset_type == 'PulseSequence': |
1869
|
|
|
self._pg.load_sequence_PushButton.setEnabled(True) |
1870
|
|
|
return |
1871
|
|
|
|
1872
|
|
|
|
1873
|
|
|
# def save_plots(self): |
1874
|
|
|
# """ Save plot from analysis graph as a picture. """ |
1875
|
|
|
# timestamp = datetime.datetime.now() |
1876
|
|
|
# filetag = self._mw.save_tag_LineEdit.text() |
1877
|
|
|
# filepath = self._save_logic.get_path_for_module(module_name='PulsedMeasurement') |
1878
|
|
|
# if len(filetag) > 0: |
1879
|
|
|
# filename = os.path.join(filepath, '{}_{}_pulsed'.format(timestamp.strftime('%Y%m%d-%H%M-%S'), filetag)) |
1880
|
|
|
# else: |
1881
|
|
|
# filename = os.path.join(filepath, '{}_pulsed'.format(timestamp.strftime('%Y%m%d-%H%M-%S'))) |
1882
|
|
|
# |
1883
|
|
|
# # print(type(self._mw.second_plot_ComboBox.currentText()), self._mw.second_plot_ComboBox.currentText()) |
1884
|
|
|
# # pulse plot |
1885
|
|
|
# # exporter = pg.exporters.SVGExporter(self._pa.pulse_analysis_PlotWidget.plotItem.scene()) |
1886
|
|
|
# # exporter.export(filename+'.svg') |
1887
|
|
|
# # |
1888
|
|
|
# # # auxiliary plot |
1889
|
|
|
# # if 'None' not in self._mw.second_plot_ComboBox.currentText(): |
1890
|
|
|
# # exporter_aux = pg.exporters.SVGExporter(self._mw.pulse_analysis_second_PlotWidget.plotItem.scene()) |
1891
|
|
|
# # exporter_aux.export(filename + '_aux' + '.svg') |
1892
|
|
|
# |
1893
|
|
|
# self._pulsed_meas_logic._save_data(filetag, timestamp) |
1894
|
|
|
|
1895
|
|
|
|
1896
|
|
|
|
1897
|
|
|
|