diff --git a/qcodes/instrument_drivers/rohde_schwarz/ZNB.py b/qcodes/instrument_drivers/rohde_schwarz/ZNB.py index 19ff4497340..04cc552fc84 100644 --- a/qcodes/instrument_drivers/rohde_schwarz/ZNB.py +++ b/qcodes/instrument_drivers/rohde_schwarz/ZNB.py @@ -144,13 +144,12 @@ def __init__(self, parent: 'ZNB', name: str, channel: int, vna_parameter: str=No if full_modelname is not None: model = full_modelname.split('-')[0] else: - model = None - if model == 'ZNB4': - self._min_source_power = -80 - elif model == 'ZNB8': - self._min_source_power = -80 - elif model == 'ZNB20': - self._min_source_power = -60 + raise RuntimeError("Could not determine ZNB model") + mSourcePower = {'ZNB4':-80, 'ZNB8':-80, 'ZNB20':-60} + if model not in mSourcePower.keys(): + raise RuntimeError("Unsupported ZNB model: {}".format(model)) + self._min_source_power: float + self._min_source_power = mSourcePower[model] self.add_parameter(name='vna_parameter', label='VNA parameter', @@ -425,17 +424,13 @@ def __init__(self, name: str, address: str, init_s_params: bool = True, else: raise RuntimeError("Could not determine ZNB model") # format seems to be ZNB8-4Port - if model == 'ZNB4': - self._max_freq = 4.5e9 - self._min_freq = 9e3 - elif model == 'ZNB8': - self._max_freq = 8.5e9 - self._min_freq = 9e3 - elif model == 'ZNB20': - self._max_freq = 20e9 - self._min_freq = 100e3 - else: + mFrequency = {'ZNB4':(9e3, 4.5e9), 'ZNB8':(9e3, 8.5e9), 'ZNB20':(100e3, 20e9)} + if model not in mFrequency.keys(): raise RuntimeError("Unsupported ZNB model {}".format(model)) + self._min_freq: float + self._max_freq: float + self._min_freq, self._max_freq = mFrequency[model] + self.add_parameter(name='num_ports', get_cmd='INST:PORT:COUN?', get_parser=int)