polaroid-pp

Schlieren and contour plot tool
git clone https://git.0xfab.ch/polaroid-pp.git
Log | Files | Refs | Submodules | README | LICENSE

PhotoINFO.cpp (1271B)


      1 // File       : PhotoINFO.cpp
      2 // Date       : Tue 12 Jul 2016 04:33:18 PM CEST
      3 // Author     : Fabian Wermelinger
      4 // Description: PhotoINFO implementation
      5 // Copyright 2016 ETH Zurich. All Rights Reserved.
      6 #include <cassert>
      7 #include <fstream>
      8 #include <iomanip>
      9 #include "PhotoINFO.h"
     10 
     11 using namespace std;
     12 
     13 void PhotoINFO::make_new(const string name, const int dummy1, const int dummy2)
     14 {
     15     m_fname = name;
     16     m_buf.str().clear();
     17 }
     18 
     19 void PhotoINFO::write(const Slice2D_Statistics& stat)
     20 {
     21     ofstream info(m_fname.c_str());
     22     info.setf(std::ios::scientific, std::ios::floatfield);
     23     info.precision(12);
     24     info << setfill('.') << setw(32) << left << "Mean" << ": " << stat.mean() << endl;
     25     info << setfill('.') << setw(32) << left << "Variance" << ": " << stat.var() << endl;
     26     info << setfill('.') << setw(32) << left << "Standard deviation" << ": " << stat.std() << endl;
     27     info << setfill('.') << setw(32) << left << "Skewness" << ": " << stat.skew() << endl;
     28     info << setfill('.') << setw(32) << left << "Kurtosis" << ": " << stat.kurt() << endl;
     29     info << setfill('.') << setw(32) << left << "Minimum" << ": " << stat.min() << endl;
     30     info << setfill('.') << setw(32) << left << "Maximum" << ": " << stat.max() << endl;
     31     info.close();
     32 }