Skip to content

Commit

Permalink
Some small optimization of peak finding
Browse files Browse the repository at this point in the history
  • Loading branch information
Am6er committed May 4, 2024
1 parent 147050a commit 65379ed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions BecquerelMonitor/FWHMPeakDetector/Spectrum.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Threading.Tasks;

namespace BecquerelMonitor.FWHMPeakDetector
{
Expand Down Expand Up @@ -93,11 +94,10 @@ public Spectrum(EnergySpectrum energySpectrum)
this.bin_centers_raw = new double[counts.Length + 1];
this.bin_widths_raw = new double[counts.Length + 1];

for (int i = 0; i < counts.Length; i++)
{
Parallel.For(0, counts.Length, i => {
this.counts[i] = Convert.ToDouble(energySpectrum.Spectrum[i]);
this.bin_edges_raw[i] = Convert.ToDouble(i);
}
});
this.bin_edges_raw[counts.Length] = Convert.ToDouble(counts.Length);


Expand Down

0 comments on commit 65379ed

Please sign in to comment.