Newport Power Meter 2935T-C - Serial Connection via Python

First start of a Python module that makes use of PySerial to communicate with the Newport Power Meter 2935T-C via a serial connection:

#!/usr/bin/env python

########## Newport Power Meter 2935T-C #############
# Manual: <ftp://download.newport.com/Photonics/Power%20Meters/Archive/1935_2935-C/1935-2935_Power_Meter_User%27s_Manual_RevB.pdf>
#
#  Settings (p.72 of the manual): 
#  Baud rate: 38400 bits/sec, Parity: No parity, Data bits: 8 data bits, Stop bits: 1 stop bit
#  Cable/Connection: Straigt 1:1 connection - works

import serial
import time

# line ending
LE = "\r\n"

## You can use "ECHO 0\r\n" to switch the echo off and "ECHO?" to ask for the current status.

conn = serial.Serial('/dev/tty.usbserial',timeout=1, baudrate=38400)
x = time.time()
for i in range(1000):
    # 1000 queries of `PM:P?;PM:ATT?;PM:L?;ERR?` took 57.75 seconds at 38400 baud when reading out the power meter via USB at the same time. This is 17.3 readings/sec.
    #conn.write("PM:P?;PM:ATT?;PM:L?;ERR?"+LE)
    # 1000 queries of `PM:P?` took 19.26 seconds at 38400 baud when reading out the power meter via USB at the same time. This is 51.92 readings/sec.
    conn.write("PM:P?"+LE)
    print repr(conn.readline())
print time.time() - x
conn.close()

Resources

Here are my findings concerning communicating with the device via USB: Newport Power Meter 2935T-C via libusb on Linux

Comments