Skip to content

Commit

Permalink
Allow FloatCommands to have per-instance formatters. For high-resolut…
Browse files Browse the repository at this point in the history
…ion parameters like VNA frequencies
  • Loading branch information
Martin Gustafsson committed Aug 28, 2024
1 parent c8cd99c commit 76c16ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/auspex/instruments/agilent.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,9 @@ class _AgilentNetworkAnalyzer(SCPIInstrument):

##Basic SCPI commands.
frequency_center = FloatCommand(scpi_string=":SENSe:FREQuency:CENTer")
frequency_start = FloatCommand(scpi_string=":SENSe:FREQuency:STARt")
frequency_stop = FloatCommand(scpi_string=":SENSe:FREQuency:STOP")
frequency_span = FloatCommand(scpi_string=":SENSe:FREQuency:SPAN")
frequency_start = FloatCommand(scpi_string=":SENSe:FREQuency:STARt", formatter="{:.0f}")
frequency_stop = FloatCommand(scpi_string=":SENSe:FREQuency:STOP", formatter="{:.0f}")
frequency_span = FloatCommand(scpi_string=":SENSe:FREQuency:SPAN", formatter="{:.0f}")
if_bandwidth = FloatCommand(scpi_string=":SENSe1:BANDwidth")
num_points = IntCommand(scpi_string=":SENSe:SWEep:POINTS")

Expand Down Expand Up @@ -788,9 +788,10 @@ def output_enable(self, outp):
the port being in `OFF` mode, while `True` corresponds to the port being in `AUTO` mode.
"""
if isinstance(outp, dict):
for k, v in self.outp.items():
for k, v in outp.items():
val = "AUTO" if v else "OFF"
self.interface.write(f"SOUR:POW{k}:MODE {val}")
self.interface.write(f" {val}")
print(f"Setting port {k} to {val}")
else:
val = "AUTO" if outp else "OFF"
for p in self.ports:
Expand Down
3 changes: 3 additions & 0 deletions src/auspex/instruments/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def parse(self):
setattr(self, a, self.kwargs.pop(a))
else:
setattr(self, a, None) # Default to None
# Permit overiding the 'formatter' but keep the one defined as class variable if none is given
if 'formatter' in self.kwargs:
self.formatter = self.kwargs.pop('formatter')

if 'doc' in self.kwargs:
self.doc = self.kwargs.pop('doc')
Expand Down

0 comments on commit 76c16ff

Please sign in to comment.