|
16 | 16 | // Author(s): Craig McDonald ([email protected])
|
17 | 17 |
|
18 | 18 | #include <MEL/Core/Timer.hpp>
|
19 |
| -#include <MEL/Logging/DataLogger.hpp> |
| 19 | +#include <MEL/Logging/Csv.hpp> |
20 | 20 | #include <MEL/Math/Butterworth.hpp>
|
21 | 21 | #include <MEL/Math/Filter.hpp>
|
22 | 22 | #include <MEL/Math/Functions.hpp>
|
@@ -46,31 +46,26 @@ int main() {
|
46 | 46 | double x = 0.5 + o;
|
47 | 47 |
|
48 | 48 | // initialize data logger to write immediately to file
|
49 |
| - DataLogger data_logger(WriterType::Buffered, false); |
50 |
| - std::vector<std::string> header = {"Input", "LPF Output", "HPF Output", |
51 |
| - "LPF Seeded Output", |
52 |
| - "HPF Seeded Output"}; |
53 |
| - data_logger.set_header(header); |
| 49 | + Csv csv("filter.csv"); |
| 50 | + csv.write_row("Input", "LPF Output", "HPF Output", "LPF Seeded Output", "HPF Seeded Output"); |
54 | 51 |
|
55 | 52 | // data storage container
|
56 |
| - std::vector<double> data_record(header.size()); |
| 53 | + std::vector<double> data(5); |
57 | 54 |
|
58 | 55 | // begin filtering and logging data
|
59 | 56 | for (int i = 0; i < samples; ++i) {
|
60 | 57 | // generate input signal
|
61 | 58 | x = r * (x - o) * (1 - (x - o)) + o;
|
62 | 59 |
|
63 | 60 | // filter input signal and store data
|
64 |
| - data_record[0] = x; |
65 |
| - data_record[1] = lp_filter.update(x); |
66 |
| - data_record[2] = hp_filter.update(x); |
67 |
| - data_record[3] = lps_filter.update(x); |
68 |
| - data_record[4] = hps_filter.update(x); |
| 61 | + data[0] = x; |
| 62 | + data[1] = lp_filter.update(x); |
| 63 | + data[2] = hp_filter.update(x); |
| 64 | + data[3] = lps_filter.update(x); |
| 65 | + data[4] = hps_filter.update(x); |
69 | 66 |
|
70 | 67 | // write to data log buffer
|
71 |
| - data_logger.buffer(data_record); |
| 68 | + csv.write_row(data); |
72 | 69 | }
|
73 | 70 |
|
74 |
| - data_logger.save_data("example_filter_data", ".", false); |
75 |
| - |
76 | 71 | }
|
0 commit comments