Week of 10/23/2017 - Progress Report 3
- Ezequiel Partida & Jonathan DeRouen
- Oct 28, 2017
- 5 min read
Topics Covered: Remote data acquisition from AQ6370D OSA by Matlab GUI, Finalization of GUI design & aesthetics, Beginning of absorption line analysis, Research on data validity
Materials: AQ6370D OSA, Matlab (v. 2014b or above), All Image/Signal/Instrument Matlab toolkits, Patience
Summary: Last week, remote control of the OSA was made possible through Matlab GUI. However, data retrieval by the GUI was not, since using the ‘fscanf’ command threw a ‘VISA Timeout Error.’ This week, the problem was resolved. The OSA threw a timeout because it was never queried for data retrieval. In order to get data from the spectrometer, the user must first query the OSA, and then use the ‘fscanf’ command. On the Matlab, the following code works to send spectrum commands to the OSA and retrieve data from it.

Once that problem was resolved, the GUI was ready to be finalized. The default GUI interface created is shown as follows:

The ‘Open Dev’ button sets up the remote connection to the OSA. The ‘Execute’ button sends commands to the OSA in order to set its measurement settings and retrieve trace data. By default, the settings are set to:
20 pm resolution
Linear scale
4 pm sampling interval
1 average time per sample
Mid sensitivity mode
1510 nm start wl
1550 nm end wl
As described in the static text in the bottom of the GUI interface, the user can, at any time, change the Sensitivity, Sampling Interval, Start/End wl, and Average Time per Samples. The resolution was decided to be kept at 20 pm because that resolution is part of the engineering requirements proposed by the team. If the user is given flexibility with resolution, the engineering requirement of capturing absorption spectrum data at 20 pm would not be met. Also, the scale is kept set at Linear Scale because absorption lines are not noticeable in Log scale.
However, the user could run into some problems when adjusting the possible settings. For example, at High Sensitivity and low sampling interval, the time it takes to capture a spectrum increases dramatically. Therefore, the Matlab code is not able to capture all of the data and the GPIB commands run into a timeout. Doing so throws the following error:

The following settings are prone to this error:
Very Low Sampling Intervals (<3 pm)
High average times per sample (>1)
High sensitivity modes (High1, High2, High3)
Large wavelength spans in combination with the previous
However, when the error is not displayed, the GUI runs smoothly. The following pictures are runs created to test the functionality of the GUI. The first 2 pictures show the default spectrum and line waveforms when no settings are adjusted.


The next 2 pictures show the spectrum and lines at the shown settings.


The next 2 pictures show High sensitivity settings.


The next 2 pictures show Low sensitivity settings.


In addition to being able to generate all the spectra and absorption lines for different settings, implementation for absorption line analysis was started. In order to efficiently save data for this analysis, a ‘Save’ option was added to a File menu in the GUI. Also, an ‘Exit’ option was added to close the OSA connection and to close the data saving feature.

As described in the static text on the bottom of the GUI, the ‘Save’ option can be used at any time in order to save as much data as the user wants into an excel file. The saved data is stored as shown:

With this feature, data analysis can be made easy. This week 2 different methods for absorption line analysis were considered. The first one is Peak Absorption Strength Analysis (PASA), and the second one is Root Mean-Squared Percent Error (RMSE%).
For PASA, the following code is used:

When using that code for a single trace of data gathered from the excel sheet generated by the GUI, a vector like the one shown below is generated:

On the first column, the vector holds the wavelength where the peak absorption value happens for a single absorption line. The second column holds all of the corresponding absorption line strength values. The proposed idea for PASA is to get a vector like the one shown above to be used as a reference. Then, when other data is gathered, the same analysis can be performed on that data and then compared to the reference vector. However, there are 3 problems with this method. The first problem is that in order to compare the reference data to another vector, the number of absorption lines would have to be exactly the same or else vector manipulation would be difficult. The second problem is that the user will not always choose the same settings as the ones that were used on the reference data. Finally, if there is a way to go around these 2 problems, the third problem would be that both the wavelength and absorption strength values are not integers, or even close-rounded values. Therefore, there will be a lot of error when dealing with this data.
For RMSE%, the ‘immse’ command is used to compare 2 vectors of data and get the Mean-Squared value. Then, performing the square root and multiplication by 100, RMSE% is generated. This value specifies the percent error from the difference between the 2 sets of data. An example is provided below. The same Acetylene Gas Absorption spectrum is generated, however, using a Mid sensitivity setting and then a lower sensitivity setting.

RMSE% = 4.0090
There are 2 problems with this method. The first problem is that the ‘immse’ function does not distinguish whether there are differences in the y-axis, or the x-axis of the 2 sets of data. Therefore, the same strength absorption lines can be present at completely different wavelengths (indicating 2 completely different substances) giving the same RMSE% as 2 data that have different absorption line strengths but in the same wavelengths (indicating same substance but different concentration, which is fine). Therefore, there can be discrepancies in how the RMSE% is interpreted. The second problem is that for different concentrations of a substance, the allowable RMSE% will have to change. Therefore, there is a lot of calibration to be done and a lot of testing with different samples (assuming there is a workaround to the first problem).
In conclusion, the functionality of the GUI to interface with the hardware is pretty much finished until the optical setup (with collimation, fibers, etc.) arrives. However, as summarized, there are plenty of methods to begin analyzing absorption line data, but each comes its own defects. There needs to be a discussion amongst the team to decide on how to go forward with this analysis.
Progress worth Noting: This week, there was also research performed on Acetylene gas absorption. From HITRAN, (link http://vpl.astro.washington.edu/spectra/c2h2.htm ) the following Acetylene Gas absorption waveform was found:

From Matlab, the following absorption waveform was found:

HITRAN’s data is in cm^-1. The conversion to nm is 10000000 / _cm^-1 = _nm. By looking at the 2 different types of waveforms, it can be seen that the data gathered by Matlab correlates with HITRAN’s data. Therefore, it can be concluded that the data generated from Matlab is accurate.
Plans for Next Week:
Continue analysis with PASA and RMSE% to find workaround to problems or better implementations.
Implement different analysis methods (Plot comparison, moving average analysis, machine learning, etc.)
Look for Carbon Monoxide cell to get absorption data other than Acetylene Gas.
Use other absorption data to have better ways of testing analysis methods.
In parallel, make changes to GUI to better meet requirements, or to increase efficiency and usability. (Talk with Dr. Asghari)
Comments