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() \(\rightarrow\) a list of all ConnectionRecord’s

  • connections(manufacturer=’Keysight’) \(\rightarrow\) a list of all ConnectionRecord’s that have Keysight as the manufacturer

  • connections(manufacturer=’Agilent|Keysight’) \(\rightarrow\) a list of all ConnectionRecord’s that are from Agilent or Keysight

  • connections(manufacturer=’H.*P’) \(\rightarrow\) a list of all ConnectionRecord’s that have Hewlett Packard (or HP) as the manufacturer

  • connections(manufacturer=’Agilent’, model=’^34’) \(\rightarrow\) a list of all ConnectionRecord’s that have Agilent as the manufacturer and a model number beginning with ‘34’

  • connections(interface=Interface.SERIAL) \(\rightarrow\) a list of all ConnectionRecord’s that use SERIAL for the connection bus

  • connections(interface=’SDK’) \(\rightarrow\) a list of all ConnectionRecord’s that use the manufacturers SDK to control the equipment

  • connections(backend=Backend.PyVISA) \(\rightarrow\) a list of all ConnectionRecord’s that use PyVISA as the backend

  • connections(backend=’MSL’) \(\rightarrow\) a list of all ConnectionRecord’s that use MSL as the backend

  • connections(properties={‘baud_rate’: 115200}) \(\rightarrow\) a list of all ConnectionRecord’s 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() \(\rightarrow\) a list of all EquipmentRecord’s

  • records(manufacturer=’Agilent’) \(\rightarrow\) a list of all EquipmentRecord’s that are from Agilent

  • records(manufacturer=’Agilent|Keysight’) \(\rightarrow\) a list of all EquipmentRecord’s that are from Agilent or Keysight

  • records(manufacturer=’Agilent’, model=’3458A’) \(\rightarrow\) a list of all EquipmentRecords that are from Agilent and that have the model number 3458A

  • records(manufacturer=’Agilent’, model=’3458A’, serial=’MY45046470’) \(\rightarrow\) a list of only one EquipmentRecord (if the equipment record exists, otherwise an empty list)

  • records(manufacturer=r’H.*P’) \(\rightarrow\) a list of all EquipmentRecord’s that have Hewlett Packard (or HP) as the manufacturer

  • records(description=’I-V Converter’) \(\rightarrow\) a list of all EquipmentRecords that contain ‘I-V Converter’ in the description field

  • records(connection=True) \(\rightarrow\) 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.