Skip to content

Commit 0a2593c

Browse files
rassoulyphymeso
authored andcommitted
Fixes and formatting
1 parent ba095f8 commit 0a2593c

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

exopy_hqc_legacy/instruments/drivers/visa/tektro_awg.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -506,10 +506,10 @@ def send_load_awg_file(self, awg_data, filename='setup'):
506506
507507
"""
508508
name_str = 'MMEMory:DATA "{}",'.format(filename+'.awg')
509-
size_str = ('#' + str(len(str(len(awg_file)))) + str(len(awg_file)))
509+
size_str = ('#' + str(len(str(len(awg_data)))) + str(len(awg_data)))
510510
mes = name_str + size_str
511511
self.write('MMEMory:CDIRectory "/Users/OEM/Documents"')
512-
self._driver.write_raw(mes.encode('ASCII') + awg_file)
512+
self._driver.write_raw(mes.encode('ASCII') + awg_data)
513513
self.write('AWGCONTROL:SRESTORE "{}"'.format(filename+'.awg'))
514514

515515
@secure_communication()
@@ -548,14 +548,14 @@ def ask_sequencer_pos(self):
548548
"""Ask the current position index of the sequencer
549549
550550
"""
551-
return self.ask('AWGC:SEQ:POS?')
551+
return self.query('AWGC:SEQ:POS?')
552552

553553
@secure_communication()
554554
def force_jump_to(self, pos):
555555
"""Make the sequencer jump to position pos
556556
557557
"""
558-
self.ask('SEQUENCE:JUMP:IMMEDIATE {}'.format(pos))
558+
self.query('SEQUENCE:JUMP:IMMEDIATE {}'.format(pos))
559559

560560
@secure_communication()
561561
def set_repeat(self, position, repeat):
@@ -730,10 +730,8 @@ def set_running(self, value, delay=0.0):
730730
self.clear_output_buffer()
731731
if value in ('RUN', 1, 'True', True):
732732
self.write('AWGC:RUN:IMM')
733-
self.write('AWGC:RST?')
734-
time.sleep(delay)
735-
values = self.read_values(format=2)
736-
if values[0] not in (1, 2):
733+
run_mode = int(self.query('AWGC:RST?', delay=delay))
734+
if run_mode not in (1, 2):
737735
raise InstrIOError(cleandoc('''Instrument did not set
738736
correctly the run state'''))
739737
elif value in ('STOP', 0, 'False', False):
@@ -753,12 +751,12 @@ def running(self):
753751
754752
"""
755753
self.clear_output_buffer()
756-
run = self.ask_for_values("AWGC:RST?")[0]
757-
if run == 0:
754+
running = int(self.query("AWGC:RST?"))
755+
if running == 0:
758756
return False
759-
if run == 1 or run == 2:
757+
if running == 1 or running == 2:
760758
return True
761-
raise InstrIOError
759+
raise InstrIOError(cleandoc('''Couldn't read the run mode'''))
762760

763761
@instrument_property
764762
@secure_communication()
@@ -811,14 +809,14 @@ def delete_all_waveforms(self):
811809
try:
812810
# Number of user defined waveforms
813811
# 25 is the number of default waveforms
814-
nb_waveforms = int(self.ask("WLIST:SIZE?")) - 25
812+
nb_waveforms = int(self.query("WLIST:SIZE?")) - 25
815813
except Exception:
816814
nb_waveforms = 0
817-
wait_time = 1+int(nb_waveforms/120)
815+
wait_time = 1 + int(nb_waveforms / 120)
818816
self.write('WLIST:WAVEFORM:DELETE ALL')
819817

820-
logging.info('Waiting {}s for {} waveforms to be deleted'.format(wait_time,
821-
nb_waveforms))
818+
msg = 'Waiting {}s for {} waveforms to be deleted'
819+
logging.info(msg.format(wait_time, nb_waveforms))
822820
time.sleep(wait_time)
823821

824822
def clear_all_sequences(self):

exopy_hqc_legacy/instruments/drivers/visa_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ def read_binary_values(self, datatype='f', is_big_endian=False):
174174
"""
175175
return self._driver.read_binary_values(datatype, is_big_endian)
176176

177-
def query(self, message):
177+
def query(self, message, *args, **kwargs):
178178
"""Send the specified message to the instrument and read its answer.
179179
180180
Simply call the `query` method of the `Instrument` object stored in
181181
the attribute `_driver`
182182
"""
183-
return self._driver.query(message)
183+
return self._driver.query(message, *args, **kwargs)
184184

185185
def query_ascii_values(self, message, converter='f', separator=','):
186186
"""Send the specified message to the instrument and convert its answer

exopy_hqc_legacy/tasks/tasks/instr/run_awg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import logging
1313
import time
1414

15-
from atom.api import (Str, set_default)
15+
from atom.api import (Float, Str, set_default)
1616

1717
from exopy.tasks.api import InstrumentTask
1818

0 commit comments

Comments
 (0)