StatusVector: Use NaN as filler always
Some checks failed
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Failing after 2m56s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Failing after 3m3s
Build Packages / build:rpm (rocky8_nocuda) (push) Failing after 3m11s
Build Packages / build:rpm (ubuntu2204) (push) Failing after 3m2s
Build Packages / build:rpm (rocky8_sls9) (push) Failing after 3m8s
Build Packages / build:rpm (rocky8) (push) Failing after 3m7s
Build Packages / Create release (push) Has been skipped
Build Packages / build:rpm (rocky9_nocuda) (push) Failing after 3m17s
Build Packages / build:rpm (rocky9) (push) Failing after 3m11s
Build Packages / Generate python client (push) Successful in 24s
Build Packages / Build documentation (push) Successful in 40s
Build Packages / build:rpm (ubuntu2404) (push) Failing after 2m20s
Build Packages / Unit tests (push) Has been cancelled

This commit is contained in:
2025-12-08 11:45:37 +01:00
parent e6f9937675
commit ad4ae4d2fe
5 changed files with 191 additions and 189 deletions

View File

@@ -17,41 +17,43 @@ TEST_CASE("StatusVector_GetMeanPerBin","[StatusVector]") {
SECTION("Binning 1000") {
plot = status_vector.GetMeanPerBin(1000, 0.0, 1.0);
REQUIRE(plot.x.size() == 2);
REQUIRE(plot.y.size() == 2);
REQUIRE(plot.x.size() == 3);
REQUIRE(plot.y.size() == 3);
CHECK(plot.x[0] == Catch::Approx(500));
CHECK(plot.x[1] == Catch::Approx(2500));
CHECK(plot.x[1] == Catch::Approx(1500));
CHECK(plot.x[2] == Catch::Approx(2500));
CHECK(plot.y[0] == Catch::Approx(11));
CHECK(plot.y[1] == Catch::Approx((45 + 44 + 41) / 3.0));
CHECK(std::isnan(plot.y[1]));
CHECK(plot.y[2] == Catch::Approx((45 + 44 + 41) / 3.0));
}
SECTION("Binning 500") {
plot = status_vector.GetMeanPerBin(500, 0.0, 1.0);
REQUIRE(plot.x.size() == 3);
REQUIRE(plot.y.size() == 3);
REQUIRE(plot.x.size() == 6);
REQUIRE(plot.y.size() == 6);
CHECK(plot.x[0] == Catch::Approx(250));
CHECK(plot.x[1] == Catch::Approx(2250));
CHECK(plot.x[2] == Catch::Approx(2750));
CHECK(plot.x[4] == Catch::Approx(2250));
CHECK(plot.x[5] == Catch::Approx(2750));
CHECK(plot.y[0] == Catch::Approx(11));
CHECK(plot.y[1] == Catch::Approx(45));
CHECK(plot.y[2] == Catch::Approx((44 + 41) / 2.0));
CHECK(plot.y[4] == Catch::Approx(45));
CHECK(plot.y[5] == Catch::Approx((44 + 41) / 2.0));
}
SECTION("Binning 1") {
plot = status_vector.GetMeanPerBin(1, 0.0, 1.0);
REQUIRE(plot.x.size() == 4);
REQUIRE(plot.y.size() == 4);
CHECK(plot.x[0] == Catch::Approx(5));
CHECK(plot.x[1] == Catch::Approx(2000));
CHECK(plot.x[2] == Catch::Approx(2543));
CHECK(plot.x[3] == Catch::Approx(2600));
REQUIRE(plot.x.size() == 2601);
REQUIRE(plot.y.size() == 2601);
CHECK(plot.x[5] == Catch::Approx(5));
CHECK(plot.x[2000] == Catch::Approx(2000));
CHECK(plot.x[2543] == Catch::Approx(2543));
CHECK(plot.x[2600] == Catch::Approx(2600));
CHECK(plot.y[0] == Catch::Approx(11));
CHECK(plot.y[1] == Catch::Approx(45));
CHECK(plot.y[2] == Catch::Approx(44));
CHECK(plot.y[3] == Catch::Approx(41));
CHECK(plot.y[5] == Catch::Approx(11));
CHECK(plot.y[2000] == Catch::Approx(45));
CHECK(plot.y[2543] == Catch::Approx(44));
CHECK(plot.y[2600] == Catch::Approx(41));
}
}
@@ -71,28 +73,28 @@ TEST_CASE("StatusVector_GetMeanPerBin_Start_Incr","[StatusVector]") {
SECTION("Binning") {
plot = status_vector.GetMeanPerBin(1000, start, incr);
REQUIRE(plot.x.size() == 2);
REQUIRE(plot.y.size() == 2);
REQUIRE(plot.x.size() == 3);
REQUIRE(plot.y.size() == 3);
CHECK(plot.x[0] == Catch::Approx(start + 500 * incr));
CHECK(plot.x[1] == Catch::Approx(start + 2500 * incr));
CHECK(plot.x[2] == Catch::Approx(start + 2500 * incr));
CHECK(plot.y[0] == Catch::Approx(11));
CHECK(plot.y[1] == Catch::Approx((45 + 44 + 41) / 3.0));
CHECK(plot.y[2] == Catch::Approx((45 + 44 + 41) / 3.0));
}
SECTION("No binning") {
plot = status_vector.GetMeanPerBin(1, start, incr);
REQUIRE(plot.x.size() == 4);
REQUIRE(plot.y.size() == 4);
CHECK(plot.x[0] == Catch::Approx(start + 5 * incr));
CHECK(plot.x[1] == Catch::Approx(start + 2000 * incr));
CHECK(plot.x[2] == Catch::Approx(start + 2543 * incr));
CHECK(plot.x[3] == Catch::Approx(start + 2600 * incr));
REQUIRE(plot.x.size() == 2601);
REQUIRE(plot.y.size() == 2601);
CHECK(plot.x[5] == Catch::Approx(start + 5 * incr));
CHECK(plot.x[2000] == Catch::Approx(start + 2000 * incr));
CHECK(plot.x[2543] == Catch::Approx(start + 2543 * incr));
CHECK(plot.x[2600] == Catch::Approx(start + 2600 * incr));
CHECK(plot.y[0] == Catch::Approx(11));
CHECK(plot.y[1] == Catch::Approx(45));
CHECK(plot.y[2] == Catch::Approx(44));
CHECK(plot.y[3] == Catch::Approx(41));
CHECK(plot.y[5] == Catch::Approx(11));
CHECK(plot.y[2000] == Catch::Approx(45));
CHECK(plot.y[2543] == Catch::Approx(44));
CHECK(plot.y[2600] == Catch::Approx(41));
}
}
@@ -109,17 +111,17 @@ TEST_CASE("StatusVector_GetMaxPerBin_Start_Incr","[StatusVector]") {
float start = 545.0f;
float incr = 2.5f;
plot = status_vector.GetMaxPerBin(1, start, incr);
REQUIRE(plot.x.size() == 4);
REQUIRE(plot.y.size() == 4);
CHECK(plot.x[0] == Catch::Approx(start + 5 * incr));
CHECK(plot.x[1] == Catch::Approx(start + 2000 * incr));
CHECK(plot.x[2] == Catch::Approx(start + 2543 * incr));
CHECK(plot.x[3] == Catch::Approx(start + 2600 * incr));
REQUIRE(plot.x.size() == 2601);
REQUIRE(plot.y.size() == 2601);
CHECK(plot.x[5] == Catch::Approx(start + 5 * incr));
CHECK(plot.x[2000] == Catch::Approx(start + 2000 * incr));
CHECK(plot.x[2543] == Catch::Approx(start + 2543 * incr));
CHECK(plot.x[2600] == Catch::Approx(start + 2600 * incr));
CHECK(plot.y[0] == Catch::Approx(11));
CHECK(plot.y[1] == Catch::Approx(45));
CHECK(plot.y[2] == Catch::Approx(44));
CHECK(plot.y[3] == Catch::Approx(41));
CHECK(plot.y[5] == Catch::Approx(11));
CHECK(plot.y[2000] == Catch::Approx(45));
CHECK(plot.y[2543] == Catch::Approx(44));
CHECK(plot.y[2600] == Catch::Approx(41));
}
TEST_CASE("StatusVector_GetMeanPerBin_Fill","[StatusVector]") {
@@ -134,10 +136,9 @@ TEST_CASE("StatusVector_GetMeanPerBin_Fill","[StatusVector]") {
float start = 545.0f;
float incr = 2.5f;
float fill = -345.0f;
SECTION("Binning") {
plot = status_vector.GetMeanPerBin(1000, start, incr, fill);
plot = status_vector.GetMeanPerBin(1000, start, incr);
REQUIRE(plot.x.size() == 3);
REQUIRE(plot.y.size() == 3);
@@ -145,12 +146,12 @@ TEST_CASE("StatusVector_GetMeanPerBin_Fill","[StatusVector]") {
CHECK(plot.x[1] == Catch::Approx(start + 1500 * incr));
CHECK(plot.x[2] == Catch::Approx(start + 2500 * incr));
CHECK(plot.y[0] == Catch::Approx(11.0));
CHECK(plot.y[1] == Catch::Approx(fill));
CHECK(std::isnan(plot.y[1]));
CHECK(plot.y[2] == Catch::Approx((45 + 44 + 41) / 3.0f));
}
SECTION("No Binning") {
plot = status_vector.GetMeanPerBin(1, start, incr, fill);
plot = status_vector.GetMeanPerBin(1, start, incr);
REQUIRE(plot.x.size() == 2601);
REQUIRE(plot.y.size() == 2601);
@@ -159,13 +160,13 @@ TEST_CASE("StatusVector_GetMeanPerBin_Fill","[StatusVector]") {
CHECK(plot.x[2] == Catch::Approx(start + 2 * incr));
CHECK(plot.x[2600] == Catch::Approx(start + 2600 * incr));
CHECK(plot.y[0] == Catch::Approx(fill));
CHECK(plot.y[1] == Catch::Approx(fill));
CHECK(plot.y[2] == Catch::Approx(fill));
CHECK(plot.y[5] == Catch::Approx(11));
CHECK(std::isnan(plot.y[0]));
CHECK(std::isnan(plot.y[1]));
CHECK(std::isnan(plot.y[2]));
CHECK(plot.y[5] == Catch::Approx(11.0f));
CHECK(plot.y[2000] == Catch::Approx(45));
CHECK(plot.y[2543] == Catch::Approx(44));
CHECK(plot.y[2599] == Catch::Approx(fill));
CHECK(std::isnan(plot.y[2599]));
CHECK(plot.y[2600] == Catch::Approx(41));
}
}
@@ -199,32 +200,34 @@ TEST_CASE("StatusVector_GetMaxPerBin","[StatusVector]") {
auto status_out = status_vector.GetMaxPerBin(1000, 0.0, 1.0);
REQUIRE(status_out.x.size() == 2);
REQUIRE(status_out.y.size() == 2);
REQUIRE(status_out.x.size() == 3);
REQUIRE(status_out.y.size() == 3);
REQUIRE(status_out.x[0] == 500);
REQUIRE(status_out.x[1] == 2500);
REQUIRE(status_out.x[1] == 1500);
REQUIRE(status_out.x[2] == 2500);
REQUIRE(status_out.y[0] == 11);
REQUIRE(status_out.y[1] == 45);
REQUIRE(std::isnan(status_out.y[1]));
REQUIRE(status_out.y[2] == 45);
status_out = status_vector.GetMaxPerBin(500, 0.0, 1.0);
REQUIRE(status_out.x.size() == 3);
REQUIRE(status_out.y.size() == 3);
REQUIRE(status_out.x.size() == 6);
REQUIRE(status_out.y.size() == 6);
REQUIRE(status_out.y[0] == 11);
REQUIRE(status_out.y[1] == 45);
REQUIRE(status_out.y[2] == 44);
REQUIRE(status_out.y[4] == 45);
REQUIRE(status_out.y[5] == 44);
status_out = status_vector.GetMaxPerBin(1, 0.0, 1.0);
REQUIRE(status_out.x.size() == 4);
REQUIRE(status_out.y.size() == 4);
REQUIRE(status_out.x[0] == 5);
REQUIRE(status_out.y[0] == 11);
REQUIRE(status_out.x[1] == 2000);
REQUIRE(status_out.y[1] == 45);
REQUIRE(status_out.x[2] == 2543);
REQUIRE(status_out.y[2] == 44);
REQUIRE(status_out.x[3] == 2600);
REQUIRE(status_out.y[3] == 41);
REQUIRE(status_out.x.size() == 2601);
REQUIRE(status_out.y.size() == 2601);
REQUIRE(status_out.x[5] == 5);
REQUIRE(status_out.y[5] == 11);
REQUIRE(status_out.x[2000] == 2000);
REQUIRE(status_out.y[2000] == 45);
REQUIRE(status_out.x[2543] == 2543);
REQUIRE(status_out.y[2543] == 44);
REQUIRE(status_out.x[2600] == 2600);
REQUIRE(status_out.y[2600] == 41);
}
TEST_CASE("StatusVector_ExportArray","[StatusVector]") {
@@ -252,12 +255,14 @@ TEST_CASE("StatusVector_Plot_OneBin","[StatusVector]") {
auto plot_out = status_vector.GetMeanPlot(1000, 0.0, 1.0);
REQUIRE(plot_out.GetPlots().size() == 1);
REQUIRE(plot_out.GetPlots()[0].x.size() == 2);
REQUIRE(plot_out.GetPlots()[0].y.size() == 2);
REQUIRE(plot_out.GetPlots()[0].x[0] == Catch::Approx(5));
REQUIRE(plot_out.GetPlots()[0].y[0] == Catch::Approx(11));
REQUIRE(plot_out.GetPlots()[0].x[1] == Catch::Approx(7));
REQUIRE(plot_out.GetPlots()[0].y[1] == Catch::Approx(12));
REQUIRE(plot_out.GetPlots()[0].x.size() == 8);
REQUIRE(plot_out.GetPlots()[0].y.size() == 8);
REQUIRE(plot_out.GetPlots()[0].x[3] == Catch::Approx(3));
REQUIRE(std::isnan(plot_out.GetPlots()[0].y[3]));
REQUIRE(plot_out.GetPlots()[0].x[5] == Catch::Approx(5));
REQUIRE(plot_out.GetPlots()[0].y[5] == Catch::Approx(11));
REQUIRE(plot_out.GetPlots()[0].x[7] == Catch::Approx(7));
REQUIRE(plot_out.GetPlots()[0].y[7] == Catch::Approx(12));
}
TEST_CASE("StatusVector_Plot_NoBinning","[StatusVector]") {
@@ -266,10 +271,12 @@ TEST_CASE("StatusVector_Plot_NoBinning","[StatusVector]") {
auto plot_out = status_vector.GetMaxPlot(1, 0.0, 1.0);
REQUIRE(plot_out.GetPlots().size() == 1);
REQUIRE(plot_out.GetPlots()[0].x.size() == 1);
REQUIRE(plot_out.GetPlots()[0].y.size() == 1);
REQUIRE(plot_out.GetPlots()[0].x[0] == Catch::Approx(5));
REQUIRE(plot_out.GetPlots()[0].y[0] == Catch::Approx(11));
REQUIRE(plot_out.GetPlots()[0].x.size() == 6);
REQUIRE(plot_out.GetPlots()[0].y.size() == 6);
REQUIRE(plot_out.GetPlots()[0].x[4] == Catch::Approx(4));
REQUIRE(std::isnan(plot_out.GetPlots()[0].y[4]));
REQUIRE(plot_out.GetPlots()[0].x[5] == Catch::Approx(5));
REQUIRE(plot_out.GetPlots()[0].y[5] == Catch::Approx(11));
}
TEST_CASE("StatusMultiVector","[StatusMultiVector]") {
@@ -310,9 +317,16 @@ TEST_CASE("StatusVector_Clear","[StatusVector]") {
auto plot = status_vector.GetMeanPlot(1, 0.0, 1.0);
REQUIRE(plot.GetPlots().size() == 1);
REQUIRE(plot.GetPlots()[0].x.size() == 2);
REQUIRE(plot.GetPlots()[0].x[0] == 50);
REQUIRE(plot.GetPlots()[0].x[1] == 80);
REQUIRE(plot.GetPlots()[0].x.size() == 81);
REQUIRE(plot.GetPlots()[0].y.size() == 81);
REQUIRE(plot.GetPlots()[0].x[5] == 5);
REQUIRE(plot.GetPlots()[0].x[8] == 8);
REQUIRE(std::isnan(plot.GetPlots()[0].y[5]));
REQUIRE(std::isnan(plot.GetPlots()[0].y[8]));
REQUIRE(plot.GetPlots()[0].x[50] == 50);
REQUIRE(plot.GetPlots()[0].x[80] == 80);
REQUIRE(plot.GetPlots()[0].y[50] == 200);
REQUIRE(plot.GetPlots()[0].y[80] == 100);
}
TEST_CASE("StatusVector_GetElement","[StatusVector]") {