diff --git a/google-tests/test1.cpp b/google-tests/test1.cpp index c9fd64d..b878edf 100644 --- a/google-tests/test1.cpp +++ b/google-tests/test1.cpp @@ -2,7 +2,6 @@ // Created by david on 28.02.2026. // #include -#include "library.h" #include "iir_filter.h" #include "npy.hpp" #include @@ -10,16 +9,6 @@ #include #include -// Demonstrate some basic assertions. -TEST(HelloTest, BasicAssertions) { - // Expect two strings not to be equal. - EXPECT_STRNE("hello", "world from test1.cpp"); - // Expect equality. - EXPECT_EQ(7 * 6, 42); - printf("asdf"); - hello(); -} - TEST(HelloTest, Load_npy_matrix) { // "C:\\Users\\david\\Documents\\src\\libpasada\\cmake-build-debug\\google-tests" std::cout << std::filesystem::current_path() << std::endl; diff --git a/google-tests/test3.cpp b/google-tests/test3.cpp index c1dfa4c..021db0e 100644 --- a/google-tests/test3.cpp +++ b/google-tests/test3.cpp @@ -151,9 +151,7 @@ TEST(SignalTest, RunningQuality_t2) { std::vector signal = fetch_y_axis(acc); -#if (FPS != 60) -#error "FPS must currently be 60, as highpass taps are pre-computed for that value" -#endif + double fps = 60.0; // TODO: SQI: cehck input file // TODO: SQI: print debug values corr,idx, checkedSsf @@ -174,20 +172,20 @@ TEST(SignalTest, RunningQuality_t2) { //std::cerr << "before stage 2" << std::endl; // Stage 2: sum slope function - SsfFilter f_ssf(FPS); + SsfFilter f_ssf(fps); auto ssf = apply_filter(f_ssf, y_neg); //std::cerr << "before stage 3" << std::endl; // Stage 3: threshold detection - DebugSsfStepDetectorThreshold f_ssd_thr(FPS); + DebugSsfStepDetectorThreshold f_ssd_thr(fps); auto ssf_threshold = apply_filter(f_ssd_thr, ssf); //std::cerr << "before writing results 1 and doing step detection" << std::endl; npy_save("test2/ssf_t3_ssf_threshold.npy", ssf_threshold); - SsfStepDetector f_ssd(FPS); + SsfStepDetector f_ssd(fps); auto steps = apply_filter(f_ssd, ssf); //std::cerr << "before writing results 2" << std::endl; diff --git a/google-tests/test4.cpp b/google-tests/test4.cpp index 668de29..4e8ac6b 100644 --- a/google-tests/test4.cpp +++ b/google-tests/test4.cpp @@ -11,14 +11,16 @@ TEST(StepDetector, t1_sub_sample_resolution) { npy::npy_data s = npy::read_npy("test4/step_150a.npy"); + double fps = 60.0; + std::vector signal = fetch_y_axis(s); const size_t N = signal.size(); - const size_t N_INIT = SsfStepDetector::initial_samples(FPS); + const size_t N_INIT = SsfStepDetector::initial_samples(fps); - StepDetector det(FPS, nullptr, true); + StepDetector det(fps, nullptr, true); // initialize: feed for priming the filters - det.primeFilters(FPS, signal); + det.primeFilters(fps, signal); // feed for actual test for (size_t i = 0; i < N; i++) { diff --git a/google-tests/test5.cpp b/google-tests/test5.cpp index d07f095..78bb497 100644 --- a/google-tests/test5.cpp +++ b/google-tests/test5.cpp @@ -19,9 +19,7 @@ TEST(HelloTest, Zong_SSF_Test5_a1) { std::vector signal = fetch_y_axis(acc, 2); // (ts, x, y, z) entries -> fetch 'y' -#if (FPS != 60) -#error "FPS must currently be 60, as highpass taps are pre-computed for that value" -#endif + double fps = 60.0; // Butterworth filter: order=5, fc=0.5, fs=60, btype='highpass' std::vector b {0.91875845, -4.59379227, 9.18758454, -9.18758454, 4.59379227, -0.91875845}; @@ -40,13 +38,13 @@ TEST(HelloTest, Zong_SSF_Test5_a1) { //std::cerr << "before stage 2" << std::endl; // Stage 2: sum slope function - SsfFilter f_ssf(FPS); + SsfFilter f_ssf(fps); auto ssf = apply_filter(f_ssf, y_neg); //std::cerr << "before stage 3" << std::endl; // Stage 3: threshold detection - DebugSsfStepDetectorThreshold f_ssd_thr(FPS); + DebugSsfStepDetectorThreshold f_ssd_thr(fps); auto ssf_threshold = apply_filter(f_ssd_thr, ssf); //std::cerr << "before writing results 1 and doing step detection" << std::endl; @@ -55,7 +53,7 @@ TEST(HelloTest, Zong_SSF_Test5_a1) { npy_save("test5/ssf_a1_ssf.npy", ssf); npy_save("test5/ssf_a1_ssf_threshold.npy", ssf_threshold); - SsfStepDetector f_ssd(FPS); + SsfStepDetector f_ssd(fps); auto steps = apply_filter(f_ssd, ssf); //std::cerr << "before writing results 2" << std::endl; diff --git a/pasada-lib/CMakeLists.txt b/pasada-lib/CMakeLists.txt index fbcb8e8..bd6c334 100644 --- a/pasada-lib/CMakeLists.txt +++ b/pasada-lib/CMakeLists.txt @@ -1,7 +1,6 @@ project(Pasada_Lib) SET(PASADA_SRC - library.cpp iir_filter.cpp ssf_filter.cpp pd_signal.cpp diff --git a/pasada-lib/include/library.h b/pasada-lib/include/library.h deleted file mode 100644 index 7dc7aec..0000000 --- a/pasada-lib/include/library.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef LIBPASADA_LIBRARY_H -#define LIBPASADA_LIBRARY_H - -void hello(); - -#endif // LIBPASADA_LIBRARY_H \ No newline at end of file diff --git a/pasada-lib/include/ssf_filter.h b/pasada-lib/include/ssf_filter.h index 284fccb..f2fd46d 100644 --- a/pasada-lib/include/ssf_filter.h +++ b/pasada-lib/include/ssf_filter.h @@ -8,7 +8,7 @@ #include "iir_filter.h" #include -#define FPS 60 +/** max step rate detected: defines the length of "refractory period" which ignores additional, spurious edges in accelerometer */ #define MAX_BPM 300 /** diff --git a/pasada-lib/library.cpp b/pasada-lib/library.cpp deleted file mode 100644 index 461e8d7..0000000 --- a/pasada-lib/library.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "library.h" - -#include - -void hello() { - std::cout << "Hello, World!" << std::endl; -} \ No newline at end of file diff --git a/pasada-lib/step_detector.cpp b/pasada-lib/step_detector.cpp index 8a8570c..5487f75 100644 --- a/pasada-lib/step_detector.cpp +++ b/pasada-lib/step_detector.cpp @@ -13,10 +13,6 @@ StepDetector::StepDetector(double fps, StepListener *listener, bool debug) : debug(debug) {} -#if (FPS != 60) -#error "FPS must currently be 60, as highpass taps are pre-computed for that value" -#endif - void StepDetector::filter(std::vector values) { // TODO: later on, we should use a vector projection towards gravity auto s1 = (double) values[1]; // take y-axis value for now