Keysight N5222B (PNA) Driver - #14
Open
swadhinadas wants to merge 6 commits into
Open
Conversation
marcosfrenkel
requested changes
Jun 30, 2026
marcosfrenkel
left a comment
Contributor
There was a problem hiding this comment.
This seems to be a little excessive, we are simply extending the PNA driver to add new functionality (at least to my eye). Wouldn't simply adding a new file that looks like this do the trick?
from typing import Any
from qcodes.instrument_drivers.Keysight.Keysight_N5222B import KeysightN5222B as _KeysightN5222B
class KeysightN5222B(_KeysightN5222B):
def set_port_freq(self, range_no: int, start_freq: float, stop_freq: float) -> None:
self.write(f"SENS:FOM:RANG{range_no}:FREQ:STAR {start_freq}")
self.write(f"SENS:FOM:RANG{range_no}:FREQ:STOP {stop_freq}")
def set_port(self, port: int, state: str) -> None:
self.write(f":SOUR1:POW{port}:MODE {state}")
def set_port_power(self, port: int, power: float) -> None:
self.write("SOUR:POW:COUP OFF")
self.write(f":SOUR:POW{port} {power:f}")
self.set_port(port, "ON")
def level_ports_to_open_loop(self, port: int) -> None:
# Required for pulse modulated measurements — prevents ALC from
# trying to level against pulsed power, which causes source unleveled errors.
self.write(f"SOUR1:POW{port}:ALC:MODE OPEN")
def set_FOM(self, state: int) -> None:
self.write(f"SENS:FOM:STAT {state}")
def set_coupling(self, range_no: int, state: str) -> None:
self.write(f"SENS:FOM:RANG{range_no}:COUP {state}")
def set_freq_coupling(self, range_no: int, state: int) -> None:
self.write(f"SENS:FOM:RANG{range_no}:FREQ:COUP {state}")
def set_pulse(self, pulse: int, state: int) -> None:
self.write(f"SENS:PULS{pulse} {state}")
def set_inverting(self, pulse: int, state: int) -> None:
self.write(f"SENS:PULS{pulse}:INV {state}")
def set_pulse_width(self, pulse: int, width: float) -> None:
self.write(f"SENS:PULS{pulse}:WIDT {width:.12f}")
def set_pulse_delay(self, pulse: int, delay: float) -> None:
self.write(f"SENS:PULS{pulse}:DEL {delay:.12f}")
def set_expt_period(self, time: float) -> None:
self.write(f"SENS:PULS:PER {time:.12f}")
def get_range_dict(self) -> dict[str, int]:
names = self.ask("SENS:FOM:CAT?").replace('"', "").split(",")
return {name: int(self.ask(f'SENS:FOM:RNUM? "{name}"')) for name in names}| will try to level the source with the detected power level during the | ||
| pulse ON and OFF states, causing a source-unleveled error. | ||
| """ | ||
| self.write(f"SOUR1:POW{port}:ALC:MODE OPEN") |
Contributor
There was a problem hiding this comment.
Why the inconsistency between line 36 and this? (the "SOUR:POW:COUP OFF" and "SOUR1:POW...") Why are you specifying 1 in some and not others?
Author
There was a problem hiding this comment.
According to PNAX SCPI code SOUR is set to 1 if unspecified, so both should be the same.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.