Skip to content
Snippets Groups Projects
test.cc 2.27 KiB
Newer Older
Stephen Smith's avatar
Stephen Smith committed
/*  test.cc
    
    Copyright (C) 1999-2004 University of Oxford */

/*  CCOPYRIGHT  */

#include "libvis/miscplot.h"
Christian Beckmann's avatar
Christian Beckmann committed
#include "miscmaths/miscmaths.h"
#include "miscmaths/miscprob.h"
#include "utils/options.h"
#include <vector>
 
using namespace MISCPLOT;
using namespace MISCMATHS;
using namespace Utilities;
using namespace std;
Mark Jenkinson's avatar
Mark Jenkinson committed

// The two strings below specify the title and example usage that is
//  printed out as the help or usage message
Mark Jenkinson's avatar
Mark Jenkinson committed

string title="test (Version 1.0)\nCopyright(c) 2007, University of Oxford (Christian F. Beckmann)";
string examples="test int";
Christian Beckmann's avatar
Christian Beckmann committed

Option<bool> help(string("--help"), false,
		  string("        display this message"),
		  false, no_argument);
Option<int> num(string("--num"), 1,
		  string("number of iterations"),
		  false, requires_argument);
Christian Beckmann's avatar
Christian Beckmann committed

int nonoptarg;

////////////////////////////////////////////////////////////////////////////
// Local functions
int do_work(int argc, char* argv[]) 
Mark Jenkinson's avatar
Mark Jenkinson committed
{
 
	Matrix mat;
	
	cout << "BLAH " << num.value() << endl;
Christian Beckmann's avatar
Christian Beckmann committed
	mat=normrnd(300,1);
	miscplot::Timeseries(mat.t(),string("test0.png"),string("TEST"));
	
  for (int i=1; i <= (int)num.value();i++){
		cout << "Processing " << i << endl;
Christian Beckmann's avatar
Christian Beckmann committed
	  miscplot newplot;
		newplot.GDCglobals_set();
		mat = normrnd(300,3)+2;
		Matrix col;	
    col = mat;
    newplot.add_bpdata(col);
    //	newplot.add_bpdata(col);
    newplot.boxplot(string("test")+num2str(i)+string(".png"),string("TEST"));
Christian Beckmann's avatar
Christian Beckmann committed
  return 0;
Mark Jenkinson's avatar
Mark Jenkinson committed
}

////////////////////////////////////////////////////////////////////////////

	int main(int argc,char *argv[])
	{

	  Tracer tr("main");
	  OptionParser options(title, examples);

	  try {
	    // must include all wanted options here (the order determines how
	    //  the help message is printed)
	    options.add(help);
	    options.add(num);
	    options.parse_command_line(argc, argv);

	    // line below stops the program if the help was requested or 
	    //  a compulsory option was not set
	    if ( (help.value()) || (!options.check_compulsory_arguments(true)) )
	      {
			options.usage();
			exit(EXIT_FAILURE);
	      }

	  }  catch(X_OptionError& e) {
	    options.usage();
	    cerr << endl << e.what() << endl;
	    exit(EXIT_FAILURE);
	  } catch(std::exception &e) {
	    cerr << e.what() << endl;
	  } 

	  // Call the local functions
	  return do_work(argc,argv);
	}