fix: RunningQuality must add ssf, not add beat

This commit is contained in:
2026-03-12 21:28:50 +01:00
parent ee77180994
commit bfb3c99184
4 changed files with 20 additions and 6 deletions

View File

@@ -81,10 +81,11 @@ TEST(SignalTest, ranges) {
class DebugRunningQuality : public RunningQuality {
protected:
virtual void dispatchLocked() { locked = true; }
virtual void dispatchBeat(int idx, bool good, double posCorr) { corrs.push_back(posCorr); }
virtual void dispatchBeat(int idx, bool good, double posCorr) { goods.push_back(good); corrs.push_back(posCorr); }
bool locked;
std::vector<double> corrs;
std::vector<bool> goods;
public:
DebugRunningQuality(): locked(false) {}
@@ -92,6 +93,7 @@ public:
virtual ~DebugRunningQuality() {}
bool isLocked() { return locked; }
std::vector<double> getCorrs() { return corrs; }
std::vector<bool> getGoods() { return goods; }
std::vector<double> getBeatTemplate() { return this->beatTemplate; }
};
@@ -210,4 +212,7 @@ TEST(SignalTest, RunningQuality_t2) {
std::vector<double> corrs(sqi.getCorrs());
npy_save("test3/ssf_t3_sqi_corrs.npy", corrs);
std::vector<bool> goods(sqi.getGoods());
npy_save("test3/ssf_t3_sqi_goods.npy", goods);
}

View File

@@ -10,6 +10,13 @@ void npy_save(std::string path, std::vector<double>& x) {
d.shape = {(unsigned long) x.size()};
npy::write_npy(path, d);
}
void npy_save(std::string path, std::vector<bool>& x) {
npy::npy_data_ptr<int> d;
std::vector<int> xx(x.begin(), x.end());
d.data_ptr = xx.data();
d.shape = {(unsigned long) x.size()};
npy::write_npy(path, d);
}
std::vector<double> fetch_y_axis(npy::npy_data<double>& acc) {
// TODO: later on, we should use a vector projection towards gravity

View File

@@ -20,6 +20,7 @@ template <typename T> static std::vector<double> apply_filter(T& filter, std::ve
}
void npy_save(std::string path, std::vector<double>& x);
void npy_save(std::string path, std::vector<bool>& x);
std::vector<double> fetch_y_axis(npy::npy_data<double>& acc);