Editing
Spectra serial output
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Spectrum_Processing.c == <pre> float tempSpectrum1[SPECTRA_SIZE]; float tempSpectrum2[SPECTRA_SIZE]; float tempSpectrum3[SPECTRA_SIZE]; //gets the spectrum from the FPGA and converts it accordingly (ev, cps, uA) //input -- pointer to reading strcuture to put the processed spectrum //intput --uAps that spectrrum was acquired at //output -- processed spectrum int he reading strcuture void processMeasurementSpectrum( float liveTime,volatile STRUCT_READING_DATA* reading, float uAmps,float *spectraSum, bool averagePriorSpectrum) { float localLiveTime = liveTime; //! don't need to zero out processedSpectrum as the //! function below overwrites any data in there getFinalSpectrum_float(processedSpectrum,SPECTRA_SIZE); for (int i = 0; i < SPECTRA_SIZE; i++) tempSpectrum1[i] = processedSpectrum[i]; //Copy the raw spectrum so that we can use it later in the backscatter check memcpy(unprocessedSpectrum,processedSpectrum,SPECTRA_SIZE * sizeof(float) ); //convert processedspectrum to cps/uA in ev versus bins convertSpectrumToLive_Ev_Ua( SPECTRA_SIZE, stDetParam.stDetSettings[detectorParams.currentShaperSettings].fEscale, stDetParam.stDetSettings[detectorParams.currentShaperSettings].fEzero, processedSpectrum, fEv_per_bin, 1.0, //pass in 1 here as I do not actually wish to divide by current here localLiveTime, spectraSum); //We need somewhere to through the spectra sum or the unprocessed spectrum float unprocessedSum; //We need to convert the unprocessed spectrum seperately, since it will have a different, unaveraged live time convertSpectrumToLive_Ev_Ua( SPECTRA_SIZE, stDetParam.stDetSettings[detectorParams.currentShaperSettings].fEscale, stDetParam.stDetSettings[detectorParams.currentShaperSettings].fEzero, unprocessedSpectrum, fEv_per_bin, 1.0, //pass in 1 here as I do not actually wish to divide by current here liveTime, &unprocessedSum); for (int i = 0; i < SPECTRA_SIZE; i++) tempSpectrum2[i] = processedSpectrum[i]; fullSpectrumSumPeakCorrection(SPECTRA_SIZE,processedSpectrum); removeSpectrumEscapePeak(SPECTRA_SIZE,processedSpectrum); for (int i = 0; i < SPECTRA_SIZE; i++) tempSpectrum3[i] = processedSpectrum[i]; </pre>
Summary:
Please note that all contributions to SoftwareGuy may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
SoftwareGuy:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information