@@ -494,7 +494,7 @@ def _set_trigger(self, trigger: str) -> None:
494
494
self .write ("TRIG:SOUR " + trigger .upper ())
495
495
496
496
def get_s (
497
- self ,
497
+ self , expected_measurement_duration : float = 600
498
498
) -> tuple [
499
499
np .ndarray ,
500
500
np .ndarray ,
@@ -509,6 +509,9 @@ def get_s(
509
509
"""
510
510
Return all S parameters as magnitude in dB and phase in rad.
511
511
512
+ Args:
513
+ expected_measurement_duration: Expected duration of the measurement in seconds.
514
+
512
515
Returns:
513
516
Tuple[np.ndarray]: frequency [GHz],
514
517
s11 magnitude [dB], s11 phase [rad],
@@ -518,17 +521,18 @@ def get_s(
518
521
519
522
"""
520
523
521
- self .write ("CALC1:PAR:COUN 4" ) # 4 trace
522
- self .write ("CALC1:PAR1:DEF S11" ) # Choose S11 for trace 1
523
- self .write ("CALC1:PAR2:DEF S12" ) # Choose S12 for trace 2
524
- self .write ("CALC1:PAR3:DEF S21" ) # Choose S21 for trace 3
525
- self .write ("CALC1:PAR4:DEF S22" ) # Choose S22 for trace 4
526
- self .write ("CALC1:TRAC1:FORM SMITH" ) # Trace format
527
- self .write ("CALC1:TRAC2:FORM SMITH" ) # Trace format
528
- self .write ("CALC1:TRAC3:FORM SMITH" ) # Trace format
529
- self .write ("CALC1:TRAC4:FORM SMITH" ) # Trace format
530
- self .write ("TRIG:SEQ:SING" ) # Trigger a single sweep
531
- self .ask ("*OPC?" ) # Wait for measurement to complete
524
+ with self .timeout .set (max (self .timeout (), expected_measurement_duration )):
525
+ self .write ("CALC1:PAR:COUN 4" ) # 4 trace
526
+ self .write ("CALC1:PAR1:DEF S11" ) # Choose S11 for trace 1
527
+ self .write ("CALC1:PAR2:DEF S12" ) # Choose S12 for trace 2
528
+ self .write ("CALC1:PAR3:DEF S21" ) # Choose S21 for trace 3
529
+ self .write ("CALC1:PAR4:DEF S22" ) # Choose S22 for trace 4
530
+ self .write ("CALC1:TRAC1:FORM SMITH" ) # Trace format
531
+ self .write ("CALC1:TRAC2:FORM SMITH" ) # Trace format
532
+ self .write ("CALC1:TRAC3:FORM SMITH" ) # Trace format
533
+ self .write ("CALC1:TRAC4:FORM SMITH" ) # Trace format
534
+ self .write ("TRIG:SEQ:SING" ) # Trigger a single sweep
535
+ self .ask ("*OPC?" ) # Wait for measurement to complete
532
536
533
537
# Get data as string
534
538
freq_raw = self .ask ("SENS1:FREQ:DATA?" )
0 commit comments