Skip to content

Commit

Permalink
Fixed timing issue (hopefully). Still need to update this and terasco…
Browse files Browse the repository at this point in the history
…n_logic (and cfg) to note that you can use finer resolutions now for the integration time.
  • Loading branch information
lange50 committed Apr 24, 2025
1 parent 671e354 commit 6bbe32b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/qudi/hardware/timetagger/swabian_tagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"""

import numpy as np
import time
import TimeTagger as tt
from typing import Dict

Expand Down Expand Up @@ -75,8 +76,9 @@ def on_activate(self):
self.statusvar = 0

self.__timer = QtCore.QTimer()
self.__timer.setSingleShot(True)
self.__timer.setSingleShot(False)
self.__timer.timeout.connect(self.__update_data)
self.__timer.start(0) # call as often as possible

def get_constraints(self):
""" Retrieve the hardware constrains from the Fast counting device.
Expand Down Expand Up @@ -180,9 +182,8 @@ def start_measure(self):
""" Start the fast counter. """
self.module_state.lock()
self.counter.clear()
self.counter.start()
self.counter.startFor(self._bin_width * 1000) # in ps, should be stored as such #TODO

self.__timer.start(int(self._record_length_s*1000))
self.sigScanStarted.emit()

self.statusvar = 2
Expand Down Expand Up @@ -213,7 +214,7 @@ def continue_measure(self):
If fast counter is in pause state, then fast counter will be continued.
"""
if self.module_state() == 'locked':
self.counter.start()
self.counter.startFor(self._bin_width * 1000) # in ps, should be stored as such #TODO
self.statusvar = 2
return 0

Expand Down Expand Up @@ -260,5 +261,10 @@ def get_binwidth(self):

def __update_data(self):
with self._thread_lock:
self.__timer.start(int(self._record_length_s*1000))
self.sigScanFinished.emit(np.squeeze(self.get_data_trace()))
if self.module_state() == 'locked':
self.counter.waitUntilFinished(self._bin_width * 1e-6 * 100) # in ms, should never reach this limit, but just in case
self.sigScanFinished.emit(
np.array([time.time(), np.squeeze(self.get_data_trace())])
)

self.counter.startFor(self._bin_width * 1000) # in ps, should be stored as such #TODO

0 comments on commit 6bbe32b

Please sign in to comment.