Skip to content

Commit

Permalink
make syncing happen at the right time (#874)
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshnielsen authored and WilliamHPNielsen committed Nov 17, 2017
1 parent 9f800d8 commit 66bf8bf
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions qcodes/instrument_drivers/ZI/ZIUHFLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ def add_post_trigger_action(self, action: Callable) -> None:
has been armed. The action must be a callable taking zero
arguments
"""
self._scopeactions.append(action)
if action not in self._scopeactions:
self._scopeactions.append(action)

@property
def post_trigger_actions(self) -> List[Callable]:
Expand All @@ -271,7 +272,7 @@ def prepare_scope(self):
Prepare the scope for a measurement. Must immediately preceed a
measurement.
"""
#

log.info('Preparing the scope')

# A convenient reference
Expand Down Expand Up @@ -471,15 +472,18 @@ def get(self):
# scope.finish is always called even if the
# measurement is interrupted
self._instrument.daq.setInt('/{}/scopes/0/single'.format(self._instrument.device), 1)
self._instrument.daq.sync()

scope = self._instrument.scope # There are issues reusing the scope.

scope = self._instrument.scope
scope.set('scopeModule/clearhistory', 1)

# Start the scope triggering/acquiring
params['scope_runstop'].set('run') # set /dev/scopes/0/enable to 1
# set /dev/scopes/0/enable to 1
params['scope_runstop'].set('run')

self._instrument.daq.sync()

log.info('[*] Starting ZI scope acquisition.')
log.debug('Starting ZI scope acquisition.')
# Start something... hauling data from the scopeModule?
scope.execute()

Expand All @@ -490,7 +494,10 @@ def get(self):
starttime = time.time()
timedout = False

while scope.progress() < 1:
progress = scope.progress()
while progress < 1:
log.debug('Scope progress is {}'.format(progress))
progress = scope.progress()
time.sleep(0.1) # This while+sleep is how ZI engineers do it
if (time.time()-starttime) > 20*meas_time+1:
timedout = True
Expand Down

0 comments on commit 66bf8bf

Please sign in to comment.