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

Improvements by Equal1 (station indexed param names; Rohde&Schwarz, Stahl, Stanford Research drivers) #5873

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions src/qcodes/dist/schemas/station-template.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"properties": {
"source": {
"type": "string",
"pattern": "^(\\w+)(\\.\\w+)*$"
"pattern": "^(\\w+(\\[\\d+\\])*)(\\.\\w+(\\[\\d+\\])*)*$"
},
"label": {
"type": "string"
Expand Down Expand Up @@ -112,7 +112,7 @@
"parameters": {
"type": "object",
"patternProperties": {
"^(\\w+)(\\.\\w+)*$": {
"^(\\w+(\\[\\d+\\])*)(\\.\\w+(\\[\\d+\\])*)*$": {
"type": "object",
"properties": {
"alias": {
Expand Down
86 changes: 84 additions & 2 deletions src/qcodes/instrument_drivers/rohde_schwarz/SGS100A.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ def __init__(self, name: str, address: str, **kwargs: Any) -> None:
get_cmd='SOUR:ROSC:EXT:FREQ?',
set_cmd='SOUR:ROSC:EXT:FREQ {}',
vals=vals.Enum('10MHz', '100MHz', '1000MHz'))

# IQ impairments
self.add_parameter('IQ_impairments',
label='IQ Impairments',
Expand Down Expand Up @@ -139,7 +138,90 @@ def __init__(self, name: str, address: str, **kwargs: Any) -> None:
set_cmd='SOUR:IQ:IMP:QUAD {:.2f}',
get_parser=float,
vals=vals.Numbers(-8, 8))

# Determines the signal at the input/output of the multi purpose [TRIG] connector.
self.add_parameter('trigger_connector_mode',
label='Trigger Connector Mode',
get_cmd='CONN:TRIG:OMOD?',
set_cmd='CONN:TRIG:OMOD {}',
vals=vals.Enum('SVAL', # SVALid - Signal valid
'SNVAL', # SNValid - Signal not valid
'PVO', # PVOut - Pulse video out (K22 Only)
'PET', # PETrigger - Pulse mod ext trigger - PETrigger (K22 Only)
'PEMS', # PEMSource - Pulse mode ext source (K22 Only)
'sval', 'snval', 'pvo', 'pet', 'pems'))
# Pulse modulator
self.add_parameter('pulsemod_delay',
label='Pulse delay',
unit="s",
get_cmd='SOUR:PULM:DEL?',
set_cmd='SOUR:PULM:DEL {:g}',
get_parser=float,
vals=vals.Numbers(0, 100))
self.add_parameter('pulsemod_double_delay',
label='Pulse double delay',
unit="s",
get_cmd='SOUR:PULM:DOUB:DEL?',
set_cmd='SOUR:PULM:DOUB:DEL {:g}',
get_parser=float,
vals=vals.Numbers(40e-9, 100))
self.add_parameter('pulsemod_double_width',
label='Double pulse second width',
unit="s",
get_cmd='SOUR:PULM:DOUB:WIDT?',
set_cmd='SOUR:PULM:DOUB:WIDT {:g}',
get_parser=float,
vals=vals.Numbers(20e-9, 100))
self.add_parameter('pulsemod_mode',
label='Pulse modulation mode',
get_cmd='SOUR:PULM:MODE?',
set_cmd='SOUR:PULM:MODE {}',
vals=vals.Enum('SING', 'DOUB',
'sing', 'doub',
'single', 'double'))
self.add_parameter('pulsemod_period',
label='Pulse mode period',
unit="s",
get_cmd='SOUR:PULM:PER?',
set_cmd='SOUR:PULM:PER {:g}',
get_parser=float,
vals=vals.Numbers(100e-9, 100))
self.add_parameter('pulsemod_polarity',
label='Pulse modulator signal polarity',
get_cmd='SOUR:PULM:POL?',
set_cmd='SOUR:PULM:POL {}',
vals=vals.Enum('NORM', 'INV', 'norm', 'inv',
'normal', 'inverted'))
self.add_parameter('pulsemod_trig_ext_gate_polarity',
label='Polarity of the Gate signal',
get_cmd='SOUR:PULM:TRIG:EXT:GATE:POL?',
set_cmd='SOUR:PULM:TRIG:EXT:GATE:POL {}',
vals=vals.Enum('NORM', 'INV', 'norm', 'inv',
'normal', 'inverted'))
self.add_parameter('pulsemod_trig_ext_impedance',
label='Impedance of the external pulse trigger',
get_cmd='SOUR:PULM:TRIG:EXT:IMP?',
set_cmd='SOUR:PULM:TRIG:EXT:IMP {}',
vals=vals.Enum('G50', 'G10K'))
# Sets the polarity of the active slope of an externally applied trigger signal.
self.add_parameter('pulsemod_trig_ext_slope',
label='external pulse trigger active slope',
get_cmd='SOUR:PULM:TRIG:EXT:SLOP?',
set_cmd='SOUR:PULM:TRIG:EXT:SLOP {}',
vals=vals.Enum('NEG', 'POS', 'neg', 'pos',
'negative', 'positive'))
self.add_parameter('pulsemod_trig_mode',
label='external pulse trigger active slope',
get_cmd='SOUR:PULM:TRIG:MODE?',
set_cmd='SOUR:PULM:TRIG:MODE {}',
vals=vals.Enum('AUTO', 'EXT', 'EGAT', 'auto', 'ext', 'egat',
'external', 'egate'))
self.add_parameter('pulsemod_width',
label='Pulse width',
unit="s",
get_cmd='SOUR:PULM:WIDT?',
set_cmd='SOUR:PULM:WIDT {:g}',
get_parser=float,
vals=vals.Numbers(20e-9, 100))
self.add_function('reset', call_cmd='*RST')
self.add_function('run_self_tests', call_cmd='*TST?')

Expand Down
17 changes: 11 additions & 6 deletions src/qcodes/instrument_drivers/stahl/stahl.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import numpy as np
from pyvisa.resources.serial import SerialInstrument
from pyvisa.resources.tcpip import TCPIPSocket

from qcodes.instrument import ChannelList, InstrumentChannel, VisaInstrument
from qcodes.validators import Numbers
Expand Down Expand Up @@ -62,11 +63,13 @@ def __init__(self, parent: VisaInstrument, name: str, channel_number: int):
self._channel_string = f"{channel_number:02d}"
self._channel_number = channel_number

FLOATING_POINT_RE = r"[+\-]?(?:[.,]\d+|\d+(?:[.,]\d*)?)(?:[eE][-+]?\d+)?"

self.add_parameter(
"voltage",
get_cmd=f"{self.parent.identifier} U{self._channel_string}",
get_parser=chain(
re.compile(r"^([+\-]\d+,\d+) V$").findall,
re.compile(f"^({FLOATING_POINT_RE})[ ]?V$").findall,
partial(re.sub, ",", "."),
float
),
Expand All @@ -82,7 +85,7 @@ def __init__(self, parent: VisaInstrument, name: str, channel_number: int):
"current",
get_cmd=f"{self.parent.identifier} I{self._channel_string}",
get_parser=chain(
re.compile(r"^([+\-]\d+,\d+) mA$").findall,
re.compile(f"^({FLOATING_POINT_RE})[ ]?mA$").findall,
partial(re.sub, ",", "."),
lambda ma: float(ma) / 1000 # Convert mA to A
),
Expand Down Expand Up @@ -115,7 +118,7 @@ def _set_voltage(self, voltage: float) -> None:

if response != self.acknowledge_reply:
self.log.warning(
f"Command {send_string} did not produce an acknowledge reply")
f"Command {send_string} did not produce an acknowledge reply\n response was: {response}")

def _get_lock_status(self) -> bool:
"""
Expand Down Expand Up @@ -149,9 +152,11 @@ class Stahl(VisaInstrument):

def __init__(self, name: str, address: str, **kwargs: Any):
super().__init__(name, address, terminator="\r", **kwargs)
assert isinstance(self.visa_handle, SerialInstrument)

self.visa_handle.baud_rate = 115200
if isinstance(self.visa_handle, TCPIPSocket):
pass # allow connection to remote serial device
else:
assert isinstance(self.visa_handle, SerialInstrument)
self.visa_handle.baud_rate = 115200

instrument_info = self.parse_idn_string(
self.ask("IDN")
Expand Down
Loading