Skip to content

Confusion about TLPMX: AvgTime, TimeoutValue and measPower() #43

@angelotrivelli

Description

@angelotrivelli

I am using the python wrapper for the TLPMX dll and am having difficulty understanding the usage of the setAvgTime and setTimeoutValue.

The device is a PM103E with a S130VC 1-channel photodiode sensor, and I want to measure the average power of a chopped optical signal (~8KHz). It works fine using the Optical Parameter Monitor application (see screenshot). I am trying to configure a python application to do the same.

Image

The application does not indicate the AvgTime and TimeoutValue for the reading, but I can guess.

parameter, wavelength, bandwidth, and autorange are obvious....

# single channel OPM's use channel = 1
channel = c_uint16(1)  

# Set power units to watts
self.tlpmx.setPowerUnit(c_int16(0), channel)  # 0 = watts

# Set wavelength to whatever is specified
wavelen: float = 633.0
self.tlpmx.setWavelength(c_double(wavelen), channel)

# set to low bandwidth mode LOW
self.tlpmx.setInputFilterState(c_int16(1), channel)  # 1 = low BW

# auto range on
self.tlpmx.setPowerAutoRange(c_int16(1), channel) 

What is not obvious is how to obtain "High Resolution", the only methods I can find are setAvgTime() and setTimeoutValue(). The comments say that timeoutValue
has to be longer than AvgTime, and that AvgTime is rounded to the closest multiple of the device's internal sampling rate. On the application from Thorlabs, the reading changes maybe 5 times a second. So...

# avgTime in seconds, not all values are accepted by the device!
set_avgtime = c_double(0.100)  # 100 ms
self.tlpmx.setAvgTime(set_avgtime, channel)

# timeout is in milliseconds, set to 200 ms
# tlmpmx.py comments require: TimeoutValue > AvgTime
set_tmo_val = c_uint32(200) # 200 ms
self.tlpmx.setTimeoutValue(set_tmo_val)

That seems to work (no exceptions and all return values are 0), but when I try to read the power with this:

channel = c_uint16(1)  # single channel OPM's use channel = 1
power = c_double(0.0)

self.tlpmx.measPower(byref(power), channel)

measPower() raises an exception with the message:

The given session or object reference does not support this operation.

I've tried many permutations of AvgTime and TimeoutValue and I can't get this to work.
Is there something fundamental I am missing?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions