msl.equipment.database module
Load equipment and connection records from Databases.
- class msl.equipment.database.Database(path)[source]
Bases:
object
Create
EquipmentRecord
’s andConnectionRecord
’s from Databases that are specified in a Configuration File.This class should be accessed through the
database()
method after aConfig
object has been created.- Parameters:
path (
str
) – The path to an XML Configuration File.- Raises:
OSError – If path does not exist or if the Configuration File is invalid.
AttributeError – If an
<equipment>
XML tag is specified in the Configuration File and it does not uniquely identify an equipment record in an Equipment-Register Database.ValueError – If an
alias
has been specified multiple times for the sameEquipmentRecord
or if the name of the Sheet in an Excel spreadsheet is invalid.
- property equipment
EquipmentRecord
’s that were listed as<equipment>
XML tags in the Configuration File.- Type:
- property path
The path to the Configuration File.
- Type:
- 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 aflags
argument of typeint
for performing the search, seere.search()
. For testing regex expressions online you can use this website.If a kwarg is
properties
then the value must be adict
. 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
ofConnectionRecord
– The connection records that match the search criteria.- Raises:
NameError – If the name of an input argument is not a
ConnectionRecord
property name orflags
.
- 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 aflags
argument of typeint
for performing the search, seere.search()
. For testing regex expressions online you can use this website.If a kwarg is
connection
then the value will be used to test whichEquipmentRecord
’s have aconnection
value that is eitherNone
orConnectionRecord
. 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
ofEquipmentRecord
– The equipment records that match the search criteria.- Raises:
NameError – If the name of an input argument is not an
EquipmentRecord
property name orflags
.