Tutorial

How to Batch Process Touchstone SNP Files

Batch process multiple S-parameter files: convert DB/MA/RI formats, remap ports, resample frequency, extract S2P from S4P, and export to CSV. Complete workflow guide.

When You Need Batch SNP Processing

RF engineers accumulate hundreds of Touchstone files from VNA measurements, EM simulations, and component datasheets. Common batch operations include:

  • Format conversion: Tools export in different formats (some in MA, others in DB or RI). Mixing formats causes overlay comparison errors.
  • Port remapping: VNA fixture port order doesn't match schematic port convention
  • Frequency resampling: Two files have different frequency grids — cannot directly compare or cascade
  • S4P slicing: Differential-to-common-mode S4P needs to be sliced to port-pair S2P for single-ended analysis
  • CSV export: Non-RF tools (Excel, Python) can't read Touchstone — need to convert to CSV

Step 1: Format Conversion (DB ↔ MA ↔ RI)

  DB format: magnitude in dB + angle in degrees
    Line: freq  S11_dB  S11_ang  S21_dB  S21_ang  S12_dB  S12_ang  S22_dB  S22_ang

  RI format: real + imaginary parts
    Line: freq  S11_re  S11_im  S21_re  S21_im  ...

  MA format: linear magnitude + angle
    Line: freq  S11_mag  S11_ang  ...

  Conversion DB→RI:
    mag_linear = 10^(S_dB/20)
    re = mag_linear · cos(ang°·π/180)
    im = mag_linear · sin(ang°·π/180)

In RF View Batch Converter: select all source files, choose target format, tap Convert. All files are rewritten with the new options line and data format in the same batch.

Step 2: Port Remapping

  VNA physical port order: Port1=A, Port2=B (fixture A–B)
  Desired schematic order: Port1=Input, Port2=Output

  If VNA measured: P1=Output, P2=Input
  Need to swap S21↔S12 and S11↔S22:
    New S11 = old S22
    New S22 = old S11
    New S21 = old S12
    New S12 = old S21

  For S4P (duplexer): may need complete 4×4 matrix permutation
  RF View Port Change: select port mapping from dropdown menu

Step 3: Frequency Resampling

  File A: 100 MHz to 3 GHz, 201 points (linear)
  File B: 700 MHz to 6 GHz, 501 points (logarithmic)

  To compare or cascade them, resample to a common grid:
  Target: 700 MHz to 3 GHz, 500 points, linear spacing
  Method: linear or cubic interpolation of S-parameter real/imaginary parts
           (NOT dB values — interpolate RI, then convert if needed)

  RF View Frequency Change: set start, stop, number of points → Apply to all files

Step 4: SxP to S2P Extraction

  S4P file (4-port duplexer): ports 1=TX, 2=RX, 3=ANT, 4=GND
  Extract TX→ANT path: S31 from S4P → save as S2P with port1=TX, port2=ANT

  S3P file (3-port power divider): port1=IN, port2=OUT1, port3=OUT2
  Extract IN→OUT1: S21 from S3P → save as S2P

  RF View: select source port pair, extract to new .s2p file for single-path analysis

Step 5: Batch Export to CSV

  Wide CSV format (one row per frequency, all S-parameters as columns):
  Freq_GHz, S11_dB, S11_ang, S21_dB, S21_ang, S12_dB, S12_ang, S22_dB, S22_ang
  1.000,   -0.45, 168.2,  -15.3, -47.6,  -38.2, -51.2,  -0.62, 163.4
  ...

  Summary CSV (one row per file — bandwidth, IL, rejection):
  Filename, f0_GHz, IL_dB, BW3dB_MHz, Rejection_dB, S11_min_dB
  filter_A.s2p, 1.815, 1.8, 40.5, 52.3, -15.2
  filter_B.s2p, 1.817, 2.1, 38.9, 48.7, -13.6
RF View Batch Converter: Select any number of SNP files, then apply format conversion, port remapping, frequency resampling, and SxP slicing — all in one operation. Export to CSV for further analysis in Excel or Python. Available on Android without a PC.

Related Topics

← Back to Tutorial  ·  RF View Home