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

Update to remove use of deprecated constructs #362

Merged
merged 2 commits into from
Sep 25, 2024
Merged
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
8 changes: 4 additions & 4 deletions src/qcodes_contrib_drivers/drivers/BlueFors/BlueFors.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@
df.sort_index(inplace=True)
return df.iloc[-1]["y"]
except (PermissionError, OSError) as err:
self.log.warn('Cannot access log file: {}. Returning np.nan instead of the temperature value.'.format(err))
self.log.warning('Cannot access log file: {}. Returning np.nan instead of the temperature value.'.format(err))

Check warning on line 173 in src/qcodes_contrib_drivers/drivers/BlueFors/BlueFors.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/BlueFors/BlueFors.py#L173

Added line #L173 was not covered by tests
return np.nan
except IndexError as err:
self.log.warn('Cannot parse log file: {}. Returning np.nan instead of the temperature value.'.format(err))
self.log.warning('Cannot parse log file: {}. Returning np.nan instead of the temperature value.'.format(err))

Check warning on line 176 in src/qcodes_contrib_drivers/drivers/BlueFors/BlueFors.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/BlueFors/BlueFors.py#L176

Added line #L176 was not covered by tests
return np.nan


Expand Down Expand Up @@ -211,8 +211,8 @@

return df.iloc[-1]['ch'+str(channel)+'_pressure']
except (PermissionError, OSError) as err:
self.log.warn('Cannot access log file: {}. Returning np.nan instead of the pressure value.'.format(err))
self.log.warning('Cannot access log file: {}. Returning np.nan instead of the pressure value.'.format(err))

Check warning on line 214 in src/qcodes_contrib_drivers/drivers/BlueFors/BlueFors.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/BlueFors/BlueFors.py#L214

Added line #L214 was not covered by tests
return np.nan
except IndexError as err:
self.log.warn('Cannot parse log file: {}. Returning np.nan instead of the pressure value.'.format(err))
self.log.warning('Cannot parse log file: {}. Returning np.nan instead of the pressure value.'.format(err))

Check warning on line 217 in src/qcodes_contrib_drivers/drivers/BlueFors/BlueFors.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/BlueFors/BlueFors.py#L217

Added line #L217 was not covered by tests
return np.nan
6 changes: 4 additions & 2 deletions src/qcodes_contrib_drivers/drivers/ERAInstruments/erasynth.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
import json
import logging

from qcodes import VisaInstrument, Parameter, validators
from qcodes import validators
from qcodes.instrument import VisaInstrument
from qcodes.parameters import Parameter

Check warning on line 25 in src/qcodes_contrib_drivers/drivers/ERAInstruments/erasynth.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/ERAInstruments/erasynth.py#L23-L25

Added lines #L23 - L25 were not covered by tests

try:
import pyvisa
Expand Down Expand Up @@ -674,7 +676,7 @@
num_tests = len(par_values)
for i, (name, val) in enumerate(par_values):
print(f"\r[{i+1:2d}/{num_tests}] Running...", end="")
self.set(name, val)
self.parameters[name].set(val)

Check warning on line 679 in src/qcodes_contrib_drivers/drivers/ERAInstruments/erasynth.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/ERAInstruments/erasynth.py#L679

Added line #L679 was not covered by tests

print("\nDone!")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

from time import sleep
import pyvisa
import pyvisa.constants

Check warning on line 13 in src/qcodes_contrib_drivers/drivers/OxfordInstruments/ILM200.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/OxfordInstruments/ILM200.py#L13

Added line #L13 was not covered by tests
import logging
from qcodes import VisaInstrument
from qcodes.instrument import VisaInstrument

Check warning on line 15 in src/qcodes_contrib_drivers/drivers/OxfordInstruments/ILM200.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/OxfordInstruments/ILM200.py#L15

Added line #L15 was not covered by tests


class OxfordInstruments_ILM200(VisaInstrument):
Expand Down Expand Up @@ -132,7 +133,7 @@
if len(idparts) < 4:
idparts += [None] * (4 - len(idparts))
except Exception as ex:
logging.warn('Error getting or interpreting *IDN?: ' + repr(idstr))
logging.warning('Error getting or interpreting *IDN?: ' + repr(idstr))

Check warning on line 136 in src/qcodes_contrib_drivers/drivers/OxfordInstruments/ILM200.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/OxfordInstruments/ILM200.py#L136

Added line #L136 was not covered by tests
logging.debug(ex)
idparts = [None, None, None, None]

