top of page
Search

Week of 11/06/2017 - Progress Report 5

  • Ezequiel Partida & Jonathan DeRouen
  • Nov 13, 2017
  • 5 min read

Topics Covered: Study on Cross Correlation, NIST Acetylene Absorption Data Verification

Materials: Matlab (v. 2014b or newer)

Summary: Last week, analysis on absorption spectroscopy was performed by using the Matlab built-in function ‘xcorr’, which applies a correlation coefficient to 2 sets of data by multiplying each point in one of the sets to all of the points in the other set recursively. This week, a similar approach was taken, however using a more scripted code (i.e. coded from scratch to do the same). The general idea is to be able to get 2 sets of data, and determine whether or not they are the same/similar shape. In order to do this, the following equation will be used,

where C is the correlation coefficient between the 2 sets of data, X1 and X2. Last week, the ‘xcorr’ function was applied to an acetylene gas absorption line spectrum, generating the coefficient value shown below.

Using the same data, analysis was performed using the new correlation equation (Shown in the first picture), and the ‘xcorr’ function in order to compare the results side-by-side. The following code was used, generating the following results.

As shown above, the new equation seems to provide the same correlation coefficient as the ‘xcorr’ function. If that holds true, then using the new equation will prove to be useful, since it is capable of analyzing the resemblance of 2 data sets, which is needed to determine the strength of an absorption spectrum vs a known reference. Therefore, in order to prove that the new equation is reliable, 3 unit tests were scripted, comparing the results from the 2 methods above on several sinusoidal data inputs. A simple sine function was compared to a cosine, a sinc, and an addition between a sine and cosine, in order to generate results that will provide perfect shape correlation, close to no correlation, and a value in between. The following code was used, generating the results shown below.

As shown above, for the case where the ‘xcorr’ function and the new equation were compared using a comparison between a Sine and a Cosine function, the 2 methods generated correlation coefficients of 1. This makes sense, since a sine is merely a 90 degree phase shift of a cosine, producing only a time delay and not an amplitude scaling. Therefore, correlation between the 2 data should have been perfect, regarding the overall shape, and they were. The next comparison was between the same sine function and a Sinc. Since the Sinc function decays exponentially, it should drift from its sine counterpart dramatically giving very low correlation. As shown above, that was also the case since both methods generated correlation coefficients of virtually 0. The final case that was tested was between the same sine function and an addition between a sine and cosine. As shown on the plot above, the addition has both a phase shift from the sine function, and an amplitude scaling. Therefore, there should be a correlation, but not a strong one. As shown above, that was once again the case, as both methods generated exactly the same coefficients (0.70707).

Since the extremes and in between values were tested for correlation coefficients, it can be assumed that either of the methods is reliable when it comes to comparing the shapes of 2 datasets. However, there is an edge case that is not accounted for below. If 2 datasets being compared are not the same length, then both methods will not work, as shown below.

In order to bypass this, then for the larger dataset, interpolation will be performed to make the data the same length. This week, the source data for acetylene gas absorption was acquired from NIST. The data can be acquired as an excel spreadsheet, or as a text file. For future reference with respect to the GUI, all data saved/imported will be used as text files since all OS and computers can read text. However, for ease and simplicity, the NIST data was acquired as an excel spreadsheet for Matlab analysis to be made faster. As shown below, the NIST reference for acetylene gas absorption is 15000 points large.

Since reference data acquired from the OSA saved on the computer is 10000 points large, both correlation methods will not be compatible to compare the 2 data. Therefore, the NIST data will be interpolated with the OSA data in order to make them the same length. However, when the Matlab built-in function ‘interp1’ is used to interpolate the NIST data, there are NaN values scattered throughout. Therefore, ‘xcorr’ could not be used, but the new equation can be modified to eliminate all NaN values. Once all NaN values are eliminated, a correlation coefficient can be generated.

The following code shows the acquisition of the NIST and OSA data and interpolation:

The following code shows the elimination of all NaN values in the NIST interpolation and the generation of a correlation coefficient.

The following results are generated when running the code.

As shown above, the data was plotted to show the OSA absorption of acetylene, the NIST data, and the interpolated data. Also shown is that the correlation between the OSA data and the interpolated NIST data is of 0.9762. This proves 2 things. The first thing that this proves is that the new equation can be used to generate correlation coefficients of any types of data sets, whether they’re the same length or not. This is useful because this analysis of shape of data is not dependent on size. The second thing that these results prove is that the OSA captures reliable absorption data. The correlation is high, more than 97% correlation. Therefore, it can be assumed that future readings of the OSA, even glucose, can be taken as reliable.

The only problem now is to continue looking for an analysis technique to differentiate between discrepancies in the x-axis, not just comparison between shapes.

Other progress that was attempted this week was to continue editing the GUI to make it more readable and useful. However, in that process, the linkage between the code and the .fig file was lost. Therefore, the GUI will have to be restarted from scratch. The good thing is that all the code is saved, it is just a matter of copying and pasting. This progress will be completed in the following week.

Other progress that was attempted was to begin capturing readings from the femtosecond laser and from glucose. However, the IR card that is available seems to not work with the laser. Therefore, the setup cannot be started since alignment cannot be measured. Further attempts will be made this week.

Progress involving practice of previous techniques analyzing glucose have been halted due to the photodiode losing a pin while rebuilding the voltage/ concentration sensing circuit. Luckily the break was clean and we hope to solder the broken pin back to its port and continue testing the system. The circuit itself was redesigned to be resistor biased to avoid the saturation effect from the output signal.

Plans for Next Week:

1. Recover GUI

2. Update interface to make more professional

3. Get started with optical setup (use 3D-printed collimator holder if not available)

4. Get started on glucose readings

5. Apply current analysis techniques to data gathered


 
 
 

Comments


© 2017 Designed by Tamara Jovanovic, Ezequiel Partida & Jonathan DeRouen. 

bottom of page