Skip to content

Commit

Permalink
feat: Added USB support for AFG31K and MDO3 models (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
v12ganesh authored Oct 21, 2024
1 parent e69233a commit fb29ac3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ repos:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/PyCQA/docformatter
rev: dfefe062799848234b4cd60b04aa633c0608025e # frozen: v1.7.5
hooks:
- id: docformatter
additional_dependencies: [tomli]
# TODO: Re-enable this once https://github.com/PyCQA/docformatter/issues/293 is resolved
# - repo: https://github.com/PyCQA/docformatter
# rev: dfefe062799848234b4cd60b04aa633c0608025e # frozen: v1.7.5
# hooks:
# - id: docformatter
# additional_dependencies: [tomli]
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Things to be included in the next release go here.

---

### Added

- Added USB Support for AFG31K and MDO3 models.

## v2.4.0 (2024-09-19)

### Merged Pull Requests
Expand Down
6 changes: 6 additions & 0 deletions src/tm_devices/helpers/constants_and_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,9 @@ def __str__(self) -> str:
"""The USBTMC Vendor ID for Keithley devices."""
USB_MODEL_ID_LOOKUP: Final[Mapping[SupportedModels, USBTMCConfiguration]] = MappingProxyType(
{
SupportedModels.MDO3: USBTMCConfiguration(
vendor_id=TEKTRONIX_USBTMC_VENDOR_ID, model_id="0x052C"
),
SupportedModels.MDO3K: USBTMCConfiguration(
vendor_id=TEKTRONIX_USBTMC_VENDOR_ID, model_id="0x0408"
),
Expand Down Expand Up @@ -623,6 +626,9 @@ def __str__(self) -> str:
SupportedModels.AFG3K: USBTMCConfiguration(
vendor_id=TEKTRONIX_USBTMC_VENDOR_ID, model_id="0x0345"
),
SupportedModels.AFG31K: USBTMCConfiguration(
vendor_id=TEKTRONIX_USBTMC_VENDOR_ID, model_id="0x035E"
),
SupportedModels.SMU2450: USBTMCConfiguration(
vendor_id=KEITHLEY_USBTMC_VENDOR_ID, model_id="0x2450"
),
Expand Down
3 changes: 2 additions & 1 deletion src/tm_devices/helpers/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ def detect_visa_resource_expression(input_str: str) -> Optional[Tuple[str, str]]
filtered_usb_model_keys = [
key
for key, value in model_id_lookup.items()
if value.model_id == match_groups_list[1].lower()
# Model id also has an alpha character which needs to be converted to lowercase
if value.model_id.lower() == match_groups_list[1].lower()
]
if filtered_usb_model_keys:
# SMU and PSU need to be removed from the string to prevent issues
Expand Down
1 change: 1 addition & 0 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ def test_get_visa_backend() -> None:
("USB::0x05E6::0x2450::01419964::INSTR", ("USB", "2450-01419964")),
("USB::0x05E6::0x2450::01419964::inst0::INSTR", ("USB", "2450-01419964")),
("USB::0x05E6::0x2450::01419964::inst::INSTR", ("USB", "2450-01419964")),
("USB0::0x0699::0x035e::01419964::INSTR", ("USB", "AFG31K-01419964")),
("TCPIP0::SMU2450-HOSTNAME::INSTR", ("TCPIP", "SMU2450-HOSTNAME")),
("TCPIP::SMU2450-HOSTNAME::INSTR", ("TCPIP", "SMU2450-HOSTNAME")),
("TCPIP0::SMU2450-HOSTNAME::inst0::INSTR", ("TCPIP", "SMU2450-HOSTNAME")),
Expand Down

0 comments on commit fb29ac3

Please sign in to comment.