Skip to content

Commit

Permalink
Merge pull request #6113 from jenshnielsen/alazar_refactor
Browse files Browse the repository at this point in the history
Refactor drivers Alazar -> Galil
  • Loading branch information
jenshnielsen authored May 24, 2024
2 parents dbb23fc + 725426e commit 0b64086
Show file tree
Hide file tree
Showing 21 changed files with 1,724 additions and 1,224 deletions.
6 changes: 6 additions & 0 deletions docs/changes/newsfragments/6113.improved_driver
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
The Alazar Tech, American Magnetics, Basel, Cryomagnetics and Galil 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 same 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/AlazarTech.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Alazar Tech Drivers

.. automodule:: qcodes.instrument_drivers.AlazarTech
:autosummary:
:no-inherited-members:
1 change: 1 addition & 0 deletions docs/drivers_api/American_magnetics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ American Magnetics Inc Drivers

.. automodule:: qcodes.instrument_drivers.american_magnetics
:autosummary:
:no-inherited-members:
1 change: 1 addition & 0 deletions docs/drivers_api/Basel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Basel Drivers

.. automodule:: qcodes.instrument_drivers.basel
:autosummary:
:no-inherited-members:
1 change: 1 addition & 0 deletions docs/drivers_api/CryoMagnetics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Cryomagnetics Drivers

.. automodule:: qcodes.instrument_drivers.cryomagnetics
:autosummary:
:no-inherited-members:
1 change: 1 addition & 0 deletions docs/drivers_api/Galil.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Galil Drivers

.. automodule:: qcodes.instrument_drivers.Galil
:autosummary:
:no-inherited-members:
34 changes: 25 additions & 9 deletions src/qcodes/instrument_drivers/AlazarTech/ATS.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
from typing import TYPE_CHECKING, Any, Generic, TypeVar, Union, cast

import numpy as np
from typing_extensions import deprecated

from qcodes.instrument import Instrument
from qcodes.instrument import Instrument, InstrumentBaseKWArgs
from qcodes.utils import QCoDeSDeprecationWarning

from .ats_api import AlazarATSAPI
from .constants import NUMBER_OF_CHANNELS_FROM_BYTE_REPR, max_buffer_size
Expand All @@ -20,6 +22,8 @@
if TYPE_CHECKING:
from collections.abc import Iterator, Sequence

from typing_extensions import Unpack

logger = logging.getLogger(__name__)

OutputType = TypeVar('OutputType')
Expand All @@ -33,11 +37,13 @@
]


class AlazarTech_ATS(Instrument):
class AlazarTechATS(Instrument):
"""
This is the qcodes driver for Alazar data acquisition cards
This is the BaseClass for the qcodes drivers for Alazar data acquisition cards.
This should not be instantiated directly, but should be subclassed for a specific
card should be used.
status: beta-version
Args:
name: name for this instrument
Expand Down Expand Up @@ -131,7 +137,7 @@ def __init__(
board_id: int = 1,
dll_path: str | None = None,
api: AlazarATSAPI | None = None,
**kwargs: Any,
**kwargs: Unpack[InstrumentBaseKWArgs],
) -> None:
super().__init__(name, **kwargs)
self.api = api or AlazarATSAPI(dll_path or self.dll_path)
Expand Down Expand Up @@ -871,26 +877,36 @@ def buffer_done_callback(self, buffers_completed: int) -> None:
pass


@deprecated(
"AlazarTech_ATS is deprecated, use AlazarTechATS instead.",
category=QCoDeSDeprecationWarning,
)
class AlazarTech_ATS(AlazarTechATS):
pass


class AcquisitionController(Instrument, AcquisitionInterface[Any], Generic[OutputType]):
"""
Compatibility class. The methods of :class:`AcquisitionController`
have been extracted. This class is the base class fro AcquisitionInterfaces
that are intended to be QCoDeS instruments at the same time.
"""

def __init__(self, name: str, alazar_name: str, **kwargs: Any):
def __init__(
self, name: str, alazar_name: str, **kwargs: Unpack[InstrumentBaseKWArgs]
):
"""
Args:
name: The name of the AcquisitionController
alazar_name: The name of the alazar instrument.
**kwargs: kwargs are forwarded to base class.
"""
super().__init__(name, **kwargs)
self._alazar: AlazarTech_ATS = self.find_instrument(
alazar_name, instrument_class=AlazarTech_ATS
self._alazar: AlazarTechATS = self.find_instrument(
alazar_name, instrument_class=AlazarTechATS
)

def _get_alazar(self) -> AlazarTech_ATS:
def _get_alazar(self) -> AlazarTechATS:
"""
returns a reference to the alazar instrument. A call to self._alazar is
quicker, so use that if in need for speed
Expand Down
Loading

0 comments on commit 0b64086

Please sign in to comment.