Spectra serial output
Spectrum_Processing.c[edit | edit source]
<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>
Measure.c[edit | edit source]
<pre> for (int i = 0; i < SPECTRA_SIZE; i++) s_msg(" %d, %f, %f, %f", i, tempSpectrum1[i], tempSpectrum2[i], tempSpectrum3[i]);
}// void MakeMeasurement (...... </pre>