Skip to content

Commit

Permalink
Merge pull request #6035 from spauka/spauka/Keysight_PNA_Trace
Browse files Browse the repository at this point in the history
Add trace manipulation commands to Keysight PNA driver
  • Loading branch information
jenshnielsen authored May 3, 2024
2 parents 9543b9e + 6efabb5 commit c125bea
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/changes/newsfragments/6035.improved_driver
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adds trace manipulation commands to the Keysight PNA driver.
30 changes: 30 additions & 0 deletions src/qcodes/instrument_drivers/Keysight/N52xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ def __init__(
vals=Arrays(shape=(self.parent.points,), valid_types=(complex,)),
)

def disable(self) -> None:
"""
Disable this trace on the PNA
"""
self.write(f"DISP:TRAC{self.trace_num}:STAT 0")

@staticmethod
def _parse_polar_data(data: np.ndarray) -> np.ndarray:
"""
Expand Down Expand Up @@ -642,6 +648,30 @@ def get_options(self) -> "Sequence[str]":
# Query the instrument for what options are installed
return self.ask('*OPT?').strip('"').split(',')

def add_trace(self) -> KeysightPNATrace:
"""
Add a new trace to the instrument and return it
"""
existing_traces = [tr.trace_name for tr in self.traces]
self.write("DISP:TRAC:NEW 0")
time.sleep(0.5)
for new_trace, old_trace in zip(self.traces, existing_traces):
if new_trace.trace_name != old_trace:
return new_trace
raise RuntimeError("Failed to add PNA trace")

def enable_trace(self, trace_num: int) -> KeysightPNATrace:
"""
Enable a trace given by trace_num and return it. Note, if the trace is
already enabled, we simply return it.
"""
self.write(f"DISP:TRAC{trace_num}:STAT 1")
time.sleep(0.5)
for trace in self.traces:
if trace.trace_num == trace_num:
return trace
raise RuntimeError(f"Failed to enable PNA trace tr{trace_num}")

def get_trace_catalog(self) -> str:
"""
Get the trace catalog, that is a list of trace and sweep types
Expand Down

0 comments on commit c125bea

Please sign in to comment.