@@ -493,6 +493,21 @@ def _set_trigger(self, trigger: str) -> None:
493
493
"""
494
494
self .write ("TRIG:SOUR " + trigger .upper ())
495
495
496
+ def _set_trace_formats_to_smith (self , traces : list [int ]) -> None :
497
+ """
498
+ Sets the format of the specified traces to SMITH (real + imaginary).
499
+
500
+ Args:
501
+ traces: A list of trace indices to set the format for.
502
+
503
+ Returns:
504
+ None
505
+
506
+ """
507
+
508
+ for trace in traces :
509
+ self .write (f"CALC1:TRAC{ trace } :FORM SMITH" )
510
+
496
511
def get_s (
497
512
self , expected_measurement_duration : float = 600
498
513
) -> tuple [
@@ -527,10 +542,7 @@ def get_s(
527
542
self .write ("CALC1:PAR2:DEF S12" ) # Choose S12 for trace 2
528
543
self .write ("CALC1:PAR3:DEF S21" ) # Choose S21 for trace 3
529
544
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
545
+ self ._set_trace_formats_to_smith (traces = [1 , 2 , 3 , 4 ])
534
546
self .write ("TRIG:SEQ:SING" ) # Trigger a single sweep
535
547
self .ask ("*OPC?" ) # Wait for measurement to complete
536
548
@@ -685,7 +697,7 @@ def get_raw(self) -> tuple[ParamRawDataType, ParamRawDataType]:
685
697
self .instrument .ask ("*OPC?" ) # Wait for measurement to complete
686
698
687
699
# get data from instrument
688
- self .instrument .write ( "CALC1:TRAC1:FORM SMITH" ) # ensure correct format
700
+ self .instrument ._set_trace_formats_to_smith ( traces = [ 1 ] ) # ensure correct format
689
701
sxx_raw = self .instrument .ask ("CALC1:TRAC1:DATA:FDAT?" )
690
702
self .instrument .write ("CALC1:TRAC1:FORM MLOG" )
691
703
@@ -770,7 +782,7 @@ def get_raw(self) -> tuple[ParamRawDataType, ParamRawDataType]:
770
782
self .instrument .ask ("*OPC?" ) # Wait for measurement to complete
771
783
772
784
# get data from instrument
773
- self .instrument .write ( "CALC1:TRAC1:FORM SMITH" ) # ensure correct format
785
+ self .instrument ._set_trace_formats_to_smith ( traces = [ 1 ] ) # ensure correct format
774
786
sxx_raw = self .instrument .ask ("CALC1:TRAC1:DATA:FDAT?" )
775
787
776
788
# Get data as numpy array
@@ -856,7 +868,7 @@ def get_raw(self) -> tuple[ParamRawDataType, ParamRawDataType]:
856
868
self .instrument .ask ("*OPC?" ) # Wait for measurement to complete
857
869
858
870
# get data from instrument
859
- self .instrument .write ( "CALC1:TRAC1:FORM SMITH" ) # ensure correct format
871
+ self .instrument ._set_trace_formats_to_smith ( traces = [ 1 ] ) # ensure correct format
860
872
sxx_raw = self .instrument .ask ("CALC1:TRAC1:DATA:FDAT?" )
861
873
862
874
# Get data as numpy array
0 commit comments