Skip to content

Commit d338bc1

Browse files
committed
Update usage of deprecated driverS
1 parent 165d7d7 commit d338bc1

10 files changed

Lines changed: 63 additions & 50 deletions

File tree

src/qcodes/instrument_drivers/ithaco/Ithaco_1211.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(
6262
self.units = (p_unit, "A")
6363

6464
def get_raw(self) -> tuple[ParamRawDataType, ...]:
65-
assert isinstance(self.instrument, Ithaco_1211)
65+
assert isinstance(self.instrument, Ithaco1211)
6666
volt = self._measured_param.get()
6767
current = (
6868
self.instrument.sens.get() * self.instrument.sens_factor.get()

src/qcodes/instrument_drivers/yokogawa/GS200.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class GS200_Monitor(InstrumentChannel):
7373

7474
def __init__(
7575
self,
76-
parent: "GS200",
76+
parent: "GS200", # pyright: ignore[reportDeprecated]
7777
name: str,
7878
present: bool,
7979
**kwargs: "Unpack[InstrumentBaseKWArgs]",
@@ -184,19 +184,19 @@ def state(self) -> int:
184184

185185
def _get_measurement(self) -> float:
186186
if self._unit is None or self._range is None:
187-
raise GS200Exception("Measurement module not initialized.")
187+
raise GS200Exception("Measurement module not initialized.") # pyright: ignore[reportDeprecated]
188188
if self._parent.auto_range.get() or (self._unit == "VOLT" and self._range < 1):
189189
# Measurements will not work with autorange, or when
190190
# range is <1V.
191191
self._enabled = False
192-
raise GS200Exception(
192+
raise GS200Exception( # pyright: ignore[reportDeprecated]
193193
"Measurements will not work when range is <1V"
194194
"or when in auto range mode."
195195
)
196196
if not self._output:
197-
raise GS200Exception("Output is off.")
197+
raise GS200Exception("Output is off.") # pyright: ignore[reportDeprecated]
198198
if not self._enabled:
199-
raise GS200Exception("Measurements are disabled.")
199+
raise GS200Exception("Measurements are disabled.") # pyright: ignore[reportDeprecated]
200200
# If enabled and output is on, then we can perform a measurement.
201201
return float(self.ask(":MEAS?"))
202202

@@ -236,7 +236,7 @@ class GS200Program(InstrumentChannel):
236236

237237
def __init__(
238238
self,
239-
parent: "GS200",
239+
parent: "GS200", # pyright: ignore[reportDeprecated]
240240
name: str,
241241
**kwargs: "Unpack[InstrumentBaseKWArgs]",
242242
) -> None:
@@ -504,16 +504,18 @@ def __init__(
504504

505505
# Check if monitor is present, and if so enable measurement
506506
monitor_present = "/MON" in self.ask("*OPT?")
507-
self.measure: GS200_Monitor = self.add_submodule(
508-
"measure", GS200_Monitor(self, "measure", monitor_present)
507+
self.measure: GS200_Monitor = self.add_submodule( # pyright: ignore[reportDeprecated]
508+
"measure",
509+
GS200_Monitor(self, "measure", monitor_present), # pyright: ignore[reportDeprecated]
509510
)
510511
"""Instrument module measure"""
511512

512513
# Reset function
513514
self.add_function("reset", call_cmd="*RST")
514515

515-
self.program: GS200Program = self.add_submodule(
516-
"program", GS200Program(self, "program")
516+
self.program: GS200Program = self.add_submodule( # pyright: ignore[reportDeprecated]
517+
"program",
518+
GS200Program(self, "program"), # pyright: ignore[reportDeprecated]
517519
)
518520
"""Instrument module program"""
519521

@@ -744,7 +746,7 @@ def _set_source_mode(self, mode: ModeType) -> None:
744746
745747
"""
746748
if self.output() == "on":
747-
raise GS200Exception("Cannot switch mode while source is on")
749+
raise GS200Exception("Cannot switch mode while source is on") # pyright: ignore[reportDeprecated]
748750

749751
if mode == "VOLT":
750752
self.range.source = self.voltage_range

tests/drivers/test_Keysight_N6705B.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import pytest
22

3-
import qcodes.instrument_drivers.Keysight.Keysight_N6705B as N6705B
3+
import qcodes.instrument_drivers.Keysight.Keysight_N6705B as N6705B_module
44

55

66
@pytest.fixture(scope="function", name="driver")
77
def _make_driver():
8-
driver = N6705B.N6705B(
8+
driver = N6705B_module.KeysightN6705B(
99
"N6705B", address="GPIB::1::INSTR", pyvisa_sim_file="Keysight_N6705B.yaml"
1010
)
1111
yield driver

tests/drivers/test_MercuryiPS.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
from hypothesis import HealthCheck, given, settings
77
from pytest import LogCaptureFixture
88

9-
from qcodes.instrument_drivers.oxford.MercuryiPS_VISA import MercuryiPS
9+
from qcodes.instrument_drivers.oxford.MercuryiPS_VISA import OxfordMercuryiPS
1010
from qcodes.math_utils.field_vector import FieldVector
1111

1212

1313
@pytest.fixture(scope="function")
1414
def driver():
15-
mips = MercuryiPS(
15+
mips = OxfordMercuryiPS(
1616
"mips", address="GPIB::1::INSTR", pyvisa_sim_file="MercuryiPS.yaml"
1717
)
1818
yield mips
@@ -27,7 +27,7 @@ def spherical_limits(x, y, z):
2727
"""
2828
return np.sqrt(x**2 + y**2 + z**2) <= 2
2929

30-
mips_sl = MercuryiPS(
30+
mips_sl = OxfordMercuryiPS(
3131
"mips_sl",
3232
address="GPIB::1::INSTR",
3333
pyvisa_sim_file="MercuryiPS.yaml",
@@ -49,7 +49,7 @@ def cylindrical_limits(x, y, z):
4949

5050
return rho_check and z_check
5151

52-
mips_cl = MercuryiPS(
52+
mips_cl = OxfordMercuryiPS(
5353
"mips_cl",
5454
address="GPIB::1::INSTR",
5555
pyvisa_sim_file="MercuryiPS.yaml",
@@ -88,7 +88,7 @@ def test_vector_ramp_rate(driver) -> None:
8888
def test_wrong_field_limit_raises() -> None:
8989
# check that a non-callable input fails
9090
with pytest.raises(ValueError):
91-
MercuryiPS(
91+
OxfordMercuryiPS(
9292
"mips",
9393
address="GPIB::1::INSTR",
9494
pyvisa_sim_file="MercuryiPS.yaml",

tests/drivers/test_RS_SGS100A.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import numpy as np
44
import pytest
55

6-
from qcodes.instrument_drivers.rohde_schwarz.SGS100A import RohdeSchwarz_SGS100A
6+
from qcodes.instrument_drivers.rohde_schwarz.SGS100A import RohdeSchwarzSGS100A
77

88
if TYPE_CHECKING:
99
from collections.abc import Sequence
@@ -14,7 +14,7 @@ def _make_sg():
1414
"""
1515
Create a RohdeSchwarz SGS100A instrument
1616
"""
17-
driver = RohdeSchwarz_SGS100A(
17+
driver = RohdeSchwarzSGS100A(
1818
"sgs100a", address="GPIB::1::INSTR", pyvisa_sim_file="RSSGS100A.yaml"
1919
)
2020
yield driver

tests/drivers/test_keithley_3706A.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
import pytest
44

5-
from qcodes.instrument_drivers.tektronix.Keithley_3706A import Keithley_3706A
5+
from qcodes.instrument_drivers.Keithley.Keithley_3706A import Keithley3706A
66

77

88
@pytest.fixture(scope="function", name="driver")
99
def _make_driver():
10-
driver = Keithley_3706A(
10+
driver = Keithley3706A(
1111
"Keithley_3706A",
1212
address="GPIB::11::INSTR",
1313
pyvisa_sim_file="Keithley_3706A.yaml",

tests/drivers/test_keithley_s46.py

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
import pytest
44
from pytest import FixtureRequest, LogCaptureFixture
55

6-
from qcodes.instrument_drivers.tektronix.Keithley_s46 import S46, LockAcquisitionError
6+
from qcodes.instrument_drivers.Keithley.Keithley_s46 import (
7+
KeithleyS46,
8+
KeithleyS46LockAcquisitionError,
9+
)
710

811

912
def test_aliases_dict() -> None:
@@ -19,15 +22,17 @@ def calc_channel_nr(alias: str) -> int:
1922
offset_dict = dict(zip(["A", "B", "C", "D", "R"], range(0, 32, 6)))
2023
return offset_dict[alias[0]] + int(alias[1:])
2124

22-
assert all([nr == calc_channel_nr(al) for al, nr in S46.channel_numbers.items()])
25+
assert all(
26+
[nr == calc_channel_nr(al) for al, nr in KeithleyS46.channel_numbers.items()]
27+
)
2328

2429

2530
@pytest.fixture(scope="function")
2631
def s46_six():
2732
"""
2833
A six channel-per-relay instrument
2934
"""
30-
driver = S46(
35+
driver = KeithleyS46(
3136
"s46_six", address="GPIB::2::INSTR", pyvisa_sim_file="Keithley_s46.yaml"
3237
)
3338

@@ -42,7 +47,7 @@ def s46_four():
4247
"""
4348
A four channel-per-relay instrument
4449
"""
45-
driver = S46(
50+
driver = KeithleyS46(
4651
"s46_four", address="GPIB::3::INSTR", pyvisa_sim_file="Keithley_s46.yaml"
4752
)
4853

@@ -58,13 +63,13 @@ def test_runtime_error_on_bad_init(request: FixtureRequest) -> None:
5863
channel per relay closed, raise a runtime error. An instrument can come to
5964
this state if previously, other software was used to control the instrument
6065
"""
61-
request.addfinalizer(S46.close_all)
66+
request.addfinalizer(KeithleyS46.close_all)
6267

6368
with pytest.raises(
6469
RuntimeError,
6570
match="The driver is initialized from an undesirable instrument state",
6671
):
67-
S46(
72+
KeithleyS46(
6873
"s46_bad_state",
6974
address="GPIB::1::INSTR",
7075
pyvisa_sim_file="Keithley_s46.yaml",
@@ -76,7 +81,7 @@ def test_query_close_once_at_init(caplog: LogCaptureFixture) -> None:
7681
Test that, during initialisation, we query the closed channels only once
7782
"""
7883
with caplog.at_level(logging.DEBUG):
79-
inst = S46(
84+
inst = KeithleyS46(
8085
"s46_test_query_once",
8186
address="GPIB::2::INSTR",
8287
pyvisa_sim_file="Keithley_s46.yaml",
@@ -85,14 +90,16 @@ def test_query_close_once_at_init(caplog: LogCaptureFixture) -> None:
8590
inst.close()
8691

8792

88-
def test_init_six(s46_six: S46, caplog: LogCaptureFixture) -> None:
93+
def test_init_six(s46_six: KeithleyS46, caplog: LogCaptureFixture) -> None:
8994
"""
9095
Test that the six channel instrument initializes correctly.
9196
"""
9297
assert len(s46_six.available_channels) == 26
9398

9499
closed_channel_numbers = [1, 8, 13]
95-
assert s46_six.closed_channels() == [S46.aliases[i] for i in closed_channel_numbers]
100+
assert s46_six.closed_channels() == [
101+
KeithleyS46.aliases[i] for i in closed_channel_numbers
102+
]
96103

97104
with caplog.at_level(logging.DEBUG):
98105
s46_six.open_all_channels()
@@ -105,15 +112,15 @@ def test_init_six(s46_six: S46, caplog: LogCaptureFixture) -> None:
105112
assert s46_six.C1._lock._locked_by is None
106113

107114

108-
def test_init_four(s46_four: S46) -> None:
115+
def test_init_four(s46_four: KeithleyS46) -> None:
109116
"""
110117
Test that the six channel instrument initializes correctly.
111118
"""
112119
assert len(s46_four.available_channels) == 18
113120

114121
closed_channel_numbers = [1, 8]
115122
assert s46_four.closed_channels() == [
116-
S46.aliases[i] for i in closed_channel_numbers
123+
KeithleyS46.aliases[i] for i in closed_channel_numbers
117124
]
118125

119126
# A four channel instrument will have channels missing
@@ -123,28 +130,30 @@ def test_init_four(s46_four: S46) -> None:
123130
assert not hasattr(s46_four, alias)
124131

125132

126-
def test_channel_number_invariance(s46_four: S46, s46_six: S46) -> None:
133+
def test_channel_number_invariance(s46_four: KeithleyS46, s46_six: KeithleyS46) -> None:
127134
"""
128135
Regardless of the channel layout (that is, number of channels per relay),
129136
channel aliases should represent the same channel. See also page 2-5 of the
130137
manual (e.g. B1 is *always* channel 7)
131138
"""
132-
for alias in S46.channel_numbers.keys():
139+
for alias in KeithleyS46.channel_numbers.keys():
133140
if hasattr(s46_four, alias) and hasattr(s46_six, alias):
134141
channel_four = getattr(s46_four, alias)
135142
channel_six = getattr(s46_six, alias)
136143
assert channel_four.channel_number == channel_six.channel_number
137144

138145

139-
def test_locking_mechanism(s46_six: S46) -> None:
146+
def test_locking_mechanism(s46_six: KeithleyS46) -> None:
140147
"""
141148
1) Test that the lock acquisition error is raised if we try to close
142149
more then once channel per replay
143150
2) Test that the lock is released when opening a channel that was closed
144151
"""
145152
s46_six.A1("close")
146153

147-
with pytest.raises(LockAcquisitionError, match="is already in use by channel"):
154+
with pytest.raises(
155+
KeithleyS46LockAcquisitionError, match="is already in use by channel"
156+
):
148157
# A1 should be closed already
149158
s46_six.A2("close")
150159
# release the lock
@@ -155,15 +164,17 @@ def test_locking_mechanism(s46_six: S46) -> None:
155164
# Let C1 acquire the lock
156165
s46_six.C1("close")
157166
# closing C2 should raise an error
158-
with pytest.raises(LockAcquisitionError, match="is already in use by channel"):
167+
with pytest.raises(
168+
KeithleyS46LockAcquisitionError, match="is already in use by channel"
169+
):
159170
s46_six.C2("close")
160171

161172
# Upon opening C1 we should be able to close C2
162173
s46_six.C1("open")
163174
s46_six.C2("close")
164175

165176

166-
def test_is_closed(s46_six: S46) -> None:
177+
def test_is_closed(s46_six: KeithleyS46) -> None:
167178
"""
168179
Test the `is_closed` public method
169180
"""

tests/drivers/test_keysight_n9030b.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import pytest
22

3-
from qcodes.instrument_drivers.Keysight.N9030B import (
4-
N9030B,
5-
PhaseNoiseMode,
6-
SpectrumAnalyzerMode,
3+
from qcodes.instrument_drivers.Keysight.Keysight_N9030B import (
4+
KeysightN9030B,
5+
KeysightN9030BPhaseNoiseMode,
6+
KeysightN9030BSpectrumAnalyzerMode,
77
)
88

99

1010
@pytest.fixture(name="driver")
1111
def _make_driver():
12-
driver = N9030B(
12+
driver = KeysightN9030B(
1313
"n9030B_sim", address="GPIB::1::INSTR", pyvisa_sim_file="Keysight_N9030B.yaml"
1414
)
1515
yield driver
@@ -36,7 +36,7 @@ def test_idn(driver) -> None:
3636

3737

3838
def test_swept_sa_setup(sa) -> None:
39-
assert isinstance(sa, SpectrumAnalyzerMode)
39+
assert isinstance(sa, KeysightN9030BSpectrumAnalyzerMode)
4040

4141
sa.setup_swept_sa_sweep(123, 11e3, 501)
4242
assert sa.root_instrument.mode() == "SA"
@@ -48,7 +48,7 @@ def test_swept_sa_setup(sa) -> None:
4848

4949

5050
def test_log_plot_setup(pn) -> None:
51-
assert isinstance(pn, PhaseNoiseMode)
51+
assert isinstance(pn, KeysightN9030BPhaseNoiseMode)
5252

5353
pn.setup_log_plot_sweep(1000, 1e7, 10001)
5454
assert pn.root_instrument.mode() == "PNOISE"

tests/drivers/test_tektronix_AWG5208.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
import pytest
44

5-
from qcodes.instrument_drivers.tektronix.AWG5208 import AWG5208
5+
from qcodes.instrument_drivers.tektronix.AWG5208 import TektronixAWG5208
66

77

88
@pytest.fixture(scope="function")
99
def awg():
10-
awg_sim = AWG5208(
10+
awg_sim = TektronixAWG5208(
1111
"awg_sim", address="GPIB0::1::INSTR", pyvisa_sim_file="Tektronix_AWG5208.yaml"
1212
)
1313
yield awg_sim

tests/mockers/test_simulated_ats_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from qcodes.instrument.mockers.simulated_ats_api import SimulatedATS9360API
77
from qcodes.instrument_drivers.AlazarTech.ATS import AcquisitionInterface
8-
from qcodes.instrument_drivers.AlazarTech.ATS9360 import AlazarTech_ATS9360 as ATS9360
8+
from qcodes.instrument_drivers.AlazarTech.ATS9360 import AlazarTechATS9360 as ATS9360
99

1010

1111
def ones_generator(data):

0 commit comments

Comments
 (0)