AnsweredAssumed Answered

Stepped Sweep Power Measurement

Question asked by alex008 on May 3, 2019

I am currently trying to do a stepped sweep with a 8164B TLS and am using an N7744A PM to record the power measurements at each step.  The TLS appears to be sending out a trigger to the PM at each step. However, the PM is not triggering for each measurement.  I'm only receiving one in my output file.  I'm using pyVisa. I'm not sure if the PM is not triggering at each step or if I'm supposed to use something other than fetch to be able to get all the values. I'm really new at this.


My code is as follows:


import visa
import time


#open connection to laser and power meter
rm = visa.ResourceManager()
laser = rm.open_resource('GPIB0::20::INSTR', read_termination='\n')
keysight = rm.open_resource('USB0::0X0957::0X3718::MY48102366::INSTR', read_termination='\n')


laser.timeout = 10000
keysight.timeout = 10000




#set laser to step
laser.write(":SOURce:CHAN:WAVelength:SWEep:MODE STEP")


#set laser start and stop wavelength
laser.write(":SOURce:CHAN:WAVelength:SWEep:STARt 1540NM")
laser.write(":SOURce:CHAN:WAVelength:SWEep:STOP 1560NM")


#set laser to step at .05nm increments
laser.write(":SOURce:CHAN:WAVelength:SWEep:STEP .05NM")


#dwell time 
laser.write(":SOURce:CHAN:WAVelength:SWEep:DWELI .1S")


#every stepped sweep cycle begins at the start wavelength and ends at stop
laser.write(":SOURce:CHAN:WAVelength:SWEep:REP ONEway")


#set incoming trigger response and arm module for single measurement
keysight.write(":TRIG:CHAN:INPut SMEasure")


#sense power measurement in watts
keysight.write(":SENS:POW:STATE 1")


query_info = keysight.query(":FETCh:CHANnel:SCALar:POW:ALL:CSV?")


#activate the step sweep
laser.write(":SOURce:CHAN:WAVelength:SWEep STARt")


#output results to text file
with open('some_text_file.txt', 'a') as output:
   output.write(query_info + "\n")


#close connections to laser and power meter