From 099a5f074e169c5bd1b1685aca7a940c15455101 Mon Sep 17 00:00:00 2001 From: Apollo3zehn Date: Mon, 18 Sep 2023 17:10:07 +0200 Subject: [PATCH] Fixed a bug in the mean-polar-degree algorithm --- CHANGELOG.md | 5 +++++ src/Nexus/Services/ProcessingService.cs | 4 ++++ version.json | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f6059da..cb075e7a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## v2.0.0-beta.17 - 2023-09-18 + +### Bugs fixed: +- Fixed a bug in the mean-polar-degree algorithm which caused the result of be offset by a random value. + ## v2.0.0-beta.16 - 2023-09-18 ### Bugs fixed: diff --git a/src/Nexus/Services/ProcessingService.cs b/src/Nexus/Services/ProcessingService.cs index 90f51762..f4505922 100644 --- a/src/Nexus/Services/ProcessingService.cs +++ b/src/Nexus/Services/ProcessingService.cs @@ -160,6 +160,7 @@ private void ApplyAggregationFunction( { var sinBuffer = memoryOwner_sin.Memory.Slice(0, targetBuffer.Length); var cosBuffer = memoryOwner_cos.Memory.Slice(0, targetBuffer.Length); + var limit = 360; var factor = 2 * Math.PI / limit; @@ -180,6 +181,9 @@ private void ApplyAggregationFunction( if (isHighQuality) { + sin[x] = 0.0; + cos[x] = 0.0; + for (int i = 0; i < chunkData.Length; i++) { sin[x] += Math.Sin(chunkData[i] * factor); diff --git a/version.json b/version.json index b143d82d..275cdb3c 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { "version": "2.0.0", - "suffix": "beta.16" + "suffix": "beta.17" } \ No newline at end of file