Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ repos:
- id: check-yaml
- id: debug-statements
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.11.0
rev: 26.3.1
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 7.0.0
rev: 8.0.1
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.1
rev: v3.21.2
hooks:
- id: pyupgrade
- repo: https://github.com/hadialqattan/pycln
Expand All @@ -29,14 +29,14 @@ repos:
- --config=pyproject.toml
- --all
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v21.1.5
rev: v22.1.1
hooks:
- id: clang-format
- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0 # pick a git hash / tag to point to
hooks:
- id: pydocstyle
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
rev: v2.4.2
hooks:
- id: codespell
8 changes: 8 additions & 0 deletions docs/source/instruments/RSZNB.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Functions
- select_trace()
- delete_trace()
- list_trace()
- read_times()

Properties
------------
Expand All @@ -53,3 +54,10 @@ Properties
- smoothing
- IFBW
- power
- time_domain
- t_min
- t_max
- time_domain_window
- harmonic_grid
- low_pass_extrapolation
- low_pass_stimulus
6 changes: 3 additions & 3 deletions docs/source/instruments/VALON519.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Properties
----------

- mode
- freq
- f_fixed
- freq_offset
- freq_step
- sweep_start
Expand All @@ -44,8 +44,8 @@ Properties
- sweep_rtime
- sweep_tmode
- list_entry (setter only; getter raises `NotImplementedError`)
- power
- power_oen
- p_fixed
- rf_status
- power_pdn
- am_modulation
- am_frequency
Expand Down
8 changes: 4 additions & 4 deletions src/qtics/instruments/network/RS_FSV3030.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ def detector(self, mode: str = "POS"):
@property
def sweep_points(self) -> int:
"""Number of sweep points."""
return int(self.query("SWE:POIN?"))
return int(self.query("SWE:POIN?")) # codespell:ignore

@sweep_points.setter
def sweep_points(self, n: int):
n = self.validate_range(n, 101, 10001)
self.write(f"SWE:POIN {n}")
self.write(f"SWE:POIN {n}") # codespell:ignore

@property
def sweep_time(self) -> float:
Expand Down Expand Up @@ -156,7 +156,7 @@ def ref_level(self, level: float):
def read_trace_data(self, trace: int = 1) -> np.ndarray:
"""Read trace data (in dBm) as a numpy array."""
self.single_sweep()
data = query_data(self, f"TRAC? TRACE{trace}")
data = query_data(self, f"TRAC? TRACE{trace}", datatype="ASC,0")
return data

def read_freqs(self) -> np.ndarray:
Expand Down Expand Up @@ -207,5 +207,5 @@ def read_max_hold(self, trace: int = 1) -> np.ndarray:
"""Acquire the current max-hold trace data."""
self.set_max_hold(trace)
# optional: wait for a few sweeps if needed to build the max-hold
data = query_data(self, f"TRAC? TRACE{trace}")
data = query_data(self, f"TRAC? TRACE{trace}", datatype="ASC,0")
return data
92 changes: 92 additions & 0 deletions src/qtics/instruments/network/RS_ZNB.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@ def s_par(self, par="S21"):
"S42",
"S43",
"S44",
"Z-S11",
"Z-S21",
"Z-S12",
"Z-S22",
"Y-S11",
"Y-S21",
"Y-S12",
"Y-S22",
)
if not any(par.upper().startswith(sp) for sp in valid_spars):
log.warning(f"S-parameter {par} may not be supported. Continuing anyway.")
Expand Down Expand Up @@ -415,3 +423,87 @@ def list_traces(self):
traces = response.split(",")
return [(traces[i], traces[i + 1]) for i in range(0, len(traces), 2)]
return []

@property
def time_domain(self) -> str:
"""Get time domain mode status."""
return str(self.query(f"CALCulate{self._channel}:TRANsform:TIME:STATe?"))

@time_domain.setter
def time_domain(self, state: str | bool):

if state in (True, 1, "True", "ON"):
state = "ON"
elif state in (False, 0, "False", "OFF"):
state = "OFF"
self.validate_opt(state, ("ON", "OFF"))
self.write(f"CALCulate{self._channel}:TRANsform:TIME:STATe {state}")

@property
def t_min(self) -> float:
"""Minimum measured time."""
return float(self.query(f"CALCulate{self._channel}:TRANsform:TIME:STARt?"))

@t_min.setter
def t_min(self, t_min: float):
self.write(f"CALCulate{self._channel}:TRANsform:TIME:STARt {t_min}")

@property
def t_max(self) -> float:
"""Maximum measured time."""
return float(self.query(f"CALCulate{self._channel}:TRANsform:TIME:STOP?"))