Expand Down
18 changes: 10 additions & 8 deletions src/qcodes_contrib_drivers/drivers/QuTech/IVVI.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
import logging
import numpy as np
import pyvisa # used for the parity constant
import pyvisa.constants

Check warning on line 5 in src/qcodes_contrib_drivers/drivers/QuTech/IVVI.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/QuTech/IVVI.py#L5

Added line #L5 was not covered by tests
import traceback
import threading
import math

from qcodes import VisaInstrument, validators as vals
from qcodes.utils.validators import Bool, Numbers
from qcodes import validators as vals
from qcodes.validators import Bool, Numbers
from qcodes.instrument import VisaInstrument

Check warning on line 12 in src/qcodes_contrib_drivers/drivers/QuTech/IVVI.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/QuTech/IVVI.py#L10-L12

Added lines #L10 - L12 were not covered by tests


class IVVI(VisaInstrument):
Expand All @@ -26,7 +28,7 @@
http://qtwork.tudelft.nl/~schouten/ivvi/doc-d5/rs232linkformat.txt
A copy of this file can be found at the bottom of this file.
'''

full_range = 4000.0
half_range = full_range / 2
resolution = 16
Expand Down Expand Up @@ -193,7 +195,7 @@

def set_dacs_zero(self):
for i in range(self._numdacs):
self.set('dac{}'.format(i + 1), 0)
self.parameters['dac{}'.format(i + 1)](0)

Check warning on line 198 in src/qcodes_contrib_drivers/drivers/QuTech/IVVI.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/QuTech/IVVI.py#L198

Added line #L198 was not covered by tests

def linspace(self, start: float, end: float, samples: int, flexible: bool = False, bip: bool = True):
"""
Expand Down Expand Up @@ -222,7 +224,7 @@

linspace(-100,100,8) -> [-99.88555733577478, .. 6 more ..
, 99.64141298542764]

linspace(-1000, 1000, 2000) ->
[-976.4858472571908, .. 1998 more .., 975.6923781185626 ]

Expand All @@ -241,12 +243,12 @@

This prevents oversampling. Use flexable = True to adapt the number
of points.

Resolution limited sweep using the flexable option::

linspace(500, 502, 100, True) -> [500.0991836423285, .. 14 more ..
, 501.9302662699321]

A too narrow range::

linspace(0, 0.01, 100, True) # -> ValueError: No DAC values exist
Expand Down Expand Up @@ -357,7 +359,7 @@
proceed = True

if self.check_setpoints():
cur_val = self.get('dac{}'.format(channel))
cur_val = self.parameters['dac{}'.format(channel)]()

Check warning on line 362 in src/qcodes_contrib_drivers/drivers/QuTech/IVVI.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/QuTech/IVVI.py#L362

Added line #L362 was not covered by tests
# dac range in mV / 16 bits FIXME make range depend on polarity
byte_res = self.full_range / 2**16
# eps is a magic number to correct for an offset in the values
Expand Down
26 changes: 13 additions & 13 deletions src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,15 +622,15 @@
# checks if requirements for the compensation get and set functions are met
def _get_compensation(self, i):
# if HF enabled
if self.get(f'input_path_{i}') == 1:
if self.parameters[f'input_path_{i}']() == 1:

Check warning on line 625 in src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py#L625

Added line #L625 was not covered by tests
return self._param32bit(getattr(pyspcm, f'SPC_ACDC_OFFS_COMPENSATION{i}'))
else:
logging.info("M4i: HF path not set, ACDC offset compensation parameter will be ignored by the M4i card\n")
return M4i._NO_HF_MODE

def _set_compensation(self, i, value):
# if HF enabled
if self.get(f'input_path_{i}') == 1:
if self.parameters[f'input_path_{i}']() == 1:

Check warning on line 633 in src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py#L633

Added line #L633 was not covered by tests
self._set_param32bit(
getattr(pyspcm, f'SPC_ACDC_OFFS_COMPENSATION{i}'), value)
else:
Expand Down Expand Up @@ -723,7 +723,7 @@
if memsize is None:
memsize = self._channel_memsize
posttrigger_size = memsize - self._channel_pretrigger_memsize
mV_range = self.get(f'range_channel_{channel}')
mV_range = self.parameter[f'range_channel_{channel}']()

Check warning on line 726 in src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py#L726

Added line #L726 was not covered by tests
cx = self._channel_mask()
self.enable_channels(cx)
data = self.single_software_trigger_acquisition(
Expand Down Expand Up @@ -753,17 +753,17 @@
lp_filter (Optional[int]): enable (1) or disable (0) the 20 MHz low pass filter
"""
# initialize
self.set(f'input_path_{channel_index}', input_path)
self.parameters[f'input_path_{channel_index}'](input_path)

Check warning on line 756 in src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py#L756

Added line #L756 was not covered by tests
if termination is not None:
self.set(f'termination_{channel_index}', termination)
self.parameters[f'termination_{channel_index}'](termination)

Check warning on line 758 in src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py#L758

Added line #L758 was not covered by tests
if coupling is not None:
self.set(f'ACDC_coupling_{channel_index}', coupling)
self.parameters[f'ACDC_coupling_{channel_index}'](coupling)

Check warning on line 760 in src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py#L760

Added line #L760 was not covered by tests
if lp_filter is not None:
self.set(f'anti_aliasing_filter_{channel_index}', lp_filter)
self.set(f'range_channel_{channel_index}', mV_range) # note: set after voltage range
self.parameters[f'anti_aliasing_filter_{channel_index}'](lp_filter)
self.parameters[f'range_channel_{channel_index}'](mV_range) # note: set after voltage range

Check warning on line 763 in src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py#L762-L763

Added lines #L762 - L763 were not covered by tests
# can only be used with DC coupling and 50 Ohm path (hf)
if compensation is not None:
self.set(f'ACDC_offs_compensation_{channel_index}', compensation)
self.parameters[f'ACDC_offs_compensation_{channel_index}'](compensation)

Check warning on line 766 in src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py#L766

Added line #L766 was not covered by tests

def set_ext0_OR_trigger_settings(self, trig_mode, termination, coupling, level0, level1=None):
""" Configures ext0 trigger
Expand Down Expand Up @@ -793,10 +793,10 @@
acquisition."""
self.trigger_or_mask(0)
self.channel_or_mask(getattr(pyspcm, f'SPC_TMASK0_CH{i}'))
self.set(f'trigger_channel_{i}_level_0', bitlevel0)
self.parameters[f'trigger_channel_{i}_level_0'](bitlevel0)

Check warning on line 796 in src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py#L796

Added line #L796 was not covered by tests
if(bitlevel1 != None):
self.set(f'trigger_channel_{i}_level_1', bitlevel1)
self.set(f'trigger_mode_channel_{i}', trig_mode) # trigger mode
self.parameters[f'trigger_channel_{i}_level_1'](bitlevel1)
self.parameters[f'trigger_mode_channel_{i}'](trig_mode) # trigger mode

Check warning on line 799 in src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py#L798-L799

Added lines #L798 - L799 were not covered by tests

def setup_multi_recording(self, posttrigger_size, n_triggers=1,
pretrigger_size=None, boxcar_average=False):
Expand Down Expand Up @@ -876,7 +876,7 @@
resolution = self.ADC_to_voltage.cache()
voltages = np.zeros((numch, len(raw_data)//numch))
for i,ch in enumerate(active_channels):
mV_range = self.get(f'range_channel_{ch}')
mV_range = self.parameters[f'range_channel_{ch}']()

Check warning on line 879 in src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/Spectrum/M4i.py#L879

Added line #L879 was not covered by tests
voltages[i,:] = raw_data[i::numch] * (mV_range / 1000 / resolution / box_averages)
return voltages

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@
maxsteps = 0
deltav = {}
for i in vdict:
deltav[i] = vdict[i]-self.get('volt_{}'.format(i))
stepsize = self.get('volt_{}_step'.format(i))
deltav[i] = vdict[i]-self.parameters['volt_{}'.format(i)]()
stepsize = self.parameters['volt_{}_step'.format(i)]()

Check warning on line 224 in src/qcodes_contrib_drivers/drivers/StanfordResearchSystems/SIM928.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/StanfordResearchSystems/SIM928.py#L223-L224

Added lines #L223 - L224 were not covered by tests
steps = abs(int(np.ceil(deltav[i]/stepsize)))
if steps > maxsteps:
maxsteps = steps
Expand All @@ -234,13 +234,13 @@
done = []
prevvals = {}
for i in vdict:
prevvals[i] = self.get('volt_{}'.format(i))
prevvals[i] = self.parameters['volt_{}'.format(i)]()

Check warning on line 237 in src/qcodes_contrib_drivers/drivers/StanfordResearchSystems/SIM928.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/StanfordResearchSystems/SIM928.py#L237

Added line #L237 was not covered by tests
while len(done) != len(vdict):
intermediate.append({})
for i in vdict:
if i in done:
continue
stepsize = self.get('volt_{}_step'.format(i))
stepsize = self.parameters['volt_{}_step'.format(i)]()

Check warning on line 243 in src/qcodes_contrib_drivers/drivers/StanfordResearchSystems/SIM928.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/StanfordResearchSystems/SIM928.py#L243

Added line #L243 was not covered by tests
deltav = vdict[i]-prevvals[i]
if abs(deltav) <= stepsize:
intermediate[-1][i] = vdict[i]
Expand Down
18 changes: 9 additions & 9 deletions src/qcodes_contrib_drivers/drivers/ZurichInstruments/ZIHDAWG8.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import numpy as np
import zhinst.utils

from qcodes import Instrument
from qcodes.utils import validators as validators
from qcodes.instrument import Instrument
from qcodes import validators

WARNING_CLIPPING = r"^Warning \(line: [0-9]+\): [a-zA-Z0-9_]+ has a higher " \
r"amplitude than 1.0, waveform amplitude will be limited " \
Expand Down Expand Up @@ -88,7 +88,7 @@
Args:
channel_number: Output channel that should be enabled.
"""
self.set('sigouts_{}_on'.format(channel_number), 1)
self.parameters['sigouts_{}_on'.format(channel_number)](1)

Check warning on line 91 in src/qcodes_contrib_drivers/drivers/ZurichInstruments/ZIHDAWG8.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/ZurichInstruments/ZIHDAWG8.py#L91

Added line #L91 was not covered by tests

def disable_channel(self, channel_number: int) -> None:
"""
Expand All @@ -97,7 +97,7 @@
Args:
channel_number: Output channel that should be disabled.
"""
self.set('sigouts_{}_on'.format(channel_number), 0)
self.parameters['sigouts_{}_on'.format(channel_number)](0)

Check warning on line 100 in src/qcodes_contrib_drivers/drivers/ZurichInstruments/ZIHDAWG8.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/ZurichInstruments/ZIHDAWG8.py#L100

Added line #L100 was not covered by tests

def start_awg(self, awg_number: int):
"""
Expand All @@ -106,7 +106,7 @@
Args:
awg_number: The AWG that should be enabled.
"""
self.set('awgs_{}_enable'.format(awg_number), 1)
self.parameters['awgs_{}_enable'.format(awg_number)](1)

Check warning on line 109 in src/qcodes_contrib_drivers/drivers/ZurichInstruments/ZIHDAWG8.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/ZurichInstruments/ZIHDAWG8.py#L109

Added line #L109 was not covered by tests

def stop_awg(self, awg_number: int) -> None:
"""
Expand All @@ -115,7 +115,7 @@
Args:
awg_number: The AWG that should be disabled.
"""
self.set('awgs_{}_enable'.format(awg_number), 0)
self.parameters['awgs_{}_enable'.format(awg_number)](0)

Check warning on line 118 in src/qcodes_contrib_drivers/drivers/ZurichInstruments/ZIHDAWG8.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/ZurichInstruments/ZIHDAWG8.py#L118

Added line #L118 was not covered by tests

def waveform_to_wave(self, wave_name: str, waveform: np.ndarray) -> None:
"""
Expand Down Expand Up @@ -283,9 +283,9 @@
position of the waveform in the Waveforms sub-tab of the AWG tab
in the GUI.
"""
self.set('awgs_{}_waveform_index'.format(awg_number), index)
self.parameters['awgs_{}_waveform_index'.format(awg_number)](index)

Check warning on line 286 in src/qcodes_contrib_drivers/drivers/ZurichInstruments/ZIHDAWG8.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/ZurichInstruments/ZIHDAWG8.py#L286

Added line #L286 was not covered by tests
self.daq.sync()
self.set('awgs_{}_waveform_data'.format(awg_number), waveform)
self.parameters['awgs_{}_waveform_data'.format(awg_number)](waveform)

Check warning on line 288 in src/qcodes_contrib_drivers/drivers/ZurichInstruments/ZIHDAWG8.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/ZurichInstruments/ZIHDAWG8.py#L288

Added line #L288 was not covered by tests

def set_channel_grouping(self, group: int) -> None:
"""
Expand All @@ -295,7 +295,7 @@
group: 0: groups of 2. 1: groups of 4. 2: groups of 8 i.e., one
sequencer program controls 8 outputs.
"""
self.set('system_awg_channelgrouping', group)
self.system_awg_channelgrouping(group)

Check warning on line 298 in src/qcodes_contrib_drivers/drivers/ZurichInstruments/ZIHDAWG8.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes_contrib_drivers/drivers/ZurichInstruments/ZIHDAWG8.py#L298

Added line #L298 was not covered by tests

def create_parameters_from_node_tree(self, parameters: dict) -> None:
"""
Expand Down