Journal:OptiGUI DataCollector: A graphical user interface for automating the data collecting process in optical and photonics labs
Full article title | OptiGUI DataCollector: A graphical user interface for automating the data collecting process in optical and photonics labs |
---|---|
Journal | SoftwareX |
Author(s) | Soto-Perdomo, Juan; Morales-Guerra, Juan; Arango, Juan D.; Villada, Sebastian M.; Torres, Pedro; Reyes-Vera, Erick |
Author affiliation(s) | Instituto Tecnológico Metropolitano, Universidad Nacional de Colombia |
Primary contact | Email: juansoto319998 at correo dot itm dot edu dot co |
Year published | 2023 |
Volume and issue | 24 |
Article # | 101521 |
DOI | 10.1016/j.softx.2023.101521 |
ISSN | 2352-7110 |
Distribution license | Creative Commons Attribution 4.0 International |
Website | https://www.sciencedirect.com/science/article/pii/S2352711023002170 |
Download | https://www.sciencedirect.com/science/article/pii/S2352711023002170/pdfft (PDF) |
This article should be considered a work in progress and incomplete. Consider this article incomplete until this notice is removed. |
Abstract
OptiGUI DataCollector is a Python 3.8-based graphical user interface (GUI) that facilitates automated data collection in optics and photonics research and development equipment. It provides an intuitive and easy-to-use platform for controlling a wide range of optical instruments, including spectrometers and lasers. OptiGUI DataCollector is a flexible and modular framework that enables simple integration with different types of devices. It simplifies experimental workflow and reduces human error by automating parameter control, data acquisition, and analysis. OptiGUI DataCollector is currently focused on optical mode conversion utilizing fiber optic technologies but can be expanded to other research and development (R&D) processes.
Keywords: laboratory automation, device integration, software framework, graphical user interface, optical fiber, optical mode conversion
Motivation and significance
Experiments in today's scientific research are becoming increasingly complicated and involve several hardware devices that work together in a coordinated manner. These experiments can contain a variety of instruments such as sensors, analyzers, detectors, and actuators, each of which has a specific purpose in the experiment. [1–9] Efficiently controlling these experiments demands software that can effectively coordinate the functioning of these devices, not only by delivering orders but also by ensuring accurate data collection and control of experimental conditions. [10–13] The software must be able to handle the communication protocols and data formats of many devices, as well as manage potential conflicts or dependencies between them.
In addition to accurate management, fast data processing and visualization are critical for effective data interpretation. Because experiments create significant amounts of real-time data, the software must be able to process the data rapidly and efficiently. This may include data filtering, standardization, analysis, and visualization to obtain useful insights from the experiment. Real-time data visualization can also provide researchers with quick feedback, allowing them to make informed decisions and modify experimental conditions as needed.
Each experiment requires a unique combination of hardware devices depending on the specific needs of the research. [10–15] Two studies discussed in this passage highlight the development of software interfaces for fiber optic devices. In the first study, Labat [14] created a graphical user interface (GUI) in Matlab that allows for remote control, data acquisition, and data visualization from optical spectrum analyzers. The GUI was implemented to analyze the transmission spectrum of long-period fiber gratings (LPFGs), with various parameters such as operating wavelength and center settings. In the second study, Harun et al. [15] developed an automated system in LabVIEW for self-calibration and measurement of fiber optic devices such as sensors and Erbium Doped Fiber Amplifiers (EDFAs). Their system allows for up to an 80% reduction in data acquisition time while providing precise and consistent measurements with a low uncertainty value of ±0.012 dB.
Based on the above, this work has developed a computerized instrumentation system that allows constant monitoring, processing, and data collection of research and development (R&D) equipment; therefore, we propose an object-oriented GUI capable of executing the tasks dynamically without having to incur system modifications that may disturb the measurements. The purpose of executing various tasks requires employing reliable models to optimize the functions of each of the instruments, allowing the efficient use of the R&D personnel is working time, as well as providing a user-friendly interface to facilitate the manipulation of the instruments. With object-oriented programming, the problem to be solved is modeled through a series of interactions between the optical equipment, reusing lines of code through inheritance, and the implementation of polymorphism.
Software description
OptiGUI DataCollector is a GUI created using Python 3.8, the PyQt5 library, and QTDesigner. This GUI uses an object-oriented programming paradigm to create a framework that is unique. The GUI allows the user to intuitively operate the basic functions of the most used instruments in a photonics laboratory, minimizing the time required to obtain data through continuous interaction with the instruments. In addition, the GUI design allows easy reuse of existing modules and implementation with other hardware controllers, allowing the use of equipment from other manufacturers.
The user can acquire optical power and image data for different wavelengths and polarization states of light, as well as subject optical devices to different temperature changes to analyze variations in the characteristics of light as it propagates through an optical fiber. In addition, OptiGUI DataCollector allows exporting the data collected during the experiment for further study. This UI allows R&D personnel to automate and streamline their studies of fiber optic devices.
Framework components
Python modules are used to build the GUI. These modules are designed to work together so that the code can focus on performing the required functions. The user interface (UI) was created using a methodology involving an iterative process, as detailed in the schematic shown in Fig. 1.
|
In addition, the following five hardware components controlled by the UI are shown in the diagram:
- Tunable laser: A tunable laser is a component of equipment that enables the user to alter the operating wavelengths to suit a variety of optical applications. This is accomplished by specifying a starting and ending wavelength, as well as defining the step to be used for the wavelength sweep. It also enables the user to adjust the output power of the light source.
- Power meter: The user may select either the optical power meter or the optical spectrum analyzer. In both instances, the user can configure the interface by providing the initial wavelength, the final wavelength, and the acquisition interval. These parameters should, ideally, correspond to the configuration of the adjustable laser. It is crucial to note that the optical power meter measures the output power of the light source at a specific wavelength, whereas the optical spectrum analyzer measures the power spectrum. Consequently, the choice between the two will depend on the user’s particular measurement needs.
- Rotational stage: This component facilitates the activation of the rotational stage. This rotatable platform allows for a degree-by-degree adjustment of the angle at which certain optical elements are positioned. The user can therefore adjust the initial angle, the final angle, and the step size.
- Visible or IR camera: The component is a power on/off switch for a camera. The camera is a commonly used device for capturing images in different applications, such as capturing images of the spatial distribution of modes propagating in an optical fiber.
- Temperature controlled system: This module contains the hardware components necessary for closed-loop temperature control. It is composed of an Arduino Mega 2560 coupled to a 12 V (40 W) ceramic cartridge heater for heating the fiber (via the RAMPS 1.4 power control board) and a 100 K NTC thermistor for measuring the temperature. The ceramic cartridge heater is encapsulated in an aluminum block containing the fiber to ensure uniform heat distribution. To monitor the actual temperature, a thermistor is also housed in the same block.
The Arduino script is programmed to preprocess and convert the thermistor signal to °C. PID control is then implemented to maintain a constant temperature set point. The Arduino continuously receives this set point via the serial port, which is dynamically adjusted based on the user-specified temperature range in °C via the Python script. Essentially, the Arduino's main function is to maintain temperature control at the specified set point.
Software architecture
As shown in Fig. 2, OptiGUI DataCollector is a software that incorporates five distinct optical laboratory instruments and enables their control from a single interactive UI. The program's GUI allows the user to automate and control the optical setup intuitively.
|
This window allows the user to configure parameters such as optical power, wavelength, temperature, and any other variables required to change the operation of each device. These values can be saved and reloaded for subsequent experiments, making the program extremely versatile and useful for R&D activities.
Communication between optical equipment and the UI is performed using instrument-specific protocols and libraries. The SDK (software development kit) consists of a compiler, debugger, documentation, drivers, and network protocols for a particular hardware component. A Python-based, object-oriented API (application programming interface) facilitates the project's scalability by facilitating packet exchange. Using a simple access protocol, the user and the instrument exchange information.
The UI consists of seven modules, each of which performs a specific purpose, as described below:
Module 1. Tunable_Laser.py: The TCP/IP protocol over Ethernet is used to communicate with the tunable laser. This protocol allows the simultaneous exchange of data between the UI and the server (Laser PyApex). This feature is made possible by the Python 3-written SDK from Apex Technologies. The SDK comprises a collection of examples Apex1000 device-controlling codes.
The tunable laser module is responsible for setting the characteristic attributes of the laser, such as input power in dBm and operating wavelengths in nm. In addition, it has a drop-down menu for selecting the laser source reference.
Module 2. Degrees_Polarization.py: To establish communication between the UI and a Thorlabs rotational stage, the thorlabs-apt-device library version 0.3.3 is used, which implements the Advanced Positioning Technology (APT) protocol for this type of device. With this library, the Degrees polarization.py module was created to govern the rotational stage using four distinct attributes: initial angle, final angle, steps, and rotational direction. This module allows communication with any device using a DC servo motor driver from Thorlabs. Additionally, the module includes error checking and validation to guarantee correct input and avoid errors during execution. The GUI offers visual feedback and user-friendly controls for simple rotational stage operation.
Module 3. Power_Meter.py: An optical power meter is also used in this UI. This equipment has its drivers in LabVIEW, a development environment that uses a graphical programming language to design systems. To integrate Python with LabVIEW, the “outside-in” function is used, which allows Python to instruct LabVIEW to perform an action and return its result.
To use this integration approach, the “autoliv” and “Activex” libraries are used to retrieve and manipulate data acquired with LabVIEW in Python. The interface also includes a plotter that displays the transmission spectrum plot, where the wavelength and optical power are connected. Each power value corresponding to a wavelength is added to a list to visualize the optical device's transmission spectrum.
Module 4. Image_Capture.py: This module contains two classes for controlling a camera from the system UI. One is responsible for activating the camera in the system and capturing frames, while the other checks the data and stores it in a list data structure. This module also makes use of the OpenCV library to read and save .tiff pictures. Furthermore, the pixel data is saved as a data structure in an array using the numpy library. The module also enables the user to view the images in a window that is generated within the UI.
The use of the OpenCV library provides a wide range of features for processing and analyzing camera images. Image filtering, object detection, and picture segmentation are examples of such characteristics. The acquired frames can also be analyzed in real-time using the library 's functions, allowing the user to perform tasks such as object tracking or motion detection.
Module 5. Temperature_Control: This module is designed to connect to the Arduino Mega through serial communication using the pySerial library. A new object named “mega” is created, which specifies the serial port attributes, the baud rate (115200), and a timeout of one second.
To initiate the connection and send the temperature setpoint, the Python function “mega.write()” is used. On the other hand, to receive the actual temperature read by the thermistor, the “mega.readline()” function is employed.
Here, it is worth noting that the use of the pySerial library enables the communication between the Arduino Mega and Python, allowing the integration of different technologies and enabling software developers to design more comprehensive and efficient solutions. After establishing a connection between the Python script and the Arduino board, the script runs through a user-defined range of temperatures. Each set point is sent individually to the Arduino, and after the arrival signal at the desired temperature, a stabilization time is expected. After this interval, the image and actual temperature are captured and saved in the dataset, and so on for all temperature set points.
Module 6. Execution.py: This module serves as the central control hub for the entire system. It handles all the initialization tasks required to start the program and connects all the modules described above. The module provides access to different system attributes, including wavelengths, camera control, angles, rotation direction, and PLAY and STOP functions.
These attributes play a critical role in the operation of the system. For example, the wavelengths are used “to tell” the system what range of electromagnetic radiation to look for, while the camera control attribute indicates if whether or not the camera will be used. The angles and direction of rotation are used to control how the system moves, allowing it to collect data from different angles. Finally, the PLAY and STOP functions allow users to start or stop the system as needed.
Module 7. Principal_Inteface.py: This is the interface where applications and users interact. It contains all the PyQt5 widgets needed to create the application window. As shown in Fig. 3, the components are organized in a hierarchical structure, where the left-hand side is composed of elementary widgets to control the camera and the rotational stage, respectively. In the middle of the main window, there is a container widget for displaying images and graphs. On the right-hand side are the power meter and the tunable laser control element, and at the bottom of the window are the temperature control elements. The PLAY button starts the program by sending an input function that obtains the system parameters. Having a GUI makes it easy for users to interact with the system and verify its operation.
|
Software functionalities
The system flowchart, shown in Fig. 4, describes the process that starts with the PLAY button and allows the activation of the Tunable_Laser.py module.
|
The system has two independent case studies that are described below:
- Case 1: In this situation, the system determines if camera verification is enabled. If it is not, the Power_Meter.py module is run to measure the strength of the laser signal. Next, the system checks if the user has provided the temperature data (temperature range and step-by-step temperature). If so, the Temperature_Control.py module is run to regulate the temperature of the medium and record the transmission spectrum as a function of temperature. The Temperature_Control.py module is skipped if no temperature information is provided, and the transmission spectrum at a given temperature is displayed on the main screen.
- Case 2: In this case, the system checks if the camera verification is active. If so, the Image_Capture.py module is activated to capture the sample image. Then, the system checks if the user has entered the temperature data (temperature range and step-by-step temperature). If so, the Temperature_Control.py module is executed to control the sample temperature and record the sample image as a function of temperature. If no temperature data is entered, the Temperature_Control.py module is skipped and the sample image is shown on the main screen. If no temperature values are entered, but the camera check is active, the Degrees_Polarization.py module is activated to measure the polarization angle of the sample.
In any scenario, the user can modify the input parameters of the system and examine the results in real time, simplifying decision-making and data interpretation. The system is an effective instrument for performing optical measurements over a range of temperatures and polarization angles simultaneously.
Illustrative examples
In this section, one case of how the developed software can be used for data acquisition will be presented, and the operation of the GUI with the included modules will be demonstrated (other illustrative examples are provided as supplementary material). This example uses an experimental setup to perform the investigation of the transmission spectra of a LPFG-based modal conversor.
Code metadata
- Current code version: v1.0
- Permanent link to code/repository used for this code version: https://github.com/ElsevierSoftwareX/SOFTX-D-23-00293
- Code Ocean compute capsule: none
- Legal Code License: GNU (GPL)
- Code versioning system used: Git
- Software code languages, tools, and services used: Python 3.8, LabView
- Compilation requirements, operating environments & dependencies: See User Manual in GitHub repository
- If available Link to developer documentation/manual: See User Manual in GitHub repository
- Support email for questions: juansoto319998 at correo dot itm dot edu dot co
References
Notes
This presentation is faithful to the original, with only a few minor changes to presentation. In some cases important information was missing from the references, and that information was added. In the original, Figure 3 and 4 are mentioned out of order; they have been swapped for this version.