|
@@ -953,7 +953,7 @@ def bk_get_temperature(board_id):
|
|
|
backup_get_temp = bk_get_temperature
|
|
|
|
|
|
|
|
|
-def bk_time_scan(board_id, c_frm, c_to, f_frm, f_to, ts_pbar, plot_func, orbits_observe=None, orbits_skip=None):
|
|
|
+def bk_time_scan(board_id, c_frm, c_to, f_frm, f_to, ts_pbar, plot_func, orbits_observe=None, orbits_skip=None, bucket_to_use=None):
|
|
|
"""
|
|
|
Toggle Timescan.
|
|
|
:param board_id: id of the board do manipulate
|
|
@@ -970,7 +970,7 @@ def bk_time_scan(board_id, c_frm, c_to, f_frm, f_to, ts_pbar, plot_func, orbits_
|
|
|
if board.get_board_status(board_id).time_scan:
|
|
|
_bif_stop_time_scan(board_id, ts_pbar)
|
|
|
else:
|
|
|
- _bif_start_time_scan(board_id, c_frm, c_to, f_frm, f_to, ts_pbar, plot_func, orbits_observe, orbits_skip)
|
|
|
+ _bif_start_time_scan(board_id, c_frm, c_to, f_frm, f_to, ts_pbar, plot_func, orbits_observe, orbits_skip, bucket_to_use)
|
|
|
|
|
|
|
|
|
def _bif_stop_time_scan(board_id, ts_pbar):
|
|
@@ -999,7 +999,7 @@ def _bif_stop_time_scan(board_id, ts_pbar):
|
|
|
# thread_ts = None
|
|
|
|
|
|
|
|
|
-def _bif_start_time_scan(board_id, c_frm, c_to, f_frm, f_to, timescan_progressbar, plot_func, orbits_observe, orbits_skip):
|
|
|
+def _bif_start_time_scan(board_id, c_frm, c_to, f_frm, f_to, timescan_progressbar, plot_func, orbits_observe, orbits_skip, bucket_to_use=None):
|
|
|
"""
|
|
|
Start the timscan. This starts the timer
|
|
|
:param board_id: id of the board do manipulate
|
|
@@ -1007,10 +1007,11 @@ def _bif_start_time_scan(board_id, c_frm, c_to, f_frm, f_to, timescan_progressba
|
|
|
:param c_to: To value for coarse scan
|
|
|
:param f_frm: From value for fine scan
|
|
|
:param f_to: To value for fine scan
|
|
|
- :param timescan_progressbar: Handle for the timescanprogressbar
|
|
|
+ :param timescan_progressbar: Handle for the timescan progressbar
|
|
|
:param plot_func: Function to use to plot the data
|
|
|
:param orbits_observe: Number of orbits to observe for the timescan (original values will be restored after timescan)
|
|
|
- :param orbits_skip: Number of orbits to skipfor the timescan (original values will be restored after timescan)
|
|
|
+ :param orbits_skip: Number of orbits to skip for the timescan (original values will be restored after timescan)
|
|
|
+ :param bucket_to_use: Number of the bucket whos data will be used to calculate the average signal at each timescan step (if None all bunches will be used)
|
|
|
:return: -
|
|
|
"""
|
|
|
thread = storage.get_board_specific_storage(board_id).setdefault("TimeScanThread", storage.ThreadStorage())
|
|
@@ -1055,13 +1056,14 @@ def _bif_start_time_scan(board_id, c_frm, c_to, f_frm, f_to, timescan_progressba
|
|
|
stopSignal = QtCore.pyqtSignal()
|
|
|
finished = QtCore.pyqtSignal()
|
|
|
|
|
|
- def __init__(self, c_frm, c_to, f_frm, f_to, timescan_progressbar):
|
|
|
+ def __init__(self, c_frm, c_to, f_frm, f_to, timescan_progressbar, bucket_to_use):
|
|
|
super(thread_time_scan, self).__init__()
|
|
|
self.c_frm = c_frm
|
|
|
self.c_to = c_to
|
|
|
self.f_frm = f_frm
|
|
|
self.f_to = f_to
|
|
|
self.timescan_progressbar = timescan_progressbar
|
|
|
+ self.bucket_to_use = bucket_to_use
|
|
|
|
|
|
def time_scan(self):
|
|
|
'''Method to run in the thread that does the timescan'''
|
|
@@ -1128,7 +1130,10 @@ def _bif_start_time_scan(board_id, c_frm, c_to, f_frm, f_to, timescan_progressba
|
|
|
return
|
|
|
|
|
|
for adc in range(4):
|
|
|
- buckets = data.array[:, adc:adc + 1].reshape(-1)
|
|
|
+ if self.bucket_to_use is None:
|
|
|
+ buckets = data.array[:, adc]
|
|
|
+ else:
|
|
|
+ buckets = data.array[self.bucket_to_use::config.bunches_per_turn, adc]
|
|
|
heatmap[adc, f_step, c_step] = float(buckets.sum()) / buckets.shape[0]
|
|
|
if heatmap[adc, f_step, c_step] > maximum[adc, 0]:
|
|
|
maximum[adc, 0] = heatmap[adc, f_step, c_step]
|
|
@@ -1209,7 +1214,7 @@ def _bif_start_time_scan(board_id, c_frm, c_to, f_frm, f_to, timescan_progressba
|
|
|
|
|
|
return
|
|
|
|
|
|
- tst = thread_time_scan(c_frm, c_to, f_frm, f_to, timescan_progressbar)
|
|
|
+ tst = thread_time_scan(c_frm, c_to, f_frm, f_to, timescan_progressbar, bucket_to_use)
|
|
|
thread.register(tst)
|
|
|
thread.connect('pbarSignal', timescan_progressbar.setValue)
|
|
|
thread.connect('finished', lambda: finished(timescan_progressbar))
|