Logger
The Logger module is a generic Module used for devices that read or log measurement values without actively applying or sweeping a value. It is designed for instruments such as power meters, multimeters, data loggers, and any other device where the primary task is to acquire and return data.
Unlike modules such as SMU or Signal that both set and read values, the Logger module focuses entirely on the readout side. It is commonly used as a child module in the Sequencer to monitor additional parameters alongside an active sweep performed by another module.
Overview
The Logger module is one of the generic Modules in SweepMe!, like Switch and Robot. Its GUI is generated dynamically: each Logger driver defines its own set of parameters, tailored to the specific instrument it controls. Many other modules also have such a Parameter box for driver-specific parameters, but in Logger it is the main element of the GUI.
Typical use cases for the Logger module include:
- Acquiring optical power from a power meter
- Logging humidity, pressure, or other environmental parameters
- Recording voltages or currents from a data acquisition device
- Reading the mouse position or other system parameters (e.g. Logger-PC_Mouse)
Note that some physical quantities have their own dedicated module with additional functionality, for example Temperature. Use Logger for devices that do not fit any dedicated module.
A list of available Logger drivers can be found here: https://sweep-me.net/devices/
Module fields
The Logger module has the following fields:
- Logger label: the label of the module in the sequencer.
- Driver: the driver of the instrument. The button "Open driver" opens the driver file.
- Channel: only shown if the driver defines channels.
- Port: the communication port. Use "Find Ports" to search for available ports.
- Data with the button Retrieve: "Retrieve" runs the driver once like a single measurement point (from connecting to disconnecting) and shows the returned variables, units, and values in the field "Data". Use it to test the connection and the configuration before you start a run. The button is disabled during a run.
- Parameters: the Parameter box with the driver-specific parameters. It is only shown if the driver defines parameters.
Parameter box
Unlike modules that apply values (such as SMU or Switch), the Logger module has no Sweep mode. Instead, each Logger driver defines its own parameters, which are shown in the Parameter box. These parameters configure how the instrument performs its readout, for example the measurement range or the averaging.
The Parameter box is generated from the keys and default values that the driver returns in update_gui_parameters(), or in set_GUIparameter() in older drivers. Based on the type of the default value, the corresponding GUI element is created automatically:
str: a text fieldintorfloat: a number field that also accepts the parameter syntax{...}bool: a check boxlist: an editable drop-down menu, the first element is the defaultpathlib.Path: a button to select a file, or a folder if the default path is an existing folderNone: a bold heading to structure the parameters- a method of the driver: a button with the name of the method that calls this method
This allows each Logger driver to present exactly the configuration options needed for its instrument.
If you have made changes to the GUI in your driver and you want to update the Parameter box, select the driver again in the Driver drop-down menu, which will renew the GUI.
Variables and units
Each Logger driver defines the measurement quantities it returns using the attributes self.variables and self.units. These are lists where each entry corresponds to one returned value. A power meter driver, for example, would define a single variable for optical power with the appropriate unit. A more complex instrument might return several values at once. A return value can also be a tuple or a list, for example when measuring multiple hardware-triggered points.
Additionally, self.plottype and self.savetype can be set as lists to control whether each variable can be plotted and/or saved to the output file. Each entry corresponds to the variable at the same index.
Driver programming
A Logger driver is a Python script called main.py that inherits from EmptyDevice. The driver name must follow the naming convention:
Logger-<Manufacturer>_<Model>
For example: Logger-Keysight_344xxA or Logger-Arduino_DHTxx.
Key methods
The following methods are most relevant for Logger drivers:
| Method | Description |
|---|---|
update_gui_parameters(parameters) |
Returns a dictionary defining the Parameter box elements and their default values or options. Older drivers use set_GUIparameter().
|
apply_gui_parameters(parameters) |
Receives a dictionary of the current Parameter box selections. Use this to store user-selected settings. Older drivers use get_GUIparameter(parameter).
|
connect() |
Opens the connection to the instrument. |
disconnect() |
Closes the connection to the instrument. |
initialize() |
Configures the instrument at the start of a measurement. |
deinitialize() |
Resets the instrument configuration at the end of a measurement. |
configure() |
Called when the module becomes active in a branch. |
unconfigure() |
Called when the module is no longer active. |
measure() |
Triggers or performs the actual measurement. Store results in instance variables. |
call() |
Returns the measured values as a list matching the order of self.variables.
|
For a complete overview of all available methods and the order in which they are called, see Sequencer procedure and Driver Programming.
Typical usage in the Sequencer
The Logger module is most commonly used as a child module nested below an active sweep module. In this configuration, the Logger reads its values at each sweep point of the parent module.
Example: Optical power monitoring during a wavelength sweep
A typical use case is to monitor optical power while sweeping the wavelength with a Signal module:
Signal (Wavelength sweep) └── Logger (Power meter readout)
At every wavelength step, the Logger module reads the optical power, building up a spectral response curve.
Example: Multi-sensor logging
Multiple Logger modules can be placed in the same branch to read different sensors in parallel:
SMU (Voltage sweep)
└── Logger (Optical power)
└── Logger (Humidity)
See also
- Switch: generic module for devices that set values
- Robot: generic module for devices with multiple axes
- Temperature: dedicated module for temperature controllers and sensors
- SMU: module for source-measuring units
- Driver Programming: guide for writing custom drivers
- Sequencer: overview of the measurement sequencer
- Sequencer procedure: detailed order of method calls