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.

>>> from msl.equipment import Config
>>> cfg = Config('msl/examples/equipment/example.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 r in db.records():
...     print(r)
EquipmentRecord<Agilent|34420A|D7D59860>
EquipmentRecord<Keysight|34465A|MY54506462>
EquipmentRecord<Hewlett Packard|3468A|8BB438A7>
EquipmentRecord<BK Precision|5492BGPIB|51957DB9>
EquipmentRecord<Keithley|2002|2CAD4BC6>
EquipmentRecord<Keysight|3458A|MY24339283>
>>> for r in db.records(manufacturer='Keysight'):
...     print(r)
EquipmentRecord<Keysight|34465A|MY54506462>
EquipmentRecord<Keysight|3458A|MY24339283>
>>> for c in db.connections():
...     print(c)
ConnectionRecord<Agilent|34420A|D7D59860>
ConnectionRecord<Keysight|34465A|MY54506462>
ConnectionRecord<Hewlett Packard|3468A|8BB438A7>
ConnectionRecord<BK Precision|5492BGPIB|51957DB9>
ConnectionRecord<Keithley|2002|2CAD4BC6>
ConnectionRecord<Keysight|3458A|MY24339283>
>>> for c in db.connections(address='USB*'):
...     print(c)
ConnectionRecord<Agilent|34420A|D7D59860>
ConnectionRecord<Keysight|34465A|MY54506462>
ConnectionRecord<Keysight|3458A|MY24339283>
>>> db.equipment
{'dmm': EquipmentRecord<Keysight|34465A|MY54506462>}
>>> db.equipment['dmm'].connection
ConnectionRecord<Keysight|34465A|MY54506462>

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?')
'Keysight Technologies,34465A,MY54506462,A.02.14-02.40-02.14-00.49-03-01\n'

In addition, the constants module contains the package constants.

That pretty much summarizes all of the classes and modules that a typical user will need to access in their application.

Connection Classes

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

ConnectionDemo Simulate a connection to the equipment.
ConnectionMessageBased Base class for equipment that use message based communication.
ConnectionSDK Base class for equipment that use the SDK provided by the manufacturer for the connection.
ConnectionSerial Base class for equipment that is connected through a Serial port.

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

ConnectionPyVISA Uses PyVISA to establish a connection to the equipment.