msl.equipment.database module

Load equipment and connection records from Databases.

class msl.equipment.database.Database(path)[source]

Bases: object

Create EquipmentRecord’s and ConnectionRecord’s from Databases that are specified in a Configuration File.

This class should be accessed through the database() method after a Config object has been created.

Parameters

path (str) – The path to an XML Configuration File.

Raises
property equipment

EquipmentRecord’s that were listed as <equipment> XML tags in the Configuration File.

Type

dict

property path

The path to the Configuration File.

Type

str

connections(**kwargs)[source]

Search the Connections Database to find all ConnectionRecord’s that match the specified criteria.

Parameters

**kwargs

The argument names can be any of the ConnectionRecord property names or a flags argument of type int for performing the search, see re.search(). For testing regex expressions online you can use this website.

If a kwarg is properties then the value must be a dict. See the examples below.

Examples

>>> connections()
a list of all ConnectionRecords
>>> connections(manufacturer='Keysight')
a list of all ConnectionRecords that have Keysight as the manufacturer
>>> records(manufacturer='Agilent|Keysight')
a list of all ConnectionRecords that are from Agilent OR Keysight
>>> connections(manufacturer=r'H.*P')
a list of all ConnectionRecords that have Hewlett Packard (or HP) as the manufacturer
>>> connections(manufacturer='Agilent', model='^34')
a list of all ConnectionRecords that have Agilent as the manufacturer AND a model number beginning with '34'
>>> connections(interface=MSLInterface.SERIAL)
a list of all ConnectionRecords that use SERIAL for the connection bus
>>> connections(interface='USB')
a list of all ConnectionRecords that use USB for the connection bus
>>> connections(backend=Backend.PyVISA)
a list of all ConnectionRecords that use PyVISA as the backend
>>> connections(backend='MSL')
a list of all ConnectionRecords that use MSL as the backend
>>> connections(properties={'baud_rate': 115200})
a list of all ConnectionRecords that specify a baud rate equal to 115200 in the Properties field
Returns

list of ConnectionRecord – The connection records that match the search criteria.

Raises

NameError – If the name of an input argument is not a ConnectionRecord property name or flags.

records(**kwargs)[source]

Search the Equipment-Register Database to find all EquipmentRecord’s that match the specified criteria.

Parameters

**kwargs

The argument names can be any of the EquipmentRecord property names or a flags argument of type int for performing the search, see re.search(). For testing regex expressions online you can use this website.

If a kwarg is connection then the value will be used to test which EquipmentRecord’s have a connection value that is either None or ConnectionRecord. See the examples below.

Examples

>>> records()
a list of all EquipmentRecords
>>> records(manufacturer='Agilent')
a list of all EquipmentRecords that are from Agilent
>>> records(manufacturer='Agilent|Keysight')
a list of all EquipmentRecords that are from Agilent OR Keysight
>>> records(manufacturer='Agilent', model='3458A')
a list of all EquipmentRecords that are from Agilent AND that have the model number 3458A
>>> records(manufacturer='Agilent', model='3458A', serial='MY45046470')
a list of only one EquipmentRecord (if the equipment record exists, otherwise an empty list)
>>> records(manufacturer=r'H.*P')
a list of all EquipmentRecords that have Hewlett Packard (or HP) as the manufacturer
>>> records(description='I-V Converter')
a list of all EquipmentRecords that contain 'I-V Converter' in the description field
>>> records(connection=True)
a list of all EquipmentRecords that can be connected to
Returns

list of EquipmentRecord – The equipment records that match the search criteria.

Raises

NameError – If the name of an input argument is not an EquipmentRecord property name or flags.