diff --git a/BecquerelMonitor/BecquerelMonitor.csproj b/BecquerelMonitor/BecquerelMonitor.csproj index a5dd9c3..d9698ed 100644 --- a/BecquerelMonitor/BecquerelMonitor.csproj +++ b/BecquerelMonitor/BecquerelMonitor.csproj @@ -35,8 +35,8 @@ 2022.07.08.7 true index.html - 3 - 2024.06.07.3 + 1 + 2024.06.11.1 true true true diff --git a/BecquerelMonitor/Properties/AssemblyInfo.cs b/BecquerelMonitor/Properties/AssemblyInfo.cs index 03fa183..02ed4e3 100644 --- a/BecquerelMonitor/Properties/AssemblyInfo.cs +++ b/BecquerelMonitor/Properties/AssemblyInfo.cs @@ -4,13 +4,13 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -[assembly: AssemblyVersion("2024.06.07.3")] +[assembly: AssemblyVersion("2024.06.11.1")] [assembly: AssemblyProduct("BecquerelMonitor")] [assembly: AssemblyCopyright("free")] [assembly: AssemblyTrademark("none")] [assembly: AssemblyConfiguration("")] [assembly: Guid("40110b38-4882-47c1-ad94-a71e58dcb5f8")] -[assembly: AssemblyFileVersion("2024.06.07.3")] +[assembly: AssemblyFileVersion("2024.06.11.1")] [assembly: AssemblyDescription("")] [assembly: AssemblyCompany("free")] [assembly: CompilationRelaxations(8)] diff --git a/BecquerelMonitor/RadiaCodeIn.cs b/BecquerelMonitor/RadiaCodeIn.cs index 5ca43eb..2c532aa 100644 --- a/BecquerelMonitor/RadiaCodeIn.cs +++ b/BecquerelMonitor/RadiaCodeIn.cs @@ -648,11 +648,8 @@ public void run() sendTroubleShoot($"Spectrum real time: {packet.TIME_S}"); sendTroubleShoot($"Spectrum calibration: A0={packet.A0} A1={packet.A1} A2={packet.A2}"); packet.SPECTRUM.CopyTo(hystogram_buffered, 0); - ulong sum = 0; - Parallel.For(0, hystogram_buffered.Length, i => - { - sum += (ulong)hystogram_buffered[i]; - }); + ulong sum = (ulong)hystogram_buffered.Sum(); + if (packet.TIME_S != 0) this.cps = sum / packet.TIME_S; sendTroubleShoot($"Spectrum cps: {this.cps}"); sendTroubleShoot($"Spectrum total counts: {sum}"); diff --git a/BecquerelMonitor/Utils/SpectrumAriphmetics.cs b/BecquerelMonitor/Utils/SpectrumAriphmetics.cs index e7e29b5..801a24b 100644 --- a/BecquerelMonitor/Utils/SpectrumAriphmetics.cs +++ b/BecquerelMonitor/Utils/SpectrumAriphmetics.cs @@ -153,8 +153,8 @@ public EnergySpectrum Substract(EnergySpectrum bgenergySpectrum) { substractedEnergySpectrum.Spectrum[i] = 0; } - substractedEnergySpectrum.TotalPulseCount += substractedEnergySpectrum.Spectrum[i]; }); + substractedEnergySpectrum.TotalPulseCount = substractedEnergySpectrum.Spectrum.Sum(); substractedEnergySpectrum.ValidPulseCount = substractedEnergySpectrum.TotalPulseCount; } else { @@ -170,8 +170,8 @@ public EnergySpectrum Substract(EnergySpectrum bgenergySpectrum) substractedEnergySpectrum.Spectrum[i] = 0; } } - substractedEnergySpectrum.TotalPulseCount += substractedEnergySpectrum.Spectrum[i]; }); + substractedEnergySpectrum.TotalPulseCount = substractedEnergySpectrum.Spectrum.Sum(); substractedEnergySpectrum.ValidPulseCount = substractedEnergySpectrum.TotalPulseCount; } return substractedEnergySpectrum;