Skip to content

Commit

Permalink
Fix. Add format specification URL + add some fixes according specific…
Browse files Browse the repository at this point in the history
…ation.
  • Loading branch information
Am6er committed Dec 17, 2024
1 parent 6418c10 commit 51ed112
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions BecquerelMonitor/BecquerelMonitor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
<MinimumRequiredVersion>2022.07.08.7</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>index.html</WebPage>
<ApplicationRevision>2</ApplicationRevision>
<ApplicationVersion>2024.12.17.2</ApplicationVersion>
<ApplicationRevision>3</ApplicationRevision>
<ApplicationVersion>2024.12.17.3</ApplicationVersion>
<UseApplicationTrust>true</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
Expand Down
16 changes: 8 additions & 8 deletions BecquerelMonitor/DocumentManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,10 @@ public void ImportDocumentGBS(DocEnergySpectrum doc, string filePath)
doc.Filename = fileName + ".xml";
doc.Text = fileName;

// $SPEC_ID:
// From https://www.gbs-elektronik.de/media/download_gallery/Ritecdat_e.pdf
// $SPEC_ID: or $APPLICATION_ID: or $DEVICE_ID:
string fileheader = streamReader.ReadLine();
if (fileheader != "$SPEC_ID:")
if (fileheader != "$SPEC_ID:" && fileheader != "$APPLICATION_ID:" && fileheader != "$DEVICE_ID:")
{
throw new Exception(String.Format(Resources.ERROpenGBSFormat, fileheader));
}
Expand Down Expand Up @@ -571,16 +572,15 @@ public void ImportDocumentGBS(DocEnergySpectrum doc, string filePath)
fileheader = streamReader.ReadLine();
while (true)
{
if (fileheader == "$ENER_DATA:") break;
if (fileheader == "$ENER_DATA_X:") break;
fileheader = streamReader.ReadLine();
}

// skip first string
streamReader.ReadLine();
int numpoints = XmlConvert.ToInt32(streamReader.ReadLine().Trim());

// read base calibration
List<CalibrationPoint> points = new List<CalibrationPoint>();
for (int i = 0; i < 3; i++)
for (int i = 0; i < numpoints; i++)
{
string calibrationData = streamReader.ReadLine();
int channel = XmlConvert.ToInt32(calibrationData.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)[0].Trim());
Expand All @@ -590,7 +590,7 @@ public void ImportDocumentGBS(DocEnergySpectrum doc, string filePath)
points.Add(point);
}

double[] matrix = Utils.CalibrationSolver.Solve(points, 2);
double[] matrix = Utils.CalibrationSolver.Solve(points, numpoints - 1);
PolynomialEnergyCalibration energyCalibration = (PolynomialEnergyCalibration)energySpectrum.EnergyCalibration;
energyCalibration.Coefficients = new double[matrix.Length];
energyCalibration.PolynomialOrder = matrix.Length - 1;
Expand All @@ -611,7 +611,7 @@ public void ImportDocumentGBS(DocEnergySpectrum doc, string filePath)

int TotalPulseCount = XmlConvert.ToInt32(streamReader.ReadLine().Trim());
energySpectrum.TotalPulseCount = TotalPulseCount;
energySpectrum.ValidPulseCount = energySpectrum.Spectrum.Sum();
energySpectrum.ValidPulseCount = TotalPulseCount;

streamReader.Close();
}
Expand Down
4 changes: 2 additions & 2 deletions BecquerelMonitor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyVersion("2024.12.17.2")]
[assembly: AssemblyVersion("2024.12.17.3")]
[assembly: AssemblyProduct("BecquerelMonitor")]
[assembly: AssemblyCopyright("free")]
[assembly: AssemblyTrademark("none")]
[assembly: AssemblyConfiguration("")]
[assembly: Guid("40110b38-4882-47c1-ad94-a71e58dcb5f8")]
[assembly: AssemblyFileVersion("2024.12.17.2")]
[assembly: AssemblyFileVersion("2024.12.17.3")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("free")]
[assembly: CompilationRelaxations(8)]
Expand Down

0 comments on commit 51ed112

Please sign in to comment.