XRF Spectral Processing: Difference between revisions
Created page with "== XRF Spectral Processing == Spectrum_Processing.c === combinePreviousSpectra === <code>void combinePreviousSpectra ( volatile STRUCT_READING_DATA* reading, int whatFilter)</code> === getWorkingSpectrumAvgPower === <code>float getWorkingSpectrumAvgPower( volatile STRUCT_READING_DATA* reading)</code> === processMeasurementSpectrum === <code>processMeasurementSpectrum(...)</code>: * This function gets a float version of the raw da..." |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 32: | Line 32: | ||
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. | 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 | This first piece is done in | ||
processMeasurementSpectrum | |||
<pre> | <pre> | ||
for (int i = 0; i < SPECTRA_SIZE; i++) | for (int i = 0; i < SPECTRA_SIZE; i++) | ||
tempSpectrum[i] = processedSpectrum[i]; | tempSpectrum[i] = processedSpectrum[i]; | ||
</pre> | </pre> | ||
Now at the end of <code>MakeMeasurement</code> I add a little piece of code to print out the final spectrum. | Now at the end of <code>MakeMeasurement</code> I add a little piece of code to print out the final spectrum. | ||
<pre> | <pre> | ||
for (int i = 0; i < SPECTRA_SIZE; i++) | for (int i = 0; i < SPECTRA_SIZE; i++) | ||
s_msg("%d, %f", i, tempSpectrum[i] ); | s_msg("%d, %f", i, tempSpectrum[i] ); | ||
</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>