Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rohde Schwarz ZNB /VNA refactor common code #887

Merged
merged 31 commits into from
Feb 7, 2018
Merged
Changes from 6 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
283540c
added try/finally for data aquisition
Dominik-Vogel Nov 28, 2017
b956c18
extracted into method of channel
Dominik-Vogel Nov 28, 2017
043ad25
implementing FrequencySweepMagPhase through refactored method in channel
Dominik-Vogel Nov 28, 2017
c499932
fixed typo: argument list
Dominik-Vogel Nov 28, 2017
2fb0c96
added CHANNEL_CLASS class variable for inheritance
Dominik-Vogel Dec 6, 2017
92e0153
activate the sweep for selected channel and restore previous state
Dominik-Vogel Dec 6, 2017
2f8b998
renamig get->get_raw
Dominik-Vogel Dec 6, 2017
3dd4d22
refactored update of traces out
Dominik-Vogel Dec 15, 2017
b940ae0
T2 vna fixes
nataliejpg Dec 15, 2017
254223c
fix of iteration over parameters
Dominik-Vogel Jan 22, 2018
a874c04
thorvalds fix for averaging data
Dominik-Vogel Jan 22, 2018
ec82000
fix validator for minimum source power to -60dBm
Dominik-Vogel Jan 22, 2018
09bb252
default to 7 decimals
Dominik-Vogel Jan 22, 2018
3fc12c3
dual window mode
Dominik-Vogel Jan 22, 2018
3e26d60
Thorvald: removed blank line from setpoints
Dominik-Vogel Jan 22, 2018
11201e9
remove blank line from setpoint names
Dominik-Vogel Jan 23, 2018
9e556f6
Thorvald: fixing the channel initialisation
Dominik-Vogel Jan 23, 2018
9e4e38d
remove initialise and default values
Dominik-Vogel Jan 23, 2018
eff2dd8
setting validator for minimum source power to model specific value
Dominik-Vogel Jan 23, 2018
7363f24
get parser for source power to float
Dominik-Vogel Jan 23, 2018
6aab338
added channels as submodules
Dominik-Vogel Jan 23, 2018
d30802e
_instrument->_parent
Dominik-Vogel Jan 23, 2018
fac84d0
using setattr for shortcut instead of add_submodule
Dominik-Vogel Jan 23, 2018
474d84a
Merge branch 'master' into driver/ZnbRefactorSweep
jenshnielsen Jan 30, 2018
90effe5
added validator for Bandwidth
Dominik-Vogel Jan 30, 2018
33e7b8a
Merge branch 'driver/ZnbRefactorSweep' of github.com:Dominik-Vogel/Qc…
Dominik-Vogel Jan 30, 2018
2fce66d
added optional van parameter
Dominik-Vogel Feb 5, 2018
5c881c0
added short name to differentiate between vna_parameter and name of c…
Dominik-Vogel Feb 6, 2018
5ed254a
updated warning
Dominik-Vogel Feb 6, 2018
c98baca
updated comment for InstrumentChannel init
Dominik-Vogel Feb 7, 2018
e9a5d95
Merge branch 'master' into driver/ZnbRefactorSweep
jenshnielsen Feb 7, 2018
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
38 changes: 21 additions & 17 deletions qcodes/instrument_drivers/rohde_schwarz/ZNB.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(self, name, instrument, start, stop, npts, channel):
label='{} magnitude'.format(
instrument._vna_parameter),
setpoint_units=('Hz',),
setpoint_names=('{}_frequency'.format(instrument._vna_parameter),))
Copy link
Contributor

@ThorvaldLarsen ThorvaldLarsen Jan 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a mistake by me. Should be '{}_frequency' with the '_'.

setpoint_names=('{} frequency'.format(instrument._vna_parameter),))
self.set_sweep(start, stop, npts)
self._channel = channel

