Test and measurement

How to automatically transfer IQ-data from FSVR Spectrum Analyzer to VSE software

Question

This simple Python example shows how to tranfer an IQ-data file from Spectrum Analyzer to the controller PC and open it with VSE signal analysis software. Tested with FSVR Real-Time Spectrum Analyzer.

R&S FSVR Real-Time Spectrum Analyzer
https://www.rohde-schwarz.com/product/fsvr-productstartpage_63493-11047.html

R&S VSE signal analysis software
https://www.rohde-schwarz.com/product/vse-productstartpage_63493-124109.html

Answer

import pyvisa

rm = pyvisa.ResourceManager()
instr = rm.open_resource('TCPIP::10.205.0.82::INSTR')
instr.timeout = 10*1000

vse = rm.open_resource('TCPIP::127.0.0.1::INSTR')
vse.timeout = 10*1000

vse.write('*RST')
instr.write('*RST')
instr.write('*CLS')

print(instr.query('*IDN?'))

instr.write('FREQ:CENT 1e9')

instr.write('INIT:CONT OFF')

instr.write('TRACe1:IQ ON')
instr.write('TRACe1:IQ:SRAT 32 MHZ')
instr.write('TRACe1:IQ:RLEN 691') # Range: 1 ... 209715200(200*1024*1024)

instr.write('INIT')
instr.query('*OPC?')

print(instr.query('SYST:ERR?'))

# save IQ-data file on instrument hard drive
instr.write('MMEM:STOR:IQ:STAT 1, \'C:\\temp\\data.iq.tar\'')

PCfilePath = r'c:\Temp\data.iq.tar'
query = 'MMEM:DATA? \'c:\\temp\\data.iq.tar\''

# ask for file data from instrument and save to local hard drive
fileData = instr.query_binary_values(query, datatype='s')[0]
newFile = open(PCfilePath, "wb")
newFile.write(fileData)
newFile.close()

instr.close()

# load file into VSE software
vse.write('MMEM:LOAD:IQ:STAT 1, \'C:\\temp\\data.iq.tar\'')

vse.close()

Related Product Groups and Solutions