From f36a3193ddd417b041b3d23f6b3f8b244b24cb67 Mon Sep 17 00:00:00 2001
From: Erik Strand <erik.strand@cba.mit.edu>
Date: Wed, 8 May 2019 21:01:23 -0400
Subject: [PATCH] Change termination condition for part f

---
 main.cpp   | 14 +++++---------
 plotter.py |  8 ++++----
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/main.cpp b/main.cpp
index 84a41cf..8d236ed 100644
--- a/main.cpp
+++ b/main.cpp
@@ -104,7 +104,7 @@ int main() {
     python_print("recovered_sample_values", recovered_sample_values);
 
     // Part (d)
-    constexpr uint32_t n_subsamples = 100;
+    constexpr uint32_t n_subsamples = 200;
     std::vector<uint32_t> const subset_indices = select_subsample(n_samples, n_subsamples);
     Vector subset_sample_times = vector_subset(sample_times, subset_indices);
     Vector subset_sample_values = vector_subset(sample_values, subset_indices);
@@ -119,7 +119,7 @@ int main() {
     Vector subset_differences = subset_sample_values - subset_recovered_sample_values;
     Scalar loss = subset_differences.squaredNorm();
     Vector gradient = -2 * subset_dct_matrix * subset_differences;
-    constexpr Scalar learning_rate = 0.5;
+    constexpr Scalar learning_rate = 0.1;
     while (loss > 1e-6) {
         recovered_dct -= learning_rate * gradient;
         recovered_sample_values = dct_matrix.transpose() * recovered_dct;
@@ -139,17 +139,13 @@ int main() {
     subset_differences = subset_sample_values - subset_recovered_sample_values;
     loss = subset_differences.squaredNorm() + recovered_dct.squaredNorm();
     gradient = -2 * subset_dct_matrix * subset_differences + 2 * recovered_dct;
-    Scalar last_loss = std::numeric_limits<Scalar>::infinity();
-    Scalar relative_change = (loss - last_loss) / loss;
-    while (relative_change > 1e-6) {
+    while (gradient.squaredNorm() > 1e-3) {
         recovered_dct -= learning_rate * gradient;
         recovered_sample_values = dct_matrix.transpose() * recovered_dct;
         subset_recovered_sample_values = vector_subset(recovered_sample_values, subset_indices);
         subset_differences = subset_sample_values - subset_recovered_sample_values;
         loss = subset_differences.squaredNorm() + recovered_dct.squaredNorm();
         gradient = -2 * subset_dct_matrix * subset_differences + 2 * recovered_dct;
-        last_loss = std::numeric_limits<Scalar>::infinity();
-        relative_change = (loss - last_loss) / loss;
         //std::cout << loss << '\n';
     }
     Scalar const final_loss_f = loss;
@@ -163,8 +159,8 @@ int main() {
     loss = subset_differences.squaredNorm() + recovered_dct.cwiseAbs().sum();
     gradient = -2 * subset_dct_matrix * subset_differences
         + (recovered_dct.array() / recovered_dct.cwiseAbs().array()).matrix();
-    last_loss = std::numeric_limits<Scalar>::infinity();
-    relative_change = (loss - last_loss) / loss;
+    Scalar last_loss = std::numeric_limits<Scalar>::infinity();
+    Scalar relative_change = (loss - last_loss) / loss;
     while (relative_change > 1e-6) {
         recovered_dct -= learning_rate * gradient;
         recovered_sample_values = dct_matrix.transpose() * recovered_dct;
diff --git a/plotter.py b/plotter.py
index 04ad7aa..7f4575d 100644
--- a/plotter.py
+++ b/plotter.py
@@ -5,10 +5,10 @@ sample_times = np.array([0, 4.01606e-05, 8.03213e-05, 0.000120482, 0.000160643,
 sample_values = np.array([0, 0.475338, 0.917539, 1.29619, 1.5861, 1.76932, 1.83651, 1.78761, 1.6316, 1.38558, 1.0731, 0.721928, 0.361558, 0.0205522, -0.27594, -0.508314, -0.664077, -0.738727, -0.735864, -0.666533, -0.547871, -0.401193, -0.249706, -0.116065, -0.0200166, 0.0236569, 0.00668195, -0.0718098, -0.205127, -0.379618, -0.575975, -0.771114, -0.94046, -1.06042, -1.1108, -1.07697, -0.951487, -0.73516, -0.43726, -0.0750177, 0.327653, 0.742071, 1.13718, 1.48217, 1.7492, 1.91577, 1.96681, 1.89599, 1.70642, 1.41042, 1.02857, 0.588008, 0.120163, -0.341839, -0.765935, -1.12376, -1.39294, -1.5588, -1.61544, -1.56598, -1.42199, -1.20225, -0.930797, -0.634626, -0.341124, -0.0755387, 0.141293, 0.294754, 0.377636, 0.390584, 0.341783, 0.245913, 0.122481, -0.00631234, -0.117955, -0.19203, -0.212412, -0.169044, -0.0591181, 0.112454, 0.333336, 0.584794, 0.843377, 1.08309, 1.27787, 1.40408, 1.44291, 1.38232, 1.21838, 0.95598, 0.608661, 0.197701, -0.249515, -0.701696, -1.12623, -1.49192, -1.77159, -1.94442, -1.99773, -1.92798, -1.74113, -1.45207, -1.08332, -0.663067, -0.222778, 0.205515, 0.591886, 0.910992, 1.14409, 1.28044, 1.31795, 1.26307, 1.12989, 0.938508, 0.713012, 0.478999, 0.261091, 0.0805585, -0.0466774, -0.11149, -0.112311, -0.0551393, 0.0472029, 0.176484, 0.311019, 0.427974, 0.505792, 0.526522, 0.477802, 0.354329, 0.158647, -0.0988122, -0.400459, -0.722977, -1.03934, -1.32121, -1.54155, -1.67714, -1.71079, -1.63312, -1.44356, -1.15069, -0.771708, -0.33113, 0.14113, 0.6122, 1.04895, 1.42074, 1.70194, 1.87404, 1.9271, 1.86053, 1.68299, 1.41149, 1.06984, 0.686454, 0.291854, -0.0840174, -0.414358, -0.677735, -0.859784, -0.954231, -0.963144, -0.896411, -0.770496, -0.606599, -0.428405, -0.259632, -0.121617, -0.0311657, 0.00112032, -0.0281042, -0.11461, -0.247029, -0.408011, -0.575983, -0.727348, -0.838913, -0.890317, -0.866221, -0.75805, -0.565119, -0.295029, 0.0367266, 0.407896, 0.791266, 1.15696, 1.47502, 1.71807, 1.86376, 1.89685, 1.81066, 1.60779, 1.30007, 0.907671, 0.457475, -0.019091, -0.488655, -0.918654, -1.28001, -1.54948, -1.71149, -1.75931, -1.69539, -1.53092, -1.28466, -0.981105, -0.648113, -0.314394, -0.00689592, 0.25156, 0.444213, 0.561694, 0.602629, 0.573475, 0.487607, 0.363754, 0.223933, 0.0910946, -0.0133094, -0.0715908, -0.0717057, -0.00857246, 0.115302, 0.289952, 0.498828, 0.720336, 0.929905, 1.10238, 1.21454, 1.24743, 1.18842, 1.03264, 0.783761, 0.453978, 0.0632207, -0.36236, -0.792506, -1.19536, -1.54017, -1.79994, -1.95375, -1.9886, -1.9006, -1.69531, -1.38735, -0.999124, -0.559002, -0.0988865, 0.348445])
 dct = np.array([0.0493937, 1.53249, 0.0703373, 1.58311, 0.071832, 1.69718, 0.0744769, 1.91051, 0.0785496, 2.32168, 0.0845789, 3.29439, 0.0938324, 8.09608, -0.948385, -5.98402, 0.120253, -1.12508, 0.152546, 0.119667, 0.214371, 1.22218, 0.385667, 4.39185, 3.03895, -8.90656, -0.469319, -2.524, -0.208824, -1.50006, -0.13078, -1.06566, -0.0934123, -0.821045, -0.0716006, -0.662819, -0.0573687, -0.551709, -0.0473917, -0.469331, -0.0400375, -0.405854, -0.0344114, -0.355506, -0.0299824, -0.314665, -0.0264156, -0.280932, -0.0234894, -0.252653, -0.0210515, -0.228649, -0.0189938, -0.208056, -0.0172374, -0.190227, -0.0157237, -0.174667, -0.0144081, -0.16099, -0.013256, -0.148893, -0.0122403, -0.138131, -0.0113395, -0.128509, -0.0105363, -0.119865, -0.00981652, -0.112068, -0.00916866, -0.105006, -0.00858312, -0.0985874, -0.00805189, -0.092734, -0.00756824, -0.0873795, -0.0071265, -0.0824671, -0.00672179, -0.0779483, -0.00634998, -0.073781, -0.00600749, -0.0699287, -0.00569123, -0.0663596, -0.0053985, -0.0630459, -0.00512696, -0.0599632, -0.00487456, -0.0570899, -0.00463947, -0.0544069, -0.00442012, -0.0518974, -0.00421508, -0.0495463, -0.00402309, -0.0473402, -0.00384303, -0.045267, -0.00367391, -0.0433158, -0.00351482, -0.0414771, -0.00336496, -0.0397421, -0.0032236, -0.0381027, -0.00309008, -0.0365518, -0.00296382, -0.035083, -0.00284426, -0.0336903, -0.00273093, -0.0323682, -0.00262338, -0.0311119, -0.0025212, -0.0299168, -0.00242403, -0.0287789, -0.00233151, -0.0276942, -0.00224334, -0.0266594, -0.00215923, -0.0256711, -0.00207892, -0.0247266, -0.00200217, -0.0238229, -0.00192875, -0.0229577, -0.00185846, -0.0221285, -0.0017911, -0.0213332, -0.0017265, -0.0205698, -0.00166449, -0.0198364, -0.00160493, -0.0191312, -0.00154766, -0.0184527, -0.00149255, -0.0177994, -0.00143949, -0.0171698, -0.00138835, -0.0165626, -0.00133904, -0.0159765, -0.00129144, -0.0154105, -0.00124547, -0.0148635, -0.00120103, -0.0143343, -0.00115805, -0.0138221, -0.00111644, -0.013326, -0.00107613, -0.0128451, -0.00103706, -0.0123786, -0.000999157, -0.0119258, -0.00096236, -0.011486, -0.000926612, -0.0110584, -0.000891859, -0.0106425, -0.000858049, -0.0102376, -0.000825132, -0.00984319, -0.000793062, -0.00945872, -0.000761795, -0.00908367, -0.00073129, -0.00871754, -0.000701505, -0.00835987, -0.000672404, -0.00801022, -0.000643949, -0.00766816, -0.000616107, -0.00733328, -0.000588845, -0.0070052, -0.00056213, -0.00668355, -0.000535933, -0.00636796, -0.000510224, -0.0060581, -0.000484977, -0.00575364, -0.000460163, -0.00545426, -0.000435757, -0.00515967, -0.000411735, -0.00486955, -0.000388072, -0.00458364, -0.000364745, -0.00430165, -0.000341732, -0.00402332, -0.000319012, -0.00374839, -0.000296562, -0.00347661, -0.000274362, -0.00320774, -0.000252393, -0.00294153, -0.000230635, -0.00267776, -0.000209069, -0.00241619, -0.000187676, -0.0021566, -0.000166438, -0.00189878, -0.000145337, -0.00164251, -0.000124355, -0.00138757, -0.000103475, -0.00113376, -8.26789e-05, -0.000880865, -6.19504e-05, -0.000628682, -4.12723e-05, -0.000377007, -2.06278e-05, -0.000125635])
 recovered_sample_values = np.array([3.71932e-15, 0.475338, 0.917539, 1.29619, 1.5861, 1.76932, 1.83651, 1.78761, 1.6316, 1.38558, 1.0731, 0.721928, 0.361558, 0.0205522, -0.27594, -0.508314, -0.664077, -0.738727, -0.735864, -0.666533, -0.547871, -0.401193, -0.249706, -0.116065, -0.0200166, 0.0236569, 0.00668195, -0.0718098, -0.205127, -0.379618, -0.575975, -0.771114, -0.94046, -1.06042, -1.1108, -1.07697, -0.951487, -0.73516, -0.43726, -0.0750177, 0.327653, 0.742071, 1.13718, 1.48217, 1.7492, 1.91577, 1.96681, 1.89599, 1.70642, 1.41042, 1.02857, 0.588008, 0.120163, -0.341839, -0.765935, -1.12376, -1.39294, -1.5588, -1.61544, -1.56598, -1.42199, -1.20225, -0.930797, -0.634626, -0.341124, -0.0755387, 0.141293, 0.294754, 0.377636, 0.390584, 0.341783, 0.245913, 0.122481, -0.00631234, -0.117955, -0.19203, -0.212412, -0.169044, -0.0591181, 0.112454, 0.333336, 0.584794, 0.843377, 1.08309, 1.27787, 1.40408, 1.44291, 1.38232, 1.21838, 0.95598, 0.608661, 0.197701, -0.249515, -0.701696, -1.12623, -1.49192, -1.77159, -1.94442, -1.99773, -1.92798, -1.74113, -1.45207, -1.08332, -0.663067, -0.222778, 0.205515, 0.591886, 0.910992, 1.14409, 1.28044, 1.31795, 1.26307, 1.12989, 0.938508, 0.713012, 0.478999, 0.261091, 0.0805585, -0.0466774, -0.11149, -0.112311, -0.0551393, 0.0472029, 0.176484, 0.311019, 0.427974, 0.505792, 0.526522, 0.477802, 0.354329, 0.158647, -0.0988122, -0.400459, -0.722977, -1.03934, -1.32121, -1.54155, -1.67714, -1.71079, -1.63312, -1.44356, -1.15069, -0.771708, -0.33113, 0.14113, 0.6122, 1.04895, 1.42074, 1.70194, 1.87404, 1.9271, 1.86053, 1.68299, 1.41149, 1.06984, 0.686454, 0.291854, -0.0840174, -0.414358, -0.677735, -0.859784, -0.954231, -0.963144, -0.896411, -0.770496, -0.606599, -0.428405, -0.259632, -0.121617, -0.0311657, 0.00112032, -0.0281042, -0.11461, -0.247029, -0.408011, -0.575983, -0.727348, -0.838913, -0.890317, -0.866221, -0.75805, -0.565119, -0.295029, 0.0367266, 0.407896, 0.791266, 1.15696, 1.47502, 1.71807, 1.86376, 1.89685, 1.81066, 1.60779, 1.30007, 0.907671, 0.457475, -0.019091, -0.488655, -0.918654, -1.28001, -1.54948, -1.71149, -1.75931, -1.69539, -1.53092, -1.28466, -0.981105, -0.648113, -0.314394, -0.00689592, 0.25156, 0.444213, 0.561694, 0.602629, 0.573475, 0.487607, 0.363754, 0.223933, 0.0910946, -0.0133094, -0.0715908, -0.0717057, -0.00857246, 0.115302, 0.289952, 0.498828, 0.720336, 0.929905, 1.10238, 1.21454, 1.24743, 1.18842, 1.03264, 0.783761, 0.453978, 0.0632207, -0.36236, -0.792506, -1.19536, -1.54017, -1.79994, -1.95375, -1.9886, -1.9006, -1.69531, -1.38735, -0.999124, -0.559002, -0.0988865, 0.348445])
-subset_sample_times = np.array([0.000200803, 0.000240964, 0.000281124, 0.000321285, 0.000441767, 0.00064257, 0.000883534, 0.00100402, 0.00104418, 0.00116466, 0.00120482, 0.00124498, 0.00144578, 0.00148594, 0.00164659, 0.00180723, 0.00184739, 0.00192771, 0.00200803, 0.00212851, 0.00240964, 0.00248996, 0.00261044, 0.00289157, 0.00293173, 0.00305221, 0.00313253, 0.00317269, 0.00321285, 0.00325301, 0.00333333, 0.00345382, 0.00369478, 0.00373494, 0.0037751, 0.00389558, 0.00405622, 0.00413655, 0.00425703, 0.00429719, 0.00433735, 0.00437751, 0.00441767, 0.00449799, 0.00453815, 0.00465863, 0.0046988, 0.00473896, 0.00481928, 0.00485944, 0.0048996, 0.00518072, 0.00522088, 0.0053012, 0.00554217, 0.00570281, 0.00574297, 0.00586345, 0.00626506, 0.00630522, 0.00634538, 0.00646586, 0.00658635, 0.00662651, 0.00670683, 0.00674699, 0.00694779, 0.00698795, 0.00702811, 0.00706827, 0.00710843, 0.00714859, 0.00718876, 0.00726908, 0.00730924, 0.00742972, 0.0075502, 0.00763052, 0.00771084, 0.00779116, 0.00791165, 0.00799197, 0.00807229, 0.00811245, 0.00815261, 0.00819277, 0.00823293, 0.00827309, 0.00839357, 0.00843373, 0.00883534, 0.00891566, 0.00903614, 0.00923695, 0.00927711, 0.00935743, 0.00963855, 0.00975904, 0.00983936, 0.01])
-subset_sample_values = np.array([1.76932, 1.83651, 1.78761, 1.6316, 0.721928, -0.664077, -0.249706, 0.0236569, 0.00668195, -0.379618, -0.575975, -0.771114, -0.951487, -0.73516, 0.742071, 1.91577, 1.96681, 1.70642, 1.02857, -0.341839, -1.42199, -0.930797, -0.0755387, 0.122481, -0.00631234, -0.212412, -0.0591181, 0.112454, 0.333336, 0.584794, 1.08309, 1.44291, -0.249515, -0.701696, -1.12623, -1.94442, -1.45207, -0.663067, 0.591886, 0.910992, 1.14409, 1.28044, 1.31795, 1.12989, 0.938508, 0.261091, 0.0805585, -0.0466774, -0.112311, -0.0551393, 0.0472029, 0.354329, 0.158647, -0.400459, -1.71079, -0.771708, -0.33113, 1.04895, 0.291854, -0.0840174, -0.414358, -0.954231, -0.770496, -0.606599, -0.259632, -0.121617, -0.247029, -0.408011, -0.575983, -0.727348, -0.838913, -0.890317, -0.866221, -0.565119, -0.295029, 0.791266, 1.71807, 1.89685, 1.60779, 0.907671, -0.488655, -1.28001, -1.71149, -1.75931, -1.69539, -1.53092, -1.28466, -0.981105, -0.00689592, 0.25156, -0.0715908, -0.00857246, 0.498828, 1.24743, 1.18842, 0.783761, -1.79994, -1.9006, -1.38735, 0.348445])
-dct_e = np.array([-0.999984, -0.736924, 0.511211, -0.0826997, 0.0655345, -0.562082, -0.905911, 0.357729, 0.358593, 0.869386, -0.232996, 0.0388327, 0.661931, -0.930856, -0.893077, 0.0594004, 0.342299, -0.984604, -0.233169, -0.866316, -0.165028, 0.373545, 0.177953, 0.860873, 0.692334, 0.0538576, -0.81607, 0.307838, -0.168001, 0.402381, 0.820642, 0.524396, -0.475094, -0.905071, 0.472164, -0.343532, 0.265277, 0.512821, 0.982075, -0.269323, -0.505922, 0.965101, 0.445321, 0.506712, 0.303037, -0.854628, 0.263269, 0.769414, -0.45458, -0.127177, 0.53299, -0.0445365, -0.524451, -0.450186, -0.28147, -0.666986, -0.0269652, 0.795313, 0.818416, -0.878871, 0.809306, 0.00904579, 0.0325839, -0.361934, 0.973284, -0.0120466, -0.467711, -0.818534, 0.895528, -0.852502, 0.00141419, -0.231716, -0.445836, 0.827635, 0.0594948, -0.0711084, 0.88196, -0.899832, 0.523029, 0.540409, 0.655635, -0.749269, -0.968265, 0.376911, 0.736494, 0.259087, 0.472449, 0.450824, 0.998916, 0.777144, -0.53361, -0.387356, -0.29797, 0.0265474, 0.182227, 0.691963, -0.175838, 0.683021, -0.461365, -0.169211, 0.074608, -0.0641653, -0.425575, -0.643345, -0.69256, 0.14331, 0.604811, -0.933892, 0.0688997, -0.00303976, 0.910722, 0.496585, 0.109168, 0.781475, 0.249699, 0.684079, -0.680465, -0.574497, 0.42942, -0.739145, -0.818019, -0.450824, -0.994001, -0.171413, -0.946247, 0.419639, 0.875795, -0.520178, -0.638208, -0.364921, 0.773981, 0.304117, -0.69933, 0.362692, -0.228371, -0.224549, -0.000517935, -0.704934, 0.174373, 0.691151, 0.180217, 0.910818, 0.112292, -0.703697, 0.96661, -0.182467, -0.71636, 0.129797, -0.495747, -0.0229709, -0.0719389, 0.92219, -0.747938, -0.600486, -0.361501, 0.258538, -0.746576, 0.302507, 0.243268, 0.606146, -0.504316, -0.0471364, -0.221372, -0.593499, -0.94325, 0.803347, -0.147005, -0.715958, 0.894974, -0.179374, -0.737623, 0.771297, -0.815653, -0.675603, -0.857873, -0.269322, -0.493885, -0.729781, 0.566306, -0.0893854, -0.300952, -0.0953997, 0.617889, 0.863349, 0.303292, -0.569503, 0.359185, 0.817844, -0.499749, 0.72172, -0.0574753, 0.0119118, 0.200787, 0.635123, 0.511687, -0.07551, 0.902735, 0.265477, -0.121339, 0.649395, 0.377962, 0.404413, 0.974291, 0.90883, 0.702539, -0.421368, 0.0748515, 0.0288693, -0.793132, -0.171943, 0.153433, 0.753131, -0.119923, 0.459495, 0.738527, 0.431285, 0.601441, 0.413071, 0.483432, -0.961815, 0.772062, 0.0499748, -0.0733545, -0.869612, 0.426845, -0.0221137, 0.335358, 0.364098, -0.600891, 0.833268, 0.731765, 0.780037, 0.0878966, -0.72161, -0.0993051, 0.978725, -0.568936, -0.107953, -0.368535, 0.0293189, 0.763008, -0.120549, -0.0649364, 0.6133, -0.269684, -0.576962, 0.998233, -0.692791, 0.260977, 0.232701])
-dct_f = np.array([-0.99881, -0.998242, 0.546704, 0.45467, -0.361645, -0.164553, 0.364988, 0.361124, -0.589476, 0.67284, 0.417841, 0.657416, -0.810902, -0.836525, 0.52801, 0.259144, -0.572296, -0.572906, -0.837878, -0.222354, 0.904319, 0.89509, -0.220293, -0.461571, 0.384338, -0.43193, 0.553732, 0.56773, -0.15508, -0.435688, -0.612065, -0.977368, -0.616352, 0.966472, -0.511892, 0.639452, -0.72709, -0.203713, 0.20202, -0.646239, 0.656709, -0.684538, 0.975874, -0.485663, -0.532802, -0.796725, -0.561179, 0.269435, 0.392015, 0.58954, 0.392486, 0.505881, 0.339041, 0.26686, -0.887119, 0.196433, -0.545985, -0.362444, 0.399669, -0.765126, 0.525141, 0.0522466, 0.107823, 0.175978, -0.340667, 0.405979, -0.713909, -0.676625, -0.0293496, 0.720451, 0.626531, 0.113672, 0.477993, -0.367985, -0.729336, 0.0570965, -0.378522, 0.176238, 0.0361672, -0.138304, -0.482314, -0.259547, -0.213965, -0.106268, -0.0482076, -0.224338, -0.441414, -0.843474, -0.260516, -0.492155, 0.343568, 0.352474, 0.0278727, 0.457217, 0.441536, 0.889506, -0.0786053, 0.880326, -0.35688, -0.0791317, 0.0342906, 0.322711, -0.196334, 0.211279, 0.973005, -0.699212, 0.340197, -0.312365, 0.0834203, 0.0456154, 0.658477, -0.970099, -0.451581, 0.285958, 0.0922732, 0.835695, -0.466773, 0.940173, -0.506534, 0.687951, 0.388047, -0.0884968, 0.634203, -0.955833, -0.678502, 0.4139, 0.415653, -0.126723, 0.164842, 0.50342, 0.983066, 0.391358, -0.440977, 0.507725, -0.657642, -0.991492, -0.00861785, -0.840166, -0.673838, 0.806602, 0.565984, 0.493358, -0.127149, -0.987317, 0.169574, 0.0369568, -0.8663, 0.0880454, -0.220537, -0.568348, -0.228461, 0.253723, 0.318107, 0.41864, 0.0773226, -0.439422, 0.631864, -0.256181, 0.372203, -0.379662, -0.981305, -0.792405, 0.0419201, 0.551761, -0.55863, -0.889442, -0.85873, -0.679452, 0.447527, -0.405956, -0.898795, -0.0443914, -0.0856762, 0.039977, -0.107021, -0.699377, -0.428115, 0.667364, 0.391275, 0.155552, 0.362329, -0.33765, -0.885049, 0.973766, 0.0847863, -0.996685, 0.712385, -0.941289, -0.244899, -0.0206966, 0.152346, 0.477917, 0.358664, 0.0725335, -0.928825, -0.754986, 0.946711, -0.623448, -0.297363, 0.228251, 0.215223, -0.748134, 0.105724, 0.908057, -0.28615, 0.676203, 0.948505, -0.481972, -0.496945, -0.151328, 0.626096, 0.795828, -0.510828, 0.521235, 0.389713, -0.0962975, -0.47276, 0.331007, -0.766858, -0.580875, -0.772649, 0.0939497, -0.987841, -0.648051, 0.198719, -0.136183, -0.834987, 0.374829, -0.24938, 0.672413, -0.752725, 0.946692, -0.940729, -0.839294, -0.0115107, 0.538875, 0.868061, -0.499689, -0.280684, 0.538228, -8.93376e-05, 0.498503, 0.343807, 0.363332, 0.51354, -0.927265, -0.538856, -0.556665, 0.125204, 0.305244])
+subset_sample_times = np.array([0, 8.03213e-05, 0.000200803, 0.000240964, 0.000281124, 0.000321285, 0.000361446, 0.000401606, 0.000441767, 0.000522088, 0.000562249, 0.00060241, 0.00064257, 0.000682731, 0.000722892, 0.000763052, 0.000803213, 0.000843373, 0.000883534, 0.00100402, 0.00104418, 0.0011245, 0.00116466, 0.00120482, 0.00124498, 0.0013253, 0.00136546, 0.00144578, 0.00148594, 0.0015261, 0.00164659, 0.00168675, 0.00176707, 0.00180723, 0.00184739, 0.00192771, 0.00196787, 0.00200803, 0.00208835, 0.00212851, 0.00216867, 0.00220884, 0.00228916, 0.00236948, 0.00240964, 0.0024498, 0.00248996, 0.00253012, 0.00261044, 0.00269076, 0.00273092, 0.00277108, 0.00281124, 0.00285141, 0.00289157, 0.00293173, 0.00297189, 0.00301205, 0.00305221, 0.00309237, 0.00313253, 0.00317269, 0.00321285, 0.00325301, 0.00329317, 0.00333333, 0.00341365, 0.00345382, 0.00353414, 0.0035743, 0.00361446, 0.00369478, 0.00373494, 0.0037751, 0.00381526, 0.00385542, 0.00389558, 0.00401606, 0.00405622, 0.00409639, 0.00413655, 0.00417671, 0.00421687, 0.00425703, 0.00429719, 0.00433735, 0.00437751, 0.00441767, 0.00449799, 0.00453815, 0.00461847, 0.00465863, 0.0046988, 0.00473896, 0.00477912, 0.00481928, 0.00485944, 0.0048996, 0.00502008, 0.00506024, 0.0051004, 0.00518072, 0.00522088, 0.00526104, 0.0053012, 0.00534137, 0.00538153, 0.00542169, 0.00546185, 0.00554217, 0.00558233, 0.00562249, 0.00570281, 0.00574297, 0.00578313, 0.00582329, 0.00586345, 0.00590361, 0.00594378, 0.00598394, 0.00606426, 0.00614458, 0.00618474, 0.0062249, 0.00626506, 0.00630522, 0.00634538, 0.00638554, 0.0064257, 0.00646586, 0.00650602, 0.00658635, 0.00662651, 0.00670683, 0.00674699, 0.00678715, 0.00682731, 0.00694779, 0.00698795, 0.00702811, 0.00706827, 0.00710843, 0.00714859, 0.00718876, 0.00722892, 0.00726908, 0.00730924, 0.0073494, 0.00742972, 0.0075502, 0.00759036, 0.00763052, 0.00767068, 0.00771084, 0.007751, 0.00779116, 0.00783133, 0.00791165, 0.00795181, 0.00799197, 0.00803213, 0.00807229, 0.00811245, 0.00815261, 0.00819277, 0.00823293, 0.00827309, 0.00831325, 0.00835341, 0.00839357, 0.00843373, 0.00851406, 0.00855422, 0.00859438, 0.00863454, 0.0086747, 0.00871486, 0.00883534, 0.0088755, 0.00891566, 0.00895582, 0.00899598, 0.00903614, 0.00911647, 0.00915663, 0.00923695, 0.00927711, 0.00931727, 0.00935743, 0.00947791, 0.00951807, 0.00959839, 0.00963855, 0.00967871, 0.00975904, 0.00983936, 0.00987952, 0.00991968, 0.00995984, 0.01])
+subset_sample_values = np.array([0, 0.917539, 1.76932, 1.83651, 1.78761, 1.6316, 1.38558, 1.0731, 0.721928, 0.0205522, -0.27594, -0.508314, -0.664077, -0.738727, -0.735864, -0.666533, -0.547871, -0.401193, -0.249706, 0.0236569, 0.00668195, -0.205127, -0.379618, -0.575975, -0.771114, -1.06042, -1.1108, -0.951487, -0.73516, -0.43726, 0.742071, 1.13718, 1.7492, 1.91577, 1.96681, 1.70642, 1.41042, 1.02857, 0.120163, -0.341839, -0.765935, -1.12376, -1.5588, -1.56598, -1.42199, -1.20225, -0.930797, -0.634626, -0.0755387, 0.294754, 0.377636, 0.390584, 0.341783, 0.245913, 0.122481, -0.00631234, -0.117955, -0.19203, -0.212412, -0.169044, -0.0591181, 0.112454, 0.333336, 0.584794, 0.843377, 1.08309, 1.40408, 1.44291, 1.21838, 0.95598, 0.608661, -0.249515, -0.701696, -1.12623, -1.49192, -1.77159, -1.94442, -1.74113, -1.45207, -1.08332, -0.663067, -0.222778, 0.205515, 0.591886, 0.910992, 1.14409, 1.28044, 1.31795, 1.12989, 0.938508, 0.478999, 0.261091, 0.0805585, -0.0466774, -0.11149, -0.112311, -0.0551393, 0.0472029, 0.427974, 0.505792, 0.526522, 0.354329, 0.158647, -0.0988122, -0.400459, -0.722977, -1.03934, -1.32121, -1.54155, -1.71079, -1.63312, -1.44356, -0.771708, -0.33113, 0.14113, 0.6122, 1.04895, 1.42074, 1.70194, 1.87404, 1.86053, 1.41149, 1.06984, 0.686454, 0.291854, -0.0840174, -0.414358, -0.677735, -0.859784, -0.954231, -0.963144, -0.770496, -0.606599, -0.259632, -0.121617, -0.0311657, 0.00112032, -0.247029, -0.408011, -0.575983, -0.727348, -0.838913, -0.890317, -0.866221, -0.75805, -0.565119, -0.295029, 0.0367266, 0.791266, 1.71807, 1.86376, 1.89685, 1.81066, 1.60779, 1.30007, 0.907671, 0.457475, -0.488655, -0.918654, -1.28001, -1.54948, -1.71149, -1.75931, -1.69539, -1.53092, -1.28466, -0.981105, -0.648113, -0.314394, -0.00689592, 0.25156, 0.561694, 0.602629, 0.573475, 0.487607, 0.363754, 0.223933, -0.0715908, -0.0717057, -0.00857246, 0.115302, 0.289952, 0.498828, 0.929905, 1.10238, 1.24743, 1.18842, 1.03264, 0.783761, -0.36236, -0.792506, -1.54017, -1.79994, -1.95375, -1.9006, -1.38735, -0.999124, -0.559002, -0.0988865, 0.348445])
+dct_e = np.array([-0.196094, 1.18936, 0.479573, 0.663146, -0.080901, 0.577832, -0.148233, 1.01453, -0.197465, 2.00114, -0.294051, 2.11453, 0.213071, 6.16016, -0.731251, -4.70639, 0.256332, -1.53081, 0.259213, -0.0554509, -0.415897, 1.23824, -1.31813, 3.16587, 2.08398, -7.2223, -0.677869, -2.43735, -0.0684313, -1.19933, -0.423981, -0.599289, -1.02476, -0.993441, -0.0777809, -0.865453, -0.074759, -0.345011, -0.281427, -0.203953, -0.622912, 0.275884, 0.111848, -0.296558, 0.264995, 0.430286, -0.281935, 0.0723075, -0.307119, -0.364219, 0.0657357, 0.44006, 0.799354, -0.769753, 0.285176, 0.950941, -0.280907, -0.00497288, 0.296292, -0.642131, 0.889798, 1.09052, 0.400533, -0.304707, 0.246949, 0.293316, 0.323294, -0.533684, 0.474883, 0.195358, 0.637553, 0.580914, -0.0442756, -0.0349357, 0.657594, -0.154956, 0.690376, 0.0426053, 0.71097, 0.0513258, 0.60229, -0.234083, 0.0678623, -0.829127, 0.544893, -0.0570755, 0.341786, 0.779736, 0.287186, -0.0968679, 0.556942, 0.120861, 0.0556344, -0.566939, -0.413085, 0.573418, -0.0885655, 0.293251, 0.261079, -0.256654, 0.0575593, 0.94802, -0.54351, -0.436904, -0.961599, 0.230876, 0.0726653, -0.0600418, -0.528705, -0.0715482, 0.457052, 0.823255, -0.345286, -0.327319, -0.0162373, -0.663708, 0.0437903, -0.493872, -0.79755, -0.238856, -0.609117, -0.187032, 0.187882, 0.231953, -0.202489, -0.264078, -0.396135, -0.0454859, -0.0553627, -0.512516, 0.011238, -0.620677, 0.366957, -0.58604, -0.100525, -0.460264, -0.571354, -1.07625, 0.346349, -0.634828, 0.237577, 0.734295, 0.464448, -0.453415, -0.417422, 0.0399954, 0.129525, -0.628497, -1.76705, -0.512841, -0.129151, 1.00282, -0.322279, 0.391106, 0.0401609, 0.404917, 0.467034, -0.025818, -0.80657, 0.084261, -0.907793, -0.502164, 0.370733, -0.148036, -0.417506, 0.504627, -0.511599, 0.576102, 0.806729, 0.434816, -0.288823, 0.564942, -0.1185, -0.422731, -0.0933278, 0.0328392, -0.264447, 0.0941453, 0.974272, -0.557034, 0.394226, 0.210044, 0.757861, -0.577916, -0.0323905, 0.274702, 1.41617, 0.327861, -0.045681, -0.0263465, -0.332338, 0.299948, 0.196235, -0.435646, 0.223145, 0.681411, 0.332371, 0.0769544, 0.441301, 0.259661, 0.270069, -0.0829026, 0.816754, -0.0269315, 1.1196, 0.186495, -0.335414, -0.693516, 0.642428, -1.09616, 0.213204, 0.679919, 0.549171, 0.157623, 1.03292, 1.01379, -0.0463448, 0.347021, -0.017238, -0.628042, -0.532548, 0.770155, 0.0893456, 0.257188, -0.369556, 0.376224, 0.284265, 0.966083, -0.138508, 0.136536, -0.493359, 1.13903, -0.0016658, -0.455193, -0.646744, 0.676872, -0.703003, 0.797936, 0.322608, 0.587281, 0.0820393, 0.584012, -0.96235, -0.145036, -0.153075, -0.230502, -0.460132, 0.722142, 0.810725, -0.216875])
+dct_f = np.array([-0.128202, 0.625785, 0.0201692, 0.398691, 0.144763, 0.490854, 0.0956919, 0.650749, 0.0173706, 0.902481, 0.0810071, 1.23349, -0.134141, 3.10943, -0.307434, -2.28341, 0.0897043, -0.677982, 0.238718, -0.0569493, -0.0625467, 0.678633, -0.399306, 1.59969, 1.07472, -3.58733, -0.175665, -1.22954, -0.073115, -0.642949, -0.32888, -0.293621, -0.33002, -0.461082, -0.0924337, -0.261168, 0.0365576, -0.268522, -0.19366, -0.142064, -0.291814, 0.0633658, 0.0429835, -0.159101, 0.176932, 0.167059, -0.0376179, -0.0163244, -0.290812, -0.133946, 0.118496, 0.265316, 0.117899, -0.380144, 0.0815734, 0.390314, 0.0166088, -0.106858, 0.112289, -0.258428, 0.431392, 0.478348, 0.0876306, -0.154815, -0.061415, 0.150749, 0.0786899, -0.0259306, 0.14254, -0.051765, 0.260549, 0.321238, -0.0298536, -0.236221, 0.109051, -0.151414, 0.289132, 0.0607066, 0.138025, -0.072031, 0.218627, 0.0156062, 0.0406325, -0.520255, 0.247159, -0.154366, 0.206985, 0.16453, 0.157685, -0.293041, 0.0767808, 0.10905, 0.118047, -0.371501, -0.148446, 0.218044, -0.0529188, 0.00374332, 0.0224681, -0.0576681, -0.0306463, 0.257711, -0.0644529, -0.0882774, -0.50266, 0.0187881, 0.00477641, -0.0816121, -0.252274, -0.0786066, 0.261582, 0.330727, -0.0604508, -0.157064, -0.302593, -0.380228, 0.030939, -0.134265, -0.463183, -0.133715, 0.0123524, 0.0958193, 0.094654, 0.0480209, -0.0655042, -0.366965, -0.276783, 0.0918902, -0.0780344, -0.235922, -0.0770751, 0.0460241, 0.260871, -0.24325, 0.0715379, -0.147367, -0.280814, -0.315655, 0.183873, -0.293842, 0.0506389, 0.362196, 0.272027, 0.00189439, -0.285468, 0.298874, 0.0664038, -0.192419, -0.528099, -0.224467, -0.188268, 0.395158, 0.163009, 0.27742, -0.120604, 0.177714, 0.283735, 0.0160217, -0.251383, 0.00552576, -0.316482, -0.116127, 0.239018, 0.120915, 0.00778038, -0.0171491, -0.238564, 0.256053, 0.271199, 0.308677, -0.058214, 0.16632, 0.134117, -0.0719508, 0.00850059, 0.000685789, -0.0666121, 0.0378622, 0.403544, -0.277101, 0.268779, 0.185174, 0.276086, -0.283073, 0.0229385, 0.0953724, 0.561176, 0.0569767, 0.204422, -0.166952, -0.177897, 0.09501, 0.0628256, -0.0611136, -0.0329177, 0.120971, 0.0986958, 0.119868, 0.233474, -0.0227016, -0.145502, -0.117204, 0.208528, -0.151173, 0.524241, 0.0341692, -0.293842, -0.185265, 0.268604, -0.352157, -0.182337, 0.0817727, 0.234098, -0.0181577, 0.296696, 0.350259, -0.0718085, -0.000718198, -0.0585872, -0.234716, -0.332507, 0.26509, -0.0116758, 0.0687702, -0.172702, 0.14437, 0.00131067, 0.172244, -0.0201932, 0.0983488, -0.209788, 0.225785, -0.231219, 0.00300628, -0.292026, 0.0532718, -0.300906, 0.413064, 0.029319, 0.221479, -0.032181, 0.152876, -0.593108, -0.191158, -0.0322509, -0.0192836, -0.291647, 0.530207, 0.395767, -0.078254])
 dct_g = np.array([0.233221, -0.257069, -0.550398, -0.532617, 0.306023, -0.668145, 0.488208, -0.680485, -0.904723, 0.323987, -0.75011, 0.898314, -0.0316391, 0.242091, 0.82805, -0.964111, 0.187091, 0.443743, -0.006836, -0.892611, -0.116735, 0.0383497, 0.543888, -0.869287, -0.114419, 0.95436, -0.0645173, -0.341888, -0.10814, 0.486548, -0.589317, -0.657241, -0.25496, 0.879451, 0.929702, -0.490085, -0.85933, -0.752302, 0.0526757, -0.679834, 0.0354144, -0.78963, 0.683152, -0.262876, -0.152219, -0.345545, 0.427093, 0.153552, 0.743768, 0.516492, 0.673196, 0.399582, -0.22188, 0.870483, 0.211205, -0.275833, 0.0790093, -0.0898552, -0.196616, -0.519119, -0.833829, -0.156843, -0.0552401, -0.420467, -0.790062, -0.567228, 0.604037, 0.0548782, 0.337641, 0.727286, -0.512499, 0.423129, -0.472674, -0.234357, -0.837989, -0.0804745, -0.534266, 0.590705, -0.0173138, -0.993542, -0.467762, 0.329378, -0.149618, -0.626351, 0.926951, -0.731922, 0.591711, 0.892089, -0.65769, 0.212003, -0.872393, -0.305017, -0.415064, 0.0193165, 0.651673, 0.668677, 0.452886, -0.341131, 0.604169, 0.263527, -0.909319, -0.917159, -0.69337, 0.53413, -0.876537, 0.0386064, 0.8583, -0.558969, -0.590874, -0.822015, 0.399382, 0.412923, -0.0107382, -0.476443, 0.423143, -0.243268, -0.598711, -0.534785, -0.127808, -0.061003, 0.722375, 0.954477, -0.110962, -0.931514, 0.0475435, -0.936722, 0.506348, 0.183176, 0.645782, -0.340842, -0.535844, 0.0730565, -0.138763, -0.192838, 0.974649, 0.933819, 0.701061, 0.735028, -0.37679, -0.703219, 0.995197, 0.279047, -0.0638505, 0.863829, 0.381545, 0.630814, 0.0830693, 0.145613, -0.681568, 0.890501, 0.642667, -0.689172, -0.91785, -0.312773, -0.779961, -0.806923, 0.0375465, -0.95519, 0.122967, 0.713752, 0.0338162, 0.349049, 0.47435, 0.396921, -0.954401, -0.616032, 0.341982, -0.308257, -0.867419, -0.718579, 0.842235, -0.556687, -0.239771, 0.172032, -0.665374, -0.947321, 0.382253, 0.524688, 0.427391, -0.845351, 0.179619, 0.851006, 0.859396, -0.139108, 0.0119392, 0.662512, 0.838472, 0.203275, 0.447673, 0.0386733, -0.018366, -0.677161, 0.952231, 0.148721, -0.453498, 0.0628546, 0.397116, 0.334099, -0.805135, 0.0974726, 0.221475, 0.335931, -0.00974932, 0.143165, 0.177776, -0.117374, -0.697566, 0.00454946, 0.462728, -0.936687, -0.896767, 0.0441269, -0.358715, -0.929881, -0.509715, -0.785639, -0.234063, 0.103659, 0.194337, 0.222221, 0.870503, 0.544061, 0.026297, -0.0266377, 0.300255, 0.393991, -0.184925, -0.026301, -0.0404343, 0.4209, 0.0683973, -0.446706, 0.211076, -0.439793, 0.406739, 0.0609791, 0.876508, -0.529195, -0.173012, 0.194952, 0.566005, 0.840505, 0.362982, 0.642355, 0.054826, -0.539461, -0.712632, 0.799042, -0.497156, 0.303029])
 
 if __name__ == "__main__":
-- 
GitLab