API Documentation

The main entryway in to MSL-Equipment is achieved by loading a Configuration File and that is achieved by creating a Config object. This example loads the example.xml file.

>>> from msl.equipment import Config
>>> cfg = Config('config.xml')

Once a Config object exists you can access of all the EquipmentRecord's and ConnectionRecord's that are contained within the Databases as well as all of the equipment that is being used to perform the measurement by calling the database() method to create an instance of the Database.

>>> db = cfg.database()
>>> for record in db.records():
...    print(record)
EquipmentRecord<Hewlett Packard|34401A|D10011>
EquipmentRecord<Arlunya|Milli Gauss|E10012>
EquipmentRecord<Stanford Research Systems|SR850 DSP|G10014>
EquipmentRecord<Hewlett Packard|3478A|D10015>
>>> for record in db.records(manufacturer='H.*P'):
...    print(record)
EquipmentRecord<Hewlett Packard|34401A|D10011>
EquipmentRecord<Hewlett Packard|3478A|D10015>
>>> for conn in db.connections():
...    print(conn)
ConnectionRecord<Hewlett Packard|34401A|D10011>
ConnectionRecord<Stanford Research Systems|SR850 DSP|G10014>
ConnectionRecord<Hewlett Packard|3478A|D10011>
>>> for conn in db.connections(address='GPIB'):
...     print(conn)
ConnectionRecord<Hewlett Packard|3478A|D10011>
>>> db.equipment
{'dmm': EquipmentRecord<Hewlett Packard|34401A|D10011>}
>>> db.equipment['dmm'].connection
ConnectionRecord<Hewlett Packard|34401A|D10011>

Establishing a connection to the equipment is achieved by calling the connect() method of an EquipmentRecord. This call will return a specific Connection subclass that contains the necessary properties and methods for communicating with the equipment.

>>> dmm = db.equipment['dmm'].connect()
>>> dmm.query('*IDN?')
'Hewlett Packard,34401A,D10011,A.02.14-02.40-02.14-00.49-03-01'

In addition, the constants module contains the package constants.

Connection Classes

The following Connection classes are available to communicate with the equipment (although you should never need to instantiate these classes directly):


Simulate a connection to the equipment


Equipment that use message-based communication


Equipment that is connected through a Prologix Controller


Equipment that use the manufacturer’s SDK for the connection


Equipment that is connected through a Serial port


Equipment that is connected through a Socket

and the Connection classes that are available from external Python libraries are:


Uses PyVISA to establish a connection to the equipment


Uses NI-DAQ to establish a connection to the equipment

Package Structure