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

fix rigol dg4000 value mappings #6345

Merged
merged 6 commits into from
Sep 24, 2024
Merged
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
9 changes: 8 additions & 1 deletion src/qcodes/instrument_drivers/rigol/Rigol_DG4000.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
return s


def _parse_string_strip(s: str) -> str:
"""Parse an output of the VISA instrument, remove redundant terminators like \n"""
return s.strip()

Check warning on line 41 in src/qcodes/instrument_drivers/rigol/Rigol_DG4000.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/rigol/Rigol_DG4000.py#L41

Added line #L41 was not covered by tests


def parse_string_output(s: str) -> float | str:
"""Parse an output of the VISA instrument into either text of a number"""
s = clean_string(s)
Expand Down Expand Up @@ -238,13 +243,15 @@
ch + "output_polarity",
get_cmd=output + "POL?",
set_cmd=output + "POL {}",
val_mapping={"normal": "NORM", "inverted": "INV"},
konosubakonoakua marked this conversation as resolved.
Show resolved Hide resolved
get_parser=_parse_string_strip,
val_mapping={"normal": "NORMAL", "inverted": "INVERTED"},
konosubakonoakua marked this conversation as resolved.
Show resolved Hide resolved
)

self.add_parameter(
ch + "output_enabled",
get_cmd=output + "STAT?",
set_cmd=output + "STAT {}",
get_parser=_parse_string_strip,
val_mapping=on_off_map,
)

Expand Down
Loading