Device#

class baecon.device.Device(configuration: Optional[dict] = None)#

Class for handling control and communication with experimental devices. Experimental devices are designated into two catagories: scanning devices and acquisition devices, with this class serving as the base class for both. Scanning devices are the devices whose properties are changed from reading to reading. Acquisition devices perform the reading after a property has changed. Devices can be both scanning and aquisistion instruments, like a sourcemeter. The distinction between the two happens when the Measurement_Settings are defined.

Note:

In the user defined child classes (e.g, SG380), users will need to override the parameters and latent_paramenters atrributes, and the Device.read() and write() methods. Additional methods in the child class will needed to be defined to support these required attributes and methods.

Attributes:
name (str): Alias for the device to distringuish it from the

same device class. Example: SG1 for a signal generator.

parameters(dict): Properties of the device that would be scanned through

in an measurement sequence. Examples: voltage, frequency, power, …

latent_parameters(dict): Properties of the device that would be the same

from measurement to measurement. Exampls: connection settings (e.g., IP address), output port, …

configuration (dict): Full configuration of the device: name,

parameters, and latent_parameters. Passing this dictionary when creating the device object fully defines the device.

acq_data_size (int or tupel): Size of the data taken during a

reading by an acquisition device. For example, a single reading of voltage would be size 1, size for an image would be the pixel dimensions. Child classes for devices intended for acquisition should override this based on a parameter.

__init__(configuration: Optional[dict] = None) None#
Initializes device object with supplied configuration dictionary.

The supplied dictionary is then stored in the configuration attribue. The configuration dictionary has the form:

{'name': name string,
'parameters': parameter dictionary,
'latent_parameters': latent_parameter dictionary}
Parameters

configuration (dict) – Full configuration of the device: name, parameters, and latent_parameters. Passing this dictionary when creating the device object fully defines the device.

intitalize_parameters(configuration: dict)#

Populate the parameters and latent_parameters attributes from configuration dictionary.

Parameters

configuration (dict) – Full configuration of the instrument: name, parameters, and latent_parameters. Passing this dictionary when creating the device object fully defines the device.

read(parameter, value)#
Function used to read parameter from device during a measurement.

The user decides how this write command is performed in the device child class. read only takes two inputs the parameter to read, and the value which can be used to format how the parameter is read, like units for example. If value is not required for the device type, set it to value=None in the overriding read function of in child class.

Parameters
  • parameter (str) – Device parameter to read.

  • value (str) – Value (i.e., arguement) if needed for specific device.

Returns

Reading from device.

write(parameter, value)#
Function used to write parameter to device during a measurement.

The user decides how this write command is performed in the device child class. write only takes two inputs the parameter to write to, and the value to write. Values need not be numeric.

Parameters
  • parameter (str) – Device parameter to write to.

  • value (str) – Value to write to device.