@t_max.setter
def t_max(self, t_max: float):
self.write(f"CALCulate{self._channel}:TRANsform:TIME:STOP {t_max}")

def read_times(self) -> np.ndarray:
"""Read time domain x axis."""
return np.linspace(self.t_min, self.t_max, self.sweep_points)

@property
def time_domain_window(self) -> str:
"""Window shape used to process frequency into time domain data."""
return str(self.query(f"CALCulate{self._channel}:TRANsform:TIME:WINDow?"))

@time_domain_window.setter
def time_domain_window(self, window: str):
self.validate_opt(window, ("RECT", "HANN", "HAMM", "BOHM", "DCH"))
self.write(f"CALCulate{self._channel}:TRANsform:TIME:WINDOW {window}")

@property
def harmonic_grid(self) -> str:
"""Status of automatic harmonic grid for step response time domain measurements."""
return str(self.query(f"SENSe{self._channel}:HARMonic:AUTO?"))

@harmonic_grid.setter
def harmonic_grid(self, state: str | bool):
if state in (True, 1, "True", "ON"):
state = "ON"
elif state in (False, 0, "False", "OFF"):
state = "OFF"
self.validate_opt(state, ("ON", "OFF"))
self.write(f"SENSe{self._channel}:HARMonic:AUTO {state}")

@property
def low_pass_extrapolation(self) -> float:
"""Reflection coefficient extrapolation at 0 frequency."""
return float(
self.query(f"CALCulate{self._channel}:TRANsform:TIME:LPASs:DCSParam?")
)

@low_pass_extrapolation.setter
def low_pass_extrapolation(self, low_pass_extrapolation: float):
self.write(
f"CALCulate{self._channel}:TRANsform:TIME:LPASs:DCSParam {self.validate_range(low_pass_extrapolation, -1, 1)}"
)

@property
def low_pass_stimulus(self) -> str:
"""Shape of the low pass time domain probe."""
return self.query(f"CALCulate{self._channel}:TRANsform:TIME:STIM?")

@low_pass_stimulus.setter
def low_pass_stimulus(self, low_pass_stimulus: str):
self.validate_opt(low_pass_stimulus, ("STEP", "IMP"))
self.write(f"CALCulate{self._channel}:TRANsform:TIME:STIM {low_pass_stimulus}")
38 changes: 20 additions & 18 deletions src/qtics/instruments/serial/valon_5019.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ def mode(self, mode_to_set):
self.write(f"MOD {mode_to_set}")

@property
def freq(self):
def f_fixed(self):
"""Output signal frequency in Hz."""
res = self.query("F")
return self.freq_result_to_hz(res)

@freq.setter
def freq(self, freq: float):
@f_fixed.setter
def f_fixed(self, freq: float):
"""Set signal frequency in Hz."""
freq = self.validate_range(freq, 10e6, 15e9)
freq = self.validate_range(freq, 10e6, 20e9)
self.write(f"F{freq}Hz")

@property
Expand Down Expand Up @@ -223,27 +223,28 @@ def list_entry(self, frequencies, powers=None):
self.write("SAVE")

@property
def power(self):
def p_fixed(self):
"""Power of the output in dBm."""
return float(self.query("PWR")[0])

@power.setter
def power(self, pow_to_set):
@p_fixed.setter
def p_fixed(self, pow_to_set):
pow_to_set = self.validate_range(pow_to_set, -50, 20)
self.write(f"PWR {pow_to_set}")

@property
def power_oen(self):
def rf_status(self):
"""Enable or disable the RF output buffer amplifiers while leaving the synthesizer PLL locked."""
return self.query("OEN")[0] == "1"

@power_oen.setter
def power_oen(self, value):
if value in (True, 1, "True"):
self.write(f"OEN 1")
elif value in (False, 0, "False"):
self.write(f"OEN 0")
raise ValueError(f"Value {value} not supported.")
return "ON" if self.query("OEN")[0] == "1" else "OFF" # codespell:ignore

@rf_status.setter
def rf_status(self, value):
if value in (True, 1, "True", "ON"):
self.write(f"OEN 1") # codespell:ignore
elif value in (False, 0, "False", "OFF"):
self.write(f"OEN 0") # codespell:ignore
else:
raise ValueError(f"Value {value} not supported.")

@property
def power_pdn(self):
Expand All @@ -256,7 +257,8 @@ def power_pdn(self, value):
self.write(f"PDN 1")
elif value in (False, 0, "False"):
self.write(f"PDN 0")
raise ValueError(f"Value {value} not supported.")
else:
raise ValueError(f"Value {value} not supported.")

@property
def am_modulation(self):
Expand Down
Loading