Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions exopy_qcircuits/instruments/drivers/visa/keysight_ena.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def prepare_sweep(self, sweep_type, start, stop, sweep_points):
self._pna.write('SENSe{}:FREQuency:STOP {}'.format(self._channel,
stop))
elif sweep_type == 'POWER':
self.sweep_type = 'POW'
self.sweep_type = 'LIN'
self.sweep_points = sweep_points
self._pna.write('SOURce{}:POWer:STARt {}'.format(self._channel,
start))
Expand Down Expand Up @@ -548,7 +548,7 @@ def sweep_mode(self, value):
"""
"""
self._pna.write('SENSe{}:SWEep:MODE {}'.format(self._channel, value))
result = self._pna.query('SENSe{}:SWEep:MODE?'.format(self._channel))
result = self._pna.query('SENSe{}:SWEep:MODE?'.format(self._channel)).rstrip('\n')

if result.lower() != value.lower()[:len(result)]:
raise InstrIOError(cleandoc('''PNA did not set correctly the
Expand All @@ -572,7 +572,7 @@ def sweep_type(self, value):
"""
"""
self._pna.write('SENSe{}:SWEep:TYPE {}'.format(self._channel, value))
result = self._pna.query('SENSe{}:SWEep:TYPE?'.format(self._channel))
result = self._pna.query('SENSe{}:SWEep:TYPE?'.format(self._channel)).rstrip('\n')

if result.lower() != value.lower()[:len(result)]:
raise InstrIOError(cleandoc('''PNA did not set correctly the
Expand Down Expand Up @@ -703,7 +703,7 @@ def average_mode(self, value):
"""
"""
self._pna.write('SENSe{}:AVERage:MODE {}'.format(self._channel, value))
result = self._pna.query('SENSe{}:AVERage:MODE?'.format(self._channel))
result = self._pna.query('SENSe{}:AVERage:MODE?'.format(self._channel)).rstrip('\n')

if result.lower() != value.lower()[:len(result)]:
raise InstrIOError(cleandoc('''PNA did not set correctly the
Expand Down Expand Up @@ -790,16 +790,17 @@ def check_operation_completion(self):
def set_all_chanel_to_hold(self):
"""
"""
for channel in self.defined_channels:
self.write('SENSe{}:SWEep:MODE HOLD'.format(channel))

for channel in self.defined_channels:
result = self.query('SENSe{}:SWEep:MODE?'.format(channel))

if result != 'HOLD':
raise InstrIOError(cleandoc('''PNA did not set correctly the
channel {} sweep mode while setting all defined channels
to HOLD'''.format(channel)))
self.write('ABORt')
#for channel in self.defined_channels:
# self.write('SENSe{}:SWEep:MODE HOLD'.format(channel))
#
#for channel in self.defined_channels:
# result = self.query('SENSe{}:SWEep:MODE?'.format(channel))
#
# if result != 'HOLD':
# raise InstrIOError(cleandoc('''PNA did not set correctly the
# channel {} sweep mode while setting all defined channels
# to HOLD'''.format(channel)))

@secure_communication()
def clear_averaging(self):
Expand Down Expand Up @@ -853,7 +854,7 @@ def trigger_scope(self, value):
"""
"""
self.write('TRIGger:SEQuence:SCOPe {}'.format(value))
result = self.query('TRIGger:SEQuence:SCOPe?')
result = self.query('TRIGger:SEQuence:SCOPe?').rstrip('\n')

if result.lower() != value.lower()[:len(result)]:
raise InstrIOError(cleandoc('''PNA did not set correctly the
Expand All @@ -877,7 +878,7 @@ def trigger_source(self, value):
"""
"""
self.write('TRIGger:SEQuence:SOURce {}'.format(value))
result = self.query('TRIGger:SEQuence:SOURce?')
result = self.query('TRIGger:SEQuence:SOURce?').rstrip('\n')

if result.lower() != value.lower()[:len(result)]:
raise InstrIOError(cleandoc('''PNA did not set correctly the
Expand Down
32 changes: 17 additions & 15 deletions exopy_qcircuits/tasks/tasks/instr/ena_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def perform(self, power=None):
task = self.task
if not task.driver:
task.start_driver()
if not self.channel_driver:
self.channel_driver = task.driver.get_channel(self.channel)

task.driver.owner = task.name
Expand Down Expand Up @@ -189,13 +190,14 @@ def perform(self):
"""
if not self.driver:
self.start_driver()
self.channel_driver = self.driver.get_channel(self.channel)

if not self.channel_driver:
self.channel_driver = self.driver.get_channel(self.channel)

if self.driver.owner != self.name:
self.driver.owner = self.name
self.driver.set_all_chanel_to_hold()
self.driver.trigger_scope = 'CURRent'
self.driver.trigger_scope = 'ACTive'
self.driver.trigger_source = 'MANual'

meas_names = ['Ch{}:'.format(self.channel) + ':'.join(measure)
Expand All @@ -206,19 +208,19 @@ def perform(self):
if self.if_bandwidth>0:
self.channel_driver.if_bandwidth = self.if_bandwidth

# Check whether or not we are doing the same measures as the ones
# already defined (avoid losing display optimisation)
measures = self.channel_driver.list_existing_measures()
existing_meas = [meas['name'] for meas in measures]

if not (all([meas in existing_meas for meas in meas_names])
and all([meas in meas_names for meas in existing_meas])):
clear = True
self.channel_driver.delete_all_meas()
for i, meas_name in enumerate(meas_names):
self.channel_driver.prepare_measure(meas_name, self.window,
i+1, clear)
clear = False
## Check whether or not we are doing the same measures as the ones
## already defined (avoid losing display optimisation)
#measures = self.channel_driver.list_existing_measures()
#existing_meas = [meas['name'] for meas in measures]
#
#if not (all([meas in existing_meas for meas in meas_names])
# and all([meas in meas_names for meas in existing_meas])):
# clear = True
# self.channel_driver.delete_all_meas()
# for i, meas_name in enumerate(meas_names):
# self.channel_driver.prepare_measure(meas_name, self.window,
# i+1, clear)
# clear = False
current_Xaxis = self.channel_driver.sweep_x_axis
if self.start:
start = self.format_and_eval_string(self.start)
Expand Down