Python reference API

class pypdm.PDM(address, link)

Class to command one Alphanov’s PDM laser sources.

MAX_DELAY = 15000
MAX_PULSE_WIDTH = 1275000
__del__()

For safety, disable laser when the object is deleted.

__init__(address, link)
Parameters:
  • address – PDM device address.
  • link – Specify a string for the serial to be used (‘/dev/ttyUSBx’ or ‘COMx’), a Link or PDM instance for daisy-chained configurations.
activation

True when laser is enabled, False when laser is off. Call apply() to make any change effective.

apply()

Apply all the instructions which are in volatile memory. This makes all settings changes effectives.

current

Current, in mA. Please note this property is in milli-amperes and is not a percentage of the maximum current, as the official PDM documentation may state. For the percentage, see current_percentage property. Call apply() to make any change effective.

Getter:Return diode current configuration.
Setter:Set the new current. Raise a ValueError if current is out of bounds.
current_percentage

Current, in percentage of maximum. This is an alternative way of changing the current property. Call apply() to make any change effective.

current_source

Current source. Set to CurrentSource.NUMERIC to control the laser diode pulse current from software through the current or current_percentage attributes.

Type:CurrentSource
delay

Delay, in ps. int. Maximum value is defined in MAX_DELAY.

delay_line_type

Delay line type, DelayLineType instance.

frequency

Frequency, in Hz. int. Read-only.

interlock_status

True if interlock is detected, False otherwise.

maximum_current

Maximum current, in mA. The getter of this property queries the PDM device once then cache the value for next accesses.

mode

PDM mode, Mode instance.

offset_current

Offset current, in mA. float.

pulse_width

Pulse width, in ps. int. Maximum value is defined in MAX_PULSE_WIDTH.

read_address()

Query laser source address.

read_protocol_version()
Returns:Protocol version string, for instance ‘3.4’.
sync_source

Synchronization source, SyncSource instance.

temperature

Temperature, in degrees.

Base PDM communication implementation. An instance of Link uses a serial port and can be shared by multiple PDM instances if the devices are daisy-chained.

__init__(dev)

Open serial device.

Parameters:dev – Serial device path. For instance ‘/dev/ttyUSB0’ on linux, ‘COM0’ on Windows.
class pypdm.SyncSource

Possible PDM synchronization source.

EXTERNAL_LVDS = 1
EXTERNAL_TTL_LVTTL = 0
INTERNAL = 2
class pypdm.DelayLineType

Possible delay line types.

INTERNAL = 1
NONE = 0
class pypdm.CurrentSource

Possible current sources.

ANALOG = 0
NUMERIC = 1
class pypdm.Mode

Possible PDM mode.

CONTINUOUS = 1
PULSED = 0
class pypdm.ChecksumError

Thrown if a communication checksum error is detected.

class pypdm.ProtocolError

Thrown if an unexpected response from the device is received.

class pypdm.ProtocolVersionNotSupported(version)

Thrown when a PDM protocol version is not (yet) supported by the library.

class pypdm.ConnectionFailure
class pypdm.StatusError(status)

Thrown when a PDM device did not respond with ‘OK’ status to the last command.