diff --git a/utils/Makefile.am b/utils/Makefile.am index 1eba782..b7b200a 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -9,6 +9,7 @@ endif bin_PROGRAMS = \ latan_make_fake_sample\ latan_sample_combine \ + latan_sample_flatten \ latan_sample_plot_corr\ latan_sample_read \ latan_resample @@ -21,6 +22,10 @@ latan_sample_combine_SOURCES = sample_combine.cpp latan_sample_combine_CXXFLAGS = $(COM_CXXFLAGS) latan_sample_combine_LDFLAGS = -L../lib/.libs -lLatAnalyze +latan_sample_flatten_SOURCES = sample_flatten.cpp +latan_sample_flatten_CXXFLAGS = $(COM_CXXFLAGS) +latan_sample_flatten_LDFLAGS = -L../lib/.libs -lLatAnalyze + latan_sample_plot_corr_SOURCES = sample_plot_corr.cpp latan_sample_plot_corr_CXXFLAGS = $(COM_CXXFLAGS) latan_sample_plot_corr_LDFLAGS = -L../lib/.libs -lLatAnalyze diff --git a/utils/sample_flatten.cpp b/utils/sample_flatten.cpp new file mode 100644 index 0000000..46f68b3 --- /dev/null +++ b/utils/sample_flatten.cpp @@ -0,0 +1,31 @@ +#include +#include + +#include +#include + + +namespace La = Latan; + +int main(int argc, char* argv[]) +{ + if (argc != 4) { + std::cout << "Usage: " << argv[0] << " " << std::endl; + return -1; + } + + std::string inFileName = argv[1]; + std::string outFileName = argv[2]; + auto nSamples = La::strTo(argv[3]); + + La::DMatSample inputData(nSamples, 1, 1); + La::DSample outputData(nSamples); + + inputData = La::Io::load(inFileName); + + FOR_STAT_ARRAY(inputData, s) { + outputData[s] = inputData[s](0, 0); + } + + La::Io::save(outputData, outFileName); +}