XRF Spectral Processing: Difference between revisions
No edit summary |
No edit summary |
||
Line 34: | Line 34: | ||
This first piece is done in | This first piece is done in | ||
processMeasurementSpectrum | |||
<pre> | <pre> |
Latest revision as of 18:10, 19 March 2023
XRF Spectral Processing[edit | edit source]
Spectrum_Processing.c
combinePreviousSpectra[edit | edit source]
<code>void combinePreviousSpectra ( volatile STRUCT_READING_DATA* reading, int whatFilter)</code>
getWorkingSpectrumAvgPower[edit | edit source]
<code>float getWorkingSpectrumAvgPower( volatile STRUCT_READING_DATA* reading)</code>
processMeasurementSpectrum[edit | edit source]
<code>processMeasurementSpectrum(...)</code>:
- This function gets a float version of the raw data and puts it into a local buffer (on the stack as of now).
- It converts the spectrum to cps/uA.
- Removes escape peaks.
- Does Sum Peak correction.
- Load the reading structure.
getFinalSpectrum_float[edit | edit source]
<code>void getFinalSpectrum_float(float *spectrum, int numberOfBins)</code>
convertSpectrumToLive_Ev_Ua[edit | edit source]
<code>convertSpectrumToLive_Ev_Ua(...)</code>
- This function re-bins the spectrum based on the current escale.
removeSpectrumEscapePeak[edit | edit source]
<code>void removeSpectrumEscapePeak (int numBins, float *spectrum)</code>
fullSpectrumSumPeakCorrection[edit | edit source]
<code>void fullSpectrumSumPeakCorrection(int numBins, float *spectrum)</code>
Test Code[edit | edit source]
I am adding a little piece of test code to display the raw spectrum at the end of the reading. To do this I first need to save the raw spectrum into a temp buffer. This is done repeatedly until the trigger is release.
This first piece is done in
processMeasurementSpectrum
<pre> for (int i = 0; i < SPECTRA_SIZE; i++) tempSpectrum[i] = processedSpectrum[i]; </pre>
Now at the end of <code>MakeMeasurement</code> I add a little piece of code to print out the final spectrum.
<pre> for (int i = 0; i < SPECTRA_SIZE; i++) s_msg("%d, %f", i, tempSpectrum[i] ); </pre>