Expand Down Expand Up @@ -114,7 +114,7 @@ def __init__(self, parent, name, channel):
get_cmd='SOUR{}:POW?'.format(n),
set_cmd='SOUR{}:POW {{:.4f}}'.format(n),
get_parser=lambda x: int(round(float(x))),
vals=vals.Numbers(-150, 25))
vals=vals.Numbers(-60, 25))
self.add_parameter(name='bandwidth',
label='Bandwidth',
unit='Hz',
Expand Down Expand Up @@ -227,7 +227,7 @@ def _strip(self, var):

def _set_start(self, val):
channel = self._instrument_channel
self.write('SENS{}:FREQ:START {:.4f}'.format(channel, val))
self.write('SENS{}:FREQ:START {:.7f}'.format(channel, val))
stop = self.stop()
if val >= stop:
raise ValueError(
Expand All @@ -245,7 +245,7 @@ def _set_stop(self, val):
if val <= start:
raise ValueError(
"Stop frequency must be larger than start frequency.")
self.write('SENS{}:FREQ:STOP {:.4f}'.format(channel, val))
self.write('SENS{}:FREQ:STOP {:.7f}'.format(channel, val))
# we get stop as the vna may not be able to set it to the exact value provided
stop = self.stop()
if val != stop:
Expand All @@ -255,28 +255,28 @@ def _set_stop(self, val):

def _set_npts(self, val):
channel = self._instrument_channel
self.write('SENS{}:SWE:POIN {:.4f}'.format(channel, val))
self.write('SENS{}:SWE:POIN {:.7f}'.format(channel, val))
self._update_traces()

def _set_span(self, val):
channel = self._instrument_channel
self.write('SENS{}:FREQ:SPAN {:.4f}'.format(channel, val))
self.write('SENS{}:FREQ:SPAN {:.7f}'.format(channel, val))
self._update_traces()

def _set_center(self, val):
channel = self._instrument_channel
self.write('SENS{}:FREQ:CENT {:.4f}'.format(channel, val))
self.write('SENS{}:FREQ:CENT {:.7f}'.format(channel, val))
self._update_traces()

def _update_traces(self):
""" updates start, stop and npts of all trace parameters"""
start = self.start()
stop = self.stop()
npts = self.npts()
for p in self.parameters:
if isinstance(p, ArrayParameter):
for _, parameter in self.parameters.items():
if isinstance(parameter, (ArrayParameter, MultiParameter)):
try:
p.set_sweep(start, stop, npts)
parameter.set_sweep(start, stop, npts)
except AttributeError:
pass

Expand Down Expand Up @@ -310,13 +310,13 @@ def _get_sweep_data(self, force_polar=False):
# need to ensure averaged result is returned
for avgcount in range(self.avg()):
self.write('INIT{}:IMM; *WAI'.format(self._instrument_channel))
data_str = self.ask(
'CALC{}:DATA? {}'.format(self._instrument_channel,
data_format_command))
data = np.array(data_str.rstrip().split(',')).astype('float64')
if self.format() in ['Polar', 'Complex',
'Smith', 'Inverse Smith']:
data = data[0::2] + 1j * data[1::2]
data_str = self.ask(
'CALC{}:DATA? {}'.format(self._instrument_channel,
data_format_command))
data = np.array(data_str.rstrip().split(',')).astype('float64')
if self.format() in ['Polar', 'Complex',
'Smith', 'Inverse Smith']:
data = data[0::2] + 1j * data[1::2]
finally:
self._parent.cont_meas_on()
self.status(initial_state)
Expand Down Expand Up @@ -384,6 +384,8 @@ def __init__(self, name: str, address: str, init_s_params: bool=True, **kwargs):
num_ports, num_ports))
self.add_function('display_single_window',
call_cmd='DISP:LAY GRID;:DISP:LAY:GRID 1,1')
self.add_function('display_dual_window',
call_cmd='DISP:LAY GRID;:DISP:LAY:GRID 2,1')
self.add_function('rf_off', call_cmd='OUTP1 OFF')
self.add_function('rf_on', call_cmd='OUTP1 ON')
self.reset()
Expand Down Expand Up @@ -419,6 +421,8 @@ def add_channel(self, vna_parameter: str, **kwargs):
self.channels.append(channel)
if n_channels == 0:
self.display_single_window()
if n_channels == 1:
self.display_dual_window()

def _set_default_values(self):
for channel in self.channels:
Expand Down