I've been stuck for a time now trying to get a real(floating point query) power measurement from a peak search(marker) on a FSW Rohde & Schwarz Spectrum Analyzer through Pyvisa. I tried almost every command mentioned in the user manual but I can only manage to obtain an integer value and when I print it in my VSCode terminal I can only see 21 dBm instead of 21.xx dBm.
I also tried to convert it to float data type but it's not working, do I need to configure something on the instrument or am I missing something else?
fsw = rm.open_resource("GPIB::15::INSTR")
fsw.write("DISP:TRAC ON")
fsw.write("*rst; status:preset; *cls")
fsw.write("SENS:FREQ:CENTER %d MHZ" %fc)
fsw.write("SENS:FREQ:SPAN %d MHZ" %span)
fsw.write("INP:ATT 20dB")
fsw.write("FSW,'SENS:BAND:RES %d HZ" %resBW)
fsw.write("SENSE:MARK:MAX:PEAK")
fsw.write("INIT:CONT:OFF")
fsw.write("CALC:MARK:FUNC:FPE:STAT ON")
fsw.write("CALC:MARK:FUNC:FPE:SORT Y")
print(fsw.write("SENS:MARK:MAX:PEAK?"), 'dBm')