Connections subpackage

Each setup consists of different components that each have their connection. The base class for connections is eprcontrol.connections.Connection. Every connection should inherit from this class.

There are currently a number of derived classes serving as starting point for the different types of connections:

The other classes are derived from these base classes and are designed to connect to a particular software component, such as the Bruker Xenon software. Note that several components can share one and the same connection. Currently, the following special connections are implemented:

See the respective class documentation below for details. While TCP/IP and XML-RPC are two rather general protocols, the actual connections are rather device-specific beyond the parameters necessary to connect to the device. Therefore, the different connections listed above each currently contain unique public methods designed to talk to the respective hardware.

Classes

class eprcontrol.connections.BrukerXenonXmlrpcConnection

Bases: eprcontrol.connections.XmlrpcConnection

Connection to Bruker Xenon software via XML-RPC interface

Generally, the procedure to connect to Bruker Xepr should be quite similar, but is currently untested.

configuration

Settings necessary for the connection

The settings consist of IP address and port, with the IP address being a string and the port being an integer

Type

struct

get_parameter(parameter, hidden)

Retrieve parameter value from Bruker Xenon program.

Parameters
  • parameter (string) – Name of the parameter to set in Bruker Xenon program

  • hidden (Boolean string) –

    “True” or “False”

    If your parameter is hidden, “hidden” needs to be “True”, otherwise it needs to be “False” (note the strings).

    See the Bruker documentation for details

Returns

  • value (numeric) – Value of the parameter returned from Bruker Xenon program

  • Example (get(“QValue”, “True”))

set_parameter(parameter, hidden, value)

Set parameter value in Bruker Xenon program.

Parameters
  • parameter (string) – Name of the parameter to set in Bruker Xenon program

  • hidden (Boolean string) –

    “True” or “False”

    If your parameter is hidden, “hidden” needs to be “True”, otherwise it needs to be “False” (note the strings).

    See the Bruker documentation for details

  • Example (set("CenterField", "False", 3300)) –

class eprcontrol.connections.Connection

Bases: handle

Base class for connections

configuration

Settings necessary for the connection

The configuration can be read from a file using the read_config() method.

Type

struct

device

actual device representation for the connection

The type depends on the type of connection (usually some type of object), but the actual communication with the hardware uses this device.

Type

object

active

Indicates whether the connection is active

Type

boolean

read_config(filename)

Obtain configuration from a file

Parameters

filename (string) – Name of the configuration file to be read

Configuration can be stored in any format readable by the eprcontrol.configurations.Configuration class.

After reading the file, the method apply_config() will be called, hence only setting those parameters that have corresponding names in the configuration attribute of the class.

apply_config(config_struct)

Apply configuration from a struct

Only those fields in the provided struct will be used that have a corresponding field in the configuration attribute of the class.

Parameters

config_struct (struct) – structure containing configuration values

connect()

Connect to the underlying hardware

If no configuration is present, the method will issue a warning and abort.

The connection state of a connection can be checked using its active property.

The actual connecting is performed in the protected open_connection() method. Hence, all connection-specific settings need to go in there in derived classes.

disconnect()

Disconnect from the underlying hardware.

Only in case the connection was active, an attempt to disconnect is carried out.

The connection state of a connection can be checked using its active property.

The actual disconnecting is performed in the protected close_connection() method. Hence, all connection-specific settings need to go in there in derived classes.

class eprcontrol.connections.GwuTcpipConnection

Bases: eprcontrol.connections.Connection

Connection to GWU OPO via TCP/IP

configuration

Settings necessary for the connection

The settings consist of IP address and port, with the IP address being a string and the port being an integer

Type

struct

read()

Get message from device

Returns

message – message read from the device

Return type

string

write(message)

Send message to device

Parameters

message (string) – Message to be written to the device

class eprcontrol.connections.LecroyTcpipConnection

Bases: eprcontrol.connections.TcpipConnection

Connection to LeCroy Oscilloscope via TCP/IP

The connection relies on a particular driver provided with the toolbox and on the MATLAB® Instrument Control Toolbox™.

configuration

Settings necessary for the connection

The settings consist of IP address and port, with the IP address being a string and the port being an integer

Type

struct

Note

The driver used (lecroy_basic_driver.mdd) is actually very basic, as its name says. Perhaps most crucial is its restriction to only 8 bit for A/D conversion, regardless of the capabilities of the scope. This renders the resulting data rather useless due to tremendous digital noise, except in case you are measuring only standards with quasi noise-free signals.

class eprcontrol.connections.SpcmConnection

Bases: eprcontrol.connections.Connection

Connection to the Spectrum Instrumentation A/D card

configuration

Settings necessary for the connection

The setting consists of the device string

Type

struct

class eprcontrol.connections.TcpipConnection

Bases: eprcontrol.connections.Connection

Base class for TCP/IP connections

TCP/IP connections are one of the few very general connection types.

In its current implementation, this connection depends on the MATLAB® Instrument Control Toolbox™. However, it might be possible to connect via TCP/IP only with MATLAB® functions available in the base installation.

configuration

Settings necessary for the connection

The settings consist of IP address and port, with the IP address being a string and the port being an integer

Type

struct

class eprcontrol.connections.XmlrpcConnection

Bases: eprcontrol.connections.Connection

Base class for XML-RPC connections

XML-RPC (Extensible Markup Language Remote Procedure Call) is a protocol using XML to encode function calls and HTTP for transport purposes.

As MATLAB® does not provide any native XML-RPC support, here, the Apache JAVA libraries available free of charge are used. For details, see their webpage:

https://ws.apache.org/xmlrpc/

These libraries are included in this toolbox and distributed with it.

configuration

Settings necessary for the connection

The settings consist of IP address and port, with the IP address being a string and the port being an integer

Type

struct