Skip to content

Commit

Permalink
Add parameters related to reference oscillator to ZNB driver
Browse files Browse the repository at this point in the history
  • Loading branch information
Márton Gunyhó committed Aug 15, 2024
1 parent 99ca0cf commit 5fcfd99
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,54 @@ def __init__(
val_mapping={True: "1\n", False: "0\n"},
)
"""Parameter rf_power"""

self.ref_osc_source: Parameter = self.add_parameter(

Check warning on line 1069 in src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py#L1069

Added line #L1069 was not covered by tests
name="ref_osc_source",
label="Reference oscillator source",
get_cmd="ROSC:SOUR?",
set_cmd="ROSC:SOUR {}",
# strip newline
get_parser=lambda s: s.rstrip(),
vals=vals.Enum("INT", "EXT", "int", "ext", "internal", "external"),
)
"""Reference oscillator source"""

Check warning on line 1078 in src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py#L1078

Added line #L1078 was not covered by tests

self.ref_osc_external_freq: Parameter = self.add_parameter(

Check warning on line 1080 in src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py#L1080

Added line #L1080 was not covered by tests
name="ref_osc_external_freq",
label="Reference oscillator frequency",
docstring="Frequency of the external reference clock signal at REF IN",
get_cmd="ROSC:EXT:FREQ?",
set_cmd="ROSC:EXT:FREQ {}Hz",
# The response contains the unit (Hz), so we have to strip it
get_parser=lambda f: float(f.strip("Hz")),
unit="Hz",
# Data sheet: 1 MHz to 20 MHz, in steps of 1 MHz
vals=vals.Enum(*np.linspace(1e6, 20e6, 20)),
)
"""Frequency of the external reference clock signal at REF IN"""

Check warning on line 1092 in src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py#L1092

Added line #L1092 was not covered by tests

self.ref_osc_PLL_locked: Parameter = self.add_parameter(

Check warning on line 1094 in src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py#L1094

Added line #L1094 was not covered by tests
name="ref_osc_PLL_locked",
label="Reference frequency PLL lock",
get_cmd=self._get_PLL_locked,
docstring="If an external reference signal or an internal high "
"precision clock (option B4) is used, the local oscillator is "
"phase locked to a reference signal. This parameter will be "
"False if the phase locked loop (PLL) fails. "
"\n"
"For external reference: check frequency and level of the "
"supplied reference signal.",
)
"""

Check warning on line 1106 in src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py#L1106

Added line #L1106 was not covered by tests
If an external reference signal or an internal high precision clock
(option B4) is used, the local oscillator is phase locked to a
reference signal. This parameter will be False if the phase locked loop
(PLL) fails.
For external reference: check frequency and level of the supplied
reference signal.
"""

self.add_function("reset", call_cmd="*RST")
self.add_function("tooltip_on", call_cmd="SYST:ERR:DISP ON")
self.add_function("tooltip_off", call_cmd="SYST:ERR:DISP OFF")
Expand Down Expand Up @@ -1105,6 +1153,13 @@ def __init__(
self.rf_off()
self.connect_message()

def _get_PLL_locked(self) -> bool:
# query the bits of the "questionable hardware integrity" register
hw_integrity_bits = int(self.ask("STATus:QUEStionable:INTegrity:HARDware?"))

Check warning on line 1158 in src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py#L1158

Added line #L1158 was not covered by tests
# if bit number 1 is set, the PLL locking has failed
pll_lock_failed = bool(hw_integrity_bits & 0b10)
return not pll_lock_failed

Check warning on line 1161 in src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py

View check run for this annotation

Codecov / codecov/patch

src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py#L1160-L1161

Added lines #L1160 - L1161 were not covered by tests

def display_grid(self, rows: int, cols: int) -> None:
"""
Display a grid of channels rows by columns.
Expand Down

0 comments on commit 5fcfd99

Please sign in to comment.