Skip to content

Keysight N5222B (PNA) Driver - #14

Open
swadhinadas wants to merge 6 commits into
toolsforexperiments:mainfrom
swadhinadas:PNA-driver
Open

Keysight N5222B (PNA) Driver#14
swadhinadas wants to merge 6 commits into
toolsforexperiments:mainfrom
swadhinadas:PNA-driver

Conversation

@swadhinadas

Copy link
Copy Markdown

No description provided.

@marcosfrenkel marcosfrenkel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to PNAX SCPI code SOUR is set to 1 if unspecified, so both should be the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants