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

Oxford Triton driver: only add magnet parameters if one is present #6792

Merged
merged 2 commits into from
Jan 16, 2025
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
1 change: 1 addition & 0 deletions docs/changes/newsfragments/6792.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Only add magnet parameters if a magnet is detected in the Oxford Triton driver.
140 changes: 76 additions & 64 deletions src/qcodes/instrument_drivers/oxford/triton.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@
self._control_channel = 5
self.pump_label_dict = {"TURB1": "Turbo 1", "COMP": "Compressor"}

self.magnet_available: bool = self._get_control_B_param("ACTN") != "INVALID"
"""Indicates if a magnet is equipped *and* controlled by the Triton."""

Check warning on line 68 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L67-L68

Added lines #L67 - L68 were not covered by tests

self.time: Parameter = self.add_parameter(
name="time",
label="System Time",
Expand Down Expand Up @@ -172,73 +175,80 @@
)
"""Parameter pid_range"""

self.magnet_status: Parameter = self.add_parameter(
name="magnet_status",
label="Magnet status",
unit="",
get_cmd=partial(self._get_control_B_param, "ACTN"),
)
"""Parameter magnet_status"""

self.magnet_sweeprate: Parameter = self.add_parameter(
name="magnet_sweeprate",
label="Magnet sweep rate",
unit="T/min",
get_cmd=partial(self._get_control_B_param, "RVST:RATE"),
set_cmd=partial(self._set_control_magnet_sweeprate_param),
)
"""Parameter magnet_sweeprate"""
if self.magnet_available:
self.magnet_status: Parameter = self.add_parameter(

Check warning on line 179 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L178-L179

Added lines #L178 - L179 were not covered by tests
name="magnet_status",
label="Magnet status",
unit="",
get_cmd=partial(self._get_control_B_param, "ACTN"),
)
"""Parameter magnet_status"""

Check warning on line 185 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L185

Added line #L185 was not covered by tests

self.magnet_sweeprate: Parameter = self.add_parameter(

Check warning on line 187 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L187

Added line #L187 was not covered by tests
name="magnet_sweeprate",
label="Magnet sweep rate",
unit="T/min",
get_cmd=partial(self._get_control_B_param, "RVST:RATE"),
set_cmd=partial(self._set_control_magnet_sweeprate_param),
)
"""Parameter magnet_sweeprate"""

Check warning on line 194 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L194

Added line #L194 was not covered by tests

self.magnet_sweeprate_insta: Parameter = self.add_parameter(
name="magnet_sweeprate_insta",
label="Instantaneous magnet sweep rate",
unit="T/min",
get_cmd=partial(self._get_control_B_param, "RFST"),
)
"""Parameter magnet_sweeprate_insta"""
self.magnet_sweeprate_insta: Parameter = self.add_parameter(

Check warning on line 196 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L196

Added line #L196 was not covered by tests
name="magnet_sweeprate_insta",
label="Instantaneous magnet sweep rate",
unit="T/min",
get_cmd=partial(self._get_control_B_param, "RFST"),
)
"""Parameter magnet_sweeprate_insta"""

Check warning on line 202 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L202

Added line #L202 was not covered by tests

self.B: Parameter = self.add_parameter(
name="B",
label="Magnetic field",
unit="T",
get_cmd=partial(self._get_control_B_param, "VECT"),
)
"""Parameter B"""

self.Bx: Parameter = self.add_parameter(
name="Bx",
label="Magnetic field x-component",
unit="T",
get_cmd=partial(self._get_control_Bcomp_param, "VECTBx"),
set_cmd=partial(self._set_control_Bx_param),
)
"""Parameter Bx"""

self.By: Parameter = self.add_parameter(
name="By",
label="Magnetic field y-component",
unit="T",
get_cmd=partial(self._get_control_Bcomp_param, "VECTBy"),
set_cmd=partial(self._set_control_By_param),
)
"""Parameter By"""

self.Bz: Parameter = self.add_parameter(
name="Bz",
label="Magnetic field z-component",
unit="T",
get_cmd=partial(self._get_control_Bcomp_param, "VECTBz"),
set_cmd=partial(self._set_control_Bz_param),
)
"""Parameter Bz"""
self.B: Parameter = self.add_parameter(

Check warning on line 204 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L204

Added line #L204 was not covered by tests
name="B",
label="Magnetic field",
unit="T",
get_cmd=partial(self._get_control_B_param, "VECT"),
)
"""Parameter B"""

Check warning on line 210 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L210

Added line #L210 was not covered by tests

self.Bx: Parameter = self.add_parameter(

Check warning on line 212 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L212

Added line #L212 was not covered by tests
name="Bx",
label="Magnetic field x-component",
unit="T",
get_cmd=partial(self._get_control_Bcomp_param, "VECTBx"),
set_cmd=partial(self._set_control_Bx_param),
)
"""Parameter Bx"""

Check warning on line 219 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L219

Added line #L219 was not covered by tests

self.By: Parameter = self.add_parameter(

Check warning on line 221 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L221

Added line #L221 was not covered by tests
name="By",
label="Magnetic field y-component",
unit="T",
get_cmd=partial(self._get_control_Bcomp_param, "VECTBy"),
set_cmd=partial(self._set_control_By_param),
)
"""Parameter By"""

Check warning on line 228 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L228

Added line #L228 was not covered by tests

self.Bz: Parameter = self.add_parameter(

Check warning on line 230 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L230

Added line #L230 was not covered by tests
name="Bz",
label="Magnetic field z-component",
unit="T",
get_cmd=partial(self._get_control_Bcomp_param, "VECTBz"),
set_cmd=partial(self._set_control_Bz_param),
)
"""Parameter Bz"""

Check warning on line 237 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L237

Added line #L237 was not covered by tests

self.magnet_sweep_time: Parameter = self.add_parameter(
name="magnet_sweep_time",
label="Magnet sweep time",
unit="T/min",
get_cmd=partial(self._get_control_B_param, "RVST:TIME"),
)
"""Parameter magnet_sweep_time"""
self.magnet_sweep_time: Parameter = self.add_parameter(

Check warning on line 239 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L239

Added line #L239 was not covered by tests
name="magnet_sweep_time",
label="Magnet sweep time",
unit="T/min",
get_cmd=partial(self._get_control_B_param, "RVST:TIME"),
)
"""Parameter magnet_sweep_time"""

Check warning on line 245 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L245

Added line #L245 was not covered by tests
else:
self.log.debug(

Check warning on line 247 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L247

Added line #L247 was not covered by tests
"Skipped adding magnet parameters. This may either be because there "
"is none equipped or because the Mercury iPS is not set to be "
"controlled by the Triton."
)

self.turb1_speed: Parameter = self.add_parameter(
name="turb1_speed",
Expand Down Expand Up @@ -266,6 +276,8 @@
self.connect_message()

def set_B(self, x: float, y: float, z: float, s: float) -> None:
if not self.magnet_available:
raise RuntimeError("Magnet not available")

Check warning on line 280 in src/qcodes/instrument_drivers/oxford/triton.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/oxford/triton.py#L279-L280

Added lines #L279 - L280 were not covered by tests
if 0 < s <= 0.2:
self.write(
"SET:SYS:VRM:COO:CART:RVST:MODE:RATE:RATE:"
Expand Down
Loading