Skip to content

Commit

Permalink
Merge pull request #6105 from jenshnielsen/aimtti_refactor
Browse files Browse the repository at this point in the history
Refactor AimTTI drivers
  • Loading branch information
jenshnielsen committed May 23, 2024
2 parents 2a3f427 + 6df2ae1 commit 10785d5
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 13 deletions.
5 changes: 5 additions & 0 deletions docs/changes/newsfragments/6105.improved_driver
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The Aim TTi drivers shipping with QCoDeS have been updated to ensure all Parameters are set as static
attributes that are documented and can be type checked. The docs for the Aim TTi drivers have been
updated to not document inherited members. This makes the documentation significantly more readable
as it focuses on specific members for a given instrument. The documentation now also links superclasses.
Please consult these for inherited members.
1 change: 1 addition & 0 deletions docs/drivers_api/AimTTi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ AimTTi Drivers

.. automodule:: qcodes.instrument_drivers.AimTTi
:autosummary:
:no-inherited-members:
37 changes: 25 additions & 12 deletions src/qcodes/instrument_drivers/AimTTi/_AimTTi_PL_P.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from typing import TYPE_CHECKING, Any, ClassVar, Optional
from typing import TYPE_CHECKING, ClassVar, Optional

from qcodes import validators as vals
from qcodes.instrument import (
ChannelList,
Instrument,
InstrumentBaseKWArgs,
InstrumentChannel,
VisaInstrument,
VisaInstrumentKWArgs,
)
from qcodes.parameters import create_on_off_val_mapping
from qcodes.parameters import Parameter, create_on_off_val_mapping

if TYPE_CHECKING:
from typing_extensions import Unpack
Expand All @@ -29,7 +30,11 @@ class AimTTiChannel(InstrumentChannel):
"""

def __init__(
self, parent: Instrument, name: str, channel: int, **kwargs: Any
self,
parent: Instrument,
name: str,
channel: int,
**kwargs: "Unpack[InstrumentBaseKWArgs]",
) -> None:
"""
Args:
Expand All @@ -46,62 +51,68 @@ def __init__(
# internally.
self.set_up_store_slots = [i for i in range(0, 10)]

self.add_parameter(
self.volt: Parameter = self.add_parameter(
"volt",
get_cmd=self._get_voltage_value,
get_parser=float,
set_cmd=f"V{channel} {{}}",
label="Voltage",
unit="V",
)
"""Parameter volt"""

self.add_parameter(
self.volt_step_size: Parameter = self.add_parameter(
"volt_step_size",
get_cmd=self._get_voltage_step_size,
get_parser=float,
set_cmd=f"DELTAV{channel} {{}}",
label="Voltage Step Size",
unit="V",
)
"""Parameter volt_step_size"""

self.add_parameter(
self.curr: Parameter = self.add_parameter(
"curr",
get_cmd=self._get_current_value,
get_parser=float,
set_cmd=f"I{channel} {{}}",
label="Current",
unit="A",
)
"""Parameter curr"""

self.add_parameter(
self.curr_range: Parameter = self.add_parameter(
"curr_range",
get_cmd=f"IRANGE{channel}?",
get_parser=int,
set_cmd=self._set_current_range,
label="Current Range",
unit="A",
vals=vals.Numbers(1, 2),
docstring="Set the current range of the output."
docstring="Set the current range of the output. "
"Here, the integer 1 is for the Low range, "
"and integer 2 is for the High range.",
)
"""Set the current range of the output. Here, the integer 1 is for the Low range, and integer 2 is for the High range."""

self.add_parameter(
self.curr_step_size: Parameter = self.add_parameter(
"curr_step_size",
get_cmd=self._get_current_step_size,
get_parser=float,
set_cmd=f"DELTAI{channel} {{}}",
label="Current Step Size",
unit="A",
)
"""Parameter curr_step_size"""

self.add_parameter(
self.output: Parameter = self.add_parameter(
"output",
get_cmd=f"OP{channel}?",
get_parser=float,
set_cmd=f"OP{channel} {{}}",
val_mapping=create_on_off_val_mapping(on_val=1, off_val=0),
)
"""Parameter output"""

def _get_voltage_value(self) -> float:
channel_id = self.channel
Expand Down Expand Up @@ -220,8 +231,10 @@ def set_damping(self, val: int) -> None:

class AimTTi(VisaInstrument):
"""
This is the QCoDeS driver for the Aim TTi PL-P series power supply.
Tested with Aim TTi PL601-P equipped with a single output channel.
Base class for Aim TTi PL-P series power supply.
This class should not be instantiated directly, but rather one of the
subclasses corresponding to the specific model of the power supply should
be used.
"""

_numOutputChannels: ClassVar[dict[str, int]] = {
Expand Down
3 changes: 2 additions & 1 deletion src/qcodes/instrument_drivers/AimTTi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ._AimTTi_PL_P import AimTTiChannel, NotKnownModel
from ._AimTTi_PL_P import AimTTi, AimTTiChannel, NotKnownModel
from .Aim_TTi_PL068_P import AimTTiPL068P
from .Aim_TTi_PL155_P import AimTTiPL155P
from .Aim_TTi_PL303_P import AimTTiPL303P
Expand All @@ -8,6 +8,7 @@
from .Aim_TTi_QL355_TP import AimTTiQL355TP

__all__ = [
"AimTTi",
"AimTTiChannel",
"AimTTiPL068P",
"AimTTiPL155P",
Expand Down

0 comments on commit 10785d5

Please sign in to comment.