ODIN
micalc.cpp
1 #include <odindata/data.h>
2 #include <odindata/fileio.h>
3 #include <odindata/utils.h>
4 #include <odindata/statistics.h>
5 #include <odindata/correlation.h>
6 #include <odindata/filter.h>
7 
62 void usage(const Protocol& prot) {
63  FileReadOpts ropts;
64  FileWriteOpts wopts;
65  FilterChain filter;
66  STD_cout << "micalc: Performs basic mathematics with data sets" << STD_endl;
67  STD_cout << " File formats are automatically identified by their file extension." << STD_endl;
68  STD_cout << " For binary operations with two input files, the protocol of the first input file will be used for the output file." << STD_endl;
69  STD_cout << configInfo() << STD_endl;
70  STD_cout << STD_endl;
71  STD_cout << "micalc can be used in one of the following modes:" << STD_endl;
72  STD_cout << " Binary operation with data sets and/or scalar numbers:" << STD_endl;
73  STD_cout << " micalc [-if1 <input-file1> | -in1 <input-number1>] -op <operation(+,-,*,/,min,max,lcorr,kcorr)> [-if2 <input-file2> | -in2 <input-number1>] -of <output-file>" << STD_endl;
74  STD_cout << " Accumulation/reduction of one data set:" << STD_endl;
75  STD_cout << " micalc -if <input-file> -op <operation(+,*,mean,median,stdev,min,max)>" << STD_endl;
76  STD_cout << " Transformation (magnitude, logarithm, ...) of one data set:" << STD_endl;
77  STD_cout << " micalc -if <input-file> -op <operation(abs,sqrt,log,exp,-,/,acos)> -of <output-file>" << STD_endl;
78  STD_cout << " Statistics of one data set:" << STD_endl;
79  STD_cout << " micalc -if <input-file>" << STD_endl;
80  STD_cout << " [-mean <time-mean-file>] [-stdev <time-stdev-file>] [-fluct <relative-time-stdev-file>] [-tcourse <average time course of all voxels>]" << STD_endl;
81  STD_cout << " [-hist <histogram> -histslots <numofslots> [-histmin <minval>] [-histmax <maxval>] [-rightstairs] [-histfract] [-loghist] [-histslotmap <file>]]" << STD_endl;
82  STD_cout << " [-cog <center-of-gravity-file>]" << STD_endl;
83 
84  STD_cout << "Extra options:" << STD_endl;
85  STD_cout << "\t-mask <Binary mask file: voxels with zeroes are discarded>" << STD_endl;
86  STD_cout << "Protocol options (overrides parameters in input data):" << STD_endl;
87  STD_cout << prot.get_cmdline_usage("\t");
88  STD_cout << "File read options (will be applied to input data before processing):" << STD_endl;
89  STD_cout << ropts.get_cmdline_usage("\t");
90  STD_cout << "File write options (will be applied to output data after processing):" << STD_endl;
91  STD_cout << wopts.get_cmdline_usage("\t");
92  STD_cout << "Filters/processing applied to input file(s) and mask, applied in the order they appear on the command line:" << STD_endl;
93  STD_cout << filter.get_cmdline_usage("\t");
94  STD_cout << "Other options:" << STD_endl;
95  STD_cout << "\t" << LogBase::get_usage() << STD_endl;
96  STD_cout << "\t" << helpUsage() << STD_endl;
97  STD_cout << "Supported file extensions(formats):" << STD_endl;
98  STD_cout << FileIO::autoformats_str("\t") << STD_endl;
99 }
100 
101 
103 
104 
105 bool read_infile(const STD_string& filename, Data<float,4>& data, const FileReadOpts& ropts, Protocol& prot, const FilterChain& filterchain, ProgressMeter* progmeter) {
106  Log<OdinData> odinlog("micalc","read_infile");
107 
108  Data<float,4> datain;
109 
110  if(datain.autoread(filename,ropts,&prot, progmeter)<0) return false;
111  if(!filterchain.apply(prot,datain)) return false;
112  data.resize(datain.shape());
113 
114  data=datain; // In case storage order is non-default
115 
116  return true;
117 }
118 
119 
121 
122 
123 int main(int argc, char* argv[]) {
124  LogBase::set_log_levels(argc,argv);
125 
126  Log<OdinData> odinlog("micalc","main");
127 
128  Range all=Range::all();
129 
130  FileReadOpts ropts;
131  FileWriteOpts wopts;
132  Protocol prot;
133 
134  if(hasHelpOption(argc,argv)) {usage(prot); return 0;}
135 
136  // set defaults
137  prot.seqpars.set_MatrixSize(readDirection,1);
138  prot.seqpars.set_MatrixSize(phaseDirection,1);
139  prot.seqpars.set_MatrixSize(sliceDirection,1);
140 
141  char optval[ODIN_MAXCHAR];
142  STD_string operation;
143  STD_string infile1;
144  STD_string infile2;
145  STD_string outfile;
146  STD_string maskfile;
147 
148  float innumber1=0.0;
149  float innumber2=0.0;
150 
151 
152  bool i1flag=false;
153  bool i2flag=false;
154  bool offlag=false;
155 
156  bool ifflag=false;
157  bool opflag=false;
158 
159  bool binaryop=false;
160  bool accumulate=false;
161  bool transform=false;
162  bool stateval=false;
163 
164  // command line parsing, parse before filters to remove options
165  if(getCommandlineOption(argc,argv,"-op",optval,ODIN_MAXCHAR)) {operation=optval; opflag=true;}
166 
167  if(getCommandlineOption(argc,argv,"-if1",optval,ODIN_MAXCHAR)) {infile1=optval; i1flag=true;}
168  if(getCommandlineOption(argc,argv,"-if2",optval,ODIN_MAXCHAR)) {infile2=optval; i2flag=true;}
169  if(getCommandlineOption(argc,argv,"-if",optval,ODIN_MAXCHAR)) {infile1=optval; ifflag=true;}
170  if(getCommandlineOption(argc,argv,"-in1",optval,ODIN_MAXCHAR)) {innumber1=atof(optval); i1flag=true;}
171  if(getCommandlineOption(argc,argv,"-in2",optval,ODIN_MAXCHAR)) {innumber2=atof(optval); i2flag=true;}
172 
173  if(getCommandlineOption(argc,argv,"-of",optval,ODIN_MAXCHAR)) {outfile=optval; offlag=true;}
174 
175  if(getCommandlineOption(argc,argv,"-mask",optval,ODIN_MAXCHAR)) {maskfile=optval;}
176 
177  STD_string histfile;
178  if(getCommandlineOption(argc,argv,"-hist",optval,ODIN_MAXCHAR)) histfile=optval;
179 
180  STD_string cogfile;
181  if(getCommandlineOption(argc,argv,"-cog",optval,ODIN_MAXCHAR)) cogfile=optval;
182 
183  STD_string meanfile;
184  STD_string fluctfile;
185  STD_string stdevfile;
186  STD_string tcoursefile;
187  STD_string histslots;
188  STD_string histmin;
189  STD_string histmax;
190  STD_string histslotmapfile;
191  if(getCommandlineOption(argc,argv,"-mean",optval,ODIN_MAXCHAR)) meanfile=optval;
192  if(getCommandlineOption(argc,argv,"-fluct",optval,ODIN_MAXCHAR)) fluctfile=optval;
193  if(getCommandlineOption(argc,argv,"-stdev",optval,ODIN_MAXCHAR)) stdevfile=optval;
194  if(getCommandlineOption(argc,argv,"-tcourse",optval,ODIN_MAXCHAR)) tcoursefile=optval;
195  if(getCommandlineOption(argc,argv,"-histslots",optval,ODIN_MAXCHAR)) histslots=optval;
196  if(getCommandlineOption(argc,argv,"-histmin",optval,ODIN_MAXCHAR)) histmin=optval;
197  if(getCommandlineOption(argc,argv,"-histmax",optval,ODIN_MAXCHAR)) histmax=optval;
198  bool rightstairs=isCommandlineOption(argc,argv,"-rightstairs");
199  bool histfract=isCommandlineOption(argc,argv,"-histfract");
200  bool loghist=isCommandlineOption(argc,argv,"-loghist");
201  if(getCommandlineOption(argc,argv,"-histslotmap",optval,ODIN_MAXCHAR)) histslotmapfile=optval;
202 
203 
204 
205  // Parse before filters to remove options
206  ropts.parse_cmdline_options(argc,argv);
207  wopts.parse_cmdline_options(argc,argv);
208  prot.parse_cmdline_options(argc,argv);
209 
210 
211  ProgressDisplayConsole display;
212  ProgressMeter progmeter(display);
213 
214 
215  FilterChain filterchain(argc,argv);
216 
217 
218  if(i1flag && i2flag && opflag) binaryop=true;
219  if(ifflag && opflag) {
220  if(offlag) transform=true;
221  else accumulate=true;
222  }
223  if(ifflag && (!opflag)) stateval=true;
224 
225  if( !( binaryop || accumulate || transform || stateval ) ) {usage(prot); return 0;}
226 
227  if(accumulate || stateval) FileIO::set_trace_status(false);
228 
229  if(binaryop && infile1=="" && infile2=="") {
230  ODINLOG(odinlog,errorLog) << "Specify at least one file" << STD_endl;
231  return -1;
232  }
233 
234  Data<float,4> data1;
235  Data<float,4> data2;
236 
237  if(infile1!="") {
238  if(!read_infile(infile1, data1, ropts, prot, filterchain,&progmeter)) return -1;
239  }
240 
241  if(binaryop && infile2!="") {
242  Protocol protcopy(prot); // dispensable protocol
243  Protocol* prot2p=&protcopy;
244  if(infile1=="") prot2p=&prot; // use only if 1st operand is number
245  if(!read_infile(infile2, data2, ropts, *prot2p, filterchain,&progmeter)) return -1;
246  }
247 
248  TinyVector<int,4> outshape;
249 
250 
251  if(binaryop || transform) {
252 
253  bool has_shape1=sum(data1.shape());
254  bool has_shape2=sum(data2.shape());
255 
256  if( has_shape1 && has_shape2 && !same_shape(data1,data2) ) {
257  ODINLOG(odinlog,errorLog) << "Shape mismatch: data1shape/data2shape=" << data1.shape() << "/" << data2.shape() << STD_endl;
258  return -1;
259  } else outshape=data1.shape();
260 
261  if(has_shape1 && !has_shape2) {
262  outshape=data1.shape();
263  data2.resize(outshape);
264  data2=innumber2;
265  }
266  if(!has_shape1 && has_shape2) {
267  outshape=data2.shape();
268  data1.resize(outshape);
269  data1=innumber1;
270  }
271  if(!has_shape1 && !has_shape2) {
272  ODINLOG(odinlog,errorLog) << "Specify at least one valid file" << STD_endl;
273  return -1;
274  }
275 
276  }
277 
278 
279  Data<float,4>* maskptr=0;
280  Data<float,4> maskdata;
281  if(maskfile!="") {
282  Data<float,4> inmaskdata;
283  Protocol maskprot;
284  if(!read_infile(maskfile, inmaskdata, ropts, maskprot, filterchain,&progmeter)) return -1;
285 // if(inmaskdata.autoread(maskfile,ropts)<0) return -1;
286  if( inmaskdata.extent(0) && same_shape(data1, inmaskdata, TinyVector<int,4>(0,1,1,1) ) ) {
287  maskdata.resize(data1.shape());
288  maskdata=0.0;
289  for(unsigned int i=0; i<data1.numElements(); i++) {
290  TinyVector<int,4> index=data1.create_index(i);
291  TinyVector<int,4> maskindex=index; maskindex(0)=0;
292  if(inmaskdata(maskindex)!=0.0) maskdata(index)=1.0;
293  }
294  maskptr=&maskdata;
295  } else {
296  ODINLOG(odinlog,errorLog) << "Shape mismatch: datashape/maskshape=" << data1.shape() << "/" << inmaskdata.shape() << STD_endl;
297  return -1;
298  }
299  }
300 
301 
302  prot.system.set_data_type(TypeTraits::type2label(float(0))); // Store results in float
303 
304  if(binaryop) {
305  if(maskptr) {
306  ODINLOG(odinlog,normalDebug) << "data1/data2/maskdata" << data1.shape() << "/" << data2.shape() << "/" << maskdata.shape() << STD_endl;
307  data1=data1*maskdata;
308  data2=data2*maskdata;
309  }
310 
311  if(operation=="lcorr" || operation=="kcorr") {
312  int npts=data1.size();
313  if(maskptr) npts=int(sum(maskdata)+0.5);
314  Array<float,1> vec1(npts);
315  Array<float,1> vec2(npts);
316  int vecindex=0;
317  for(unsigned int i=0; i<data1.numElements(); i++) {
318  TinyVector<int,4> index=data1.create_index(i);
319  bool include=true;
320  if( maskptr && maskdata(index)==0.0 ) include=false;
321  if(include) {
322  vec1(vecindex)=data1(index);
323  vec2(vecindex)=data2(index);
324  vecindex++;
325  }
326  }
327  correlationResult coresult;
328  if(operation=="lcorr") coresult=correlation(vec1, vec2);
329  if(operation=="kcorr") coresult=kendall(vec1, vec2);
330  STD_cout << "r/p/z(" << npts << ")=" << coresult.r << "/" << coresult.p << "/" << coresult.z << STD_endl;
331  } else {
332  Data<float,4> result(outshape);
333  ODINLOG(odinlog,infoLog) << "calculating " << data1.shape() << " " << operation << " " << data2.shape() << " ..." << STD_endl;
334  bool validop=false;
335  if(operation=="+") {validop=true; result=data1+data2;}
336  if(operation=="-") {validop=true; result=data1-data2;}
337  if(operation=="*") {validop=true; result=data1*data2;}
338  if(operation=="/") {validop=true; result=secureDivision(data1,data2);}
339  if(operation=="min" || operation=="max") {
340  Data<float,4> minval(outshape);
341  Data<float,4> maxval(outshape);
342  for(unsigned int i=0; i<data1.numElements(); i++) {
343  TinyVector<int,4> index=data1.create_index(i);
344  minval(index)=STD_min(data1(index), data2(index));
345  maxval(index)=STD_max(data1(index), data2(index));
346  }
347  if(operation=="min") result=minval;
348  else result=maxval;
349  validop=true;
350  }
351  if(!validop) {
352  ODINLOG(odinlog,errorLog) << "invalid binary operation: " << operation << STD_endl;
353  return -1;
354  }
355  if(result.autowrite(outfile,wopts,&prot)<0) return -1;
356  }
357  return 0;
358  }
359 
360  if(accumulate) {
361  if(maskptr) {
362  data1=data1*maskdata;
363  }
364  double accuresult=0.0;
365  bool validop=false;
366  if(operation=="+") {validop=true; accuresult=sum(data1);}
367  if(operation=="*") {validop=true; accuresult=product(data1);}
368  if(operation=="mean") {validop=true; accuresult=statistics(data1).mean;}
369  if(operation=="median") {validop=true; accuresult=median(data1);}
370  if(operation=="stdev") {validop=true; accuresult=statistics(data1).stdev;}
371  if(operation=="min") {validop=true; accuresult=min(data1);}
372  if(operation=="max") {validop=true; accuresult=max(data1);}
373  if(!validop) {
374  ODINLOG(odinlog,errorLog) << "invalid accumulation operator: " << operation << STD_endl;
375  return -1;
376  }
377  STD_cout << accuresult << STD_endl;
378  }
379 
380  if(transform) {
381  if(maskptr) {
382  data1=data1*maskdata;
383  }
384  Data<float,4> result(outshape);
385  ODINLOG(odinlog,infoLog) << "Calculating " << operation << " " << data1.shape() << " ..." << STD_endl;
386  bool validop=false;
387  if(operation=="abs") {validop=true; result=fabs(data1);}
388  if(operation=="sqrt") {validop=true; result=sqrt(data1);}
389  if(operation=="log") {validop=true; result=where(Array<float,4>(data1)>0.0, Array<float,4>(log(data1)), float(0.0));}
390  if(operation=="exp") {validop=true; result=exp(data1);}
391  if(operation=="-") {validop=true; result=-data1;}
392  if(operation=="/") {validop=true; result=where(Array<float,4>(data1)!=0.0, Array<float,4>(1.0/data1), float(0.0));}
393  if(operation=="acos") {validop=true; result=where(Array<float,4>(data1)>=-1.0 && Array<float,4>(data1)<=1.0, Array<float,4>(acos(data1)), float(0.0));}
394  if(!validop) {
395  ODINLOG(odinlog,errorLog) << "invalid unary operation: " << operation << STD_endl;
396  return -1;
397  }
398  if(result.autowrite(outfile,wopts,&prot)<0) return -1;
399  return 0;
400  }
401 
402  if(stateval) {
403 
404  if(histfile!="") {
405 
406  int nvals=data1.numElements();
407  if(maskptr) {
408  nvals=0;
409  for(unsigned int i=0; i<maskdata.numElements(); i++) {
410  TinyVector<int,4> index=maskdata.create_index(i);
411  if( maskdata(index)>0.0 ) {
412  nvals++;
413  }
414  }
415  }
416 
417 
418  if(histslots=="") {usage(prot); return -1;}
419  int nslots=atoi(histslots.c_str());
420 
421 
422  statisticResult stats=statistics(data1,maskptr);
423  float minval=stats.min;
424  if(histmin!="") minval=atof(histmin.c_str());
425  float maxval=stats.max;
426  if(histmax!="") maxval=atof(histmax.c_str());
427  ODINLOG(odinlog,infoLog) << "calculating histogram with nslots/minval/maxval=" << nslots << "/" << minval << "/" << maxval << STD_endl;
428 
429  if(minval>=maxval) {
430  ODINLOG(odinlog,errorLog) << "histmax must be larger than histmin" << STD_endl;
431  return -1;
432  }
433 
434  float stairoffset=0.5; // centered stairs
435  if(rightstairs) stairoffset=0.0; // assume rightstairs when plotting (xmgrace)
436 
437  Data<float,1> xvals(nslots);
438  Data<float,1> yvals(nslots); yvals=0.0;
439 
440 
441  Data<float,4> histslotmap(data1.shape()); histslotmap=0.0;
442 
443 
444 // if(minval>0.0 && maxval>0.0) { // Use log histogram
445  if(loghist) { // Use log histogram
446 
447  if( minval<=0.0 || maxval<=0.0 ) {
448  ODINLOG(odinlog,errorLog) << "positive minval/maxval required for log histogram, current minval/maxval=" << minval << "/" << maxval << STD_endl;
449  return -1;
450  }
451 
452  float minpow=log10(minval);
453  float maxpow=log10(maxval);
454  float powrange=maxpow-minpow;
455  float step=secureDivision(powrange,nslots);
456  ODINLOG(odinlog,normalDebug) << "minpow/maxpow/powrange/step=" << minpow << "/" << maxpow << "/" << powrange << "/" << step << STD_endl;
457 
458  for(int i=0; i<nslots; i++) xvals(i)=pow(float(10.0),float(minpow+(float(i)+stairoffset)*step));
459 
460  for(unsigned int i=0; i<data1.numElements(); i++) {
461  TinyVector<int,4> index=data1.create_index(i);
462  if( !(maskptr && maskdata(index)==0.0) ) {
463  float pow=log10(data1(index));
464  int slot=int(secureDivision(pow-minpow,powrange)*nslots);
465  ODINLOG(odinlog,normalDebug) << "pow/slot=" << pow << "/" << slot << STD_endl;
466  if(slot>=0 && slot<nslots) {
467  yvals(slot)++;
468  histslotmap(index)=slot+stairoffset;
469  }
470  }
471  }
472 
473 
474  } else { // no log histogram
475 
476  float range=maxval-minval;
477  float step=secureDivision(range,nslots);
478  ODINLOG(odinlog,normalDebug) << "range/step=" << range << "/" << step << STD_endl;
479 
480  for(int i=0; i<nslots; i++) xvals(i)=minval+(float(i)+stairoffset)*step;
481 
482  for(unsigned int i=0; i<data1.numElements(); i++) {
483  TinyVector<int,4> index=data1.create_index(i);
484  if( !(maskptr && maskdata(index)==0.0) ) {
485  float val=data1(index);
486  int slot=int(secureDivision(val-minval,range)*nslots);
487  ODINLOG(odinlog,normalDebug) << "val/slot=" << val << "/" << slot << STD_endl;
488  if(slot>=0 && slot<nslots) {
489  yvals(slot)++;
490  histslotmap(index)=slot+stairoffset;
491  }
492  }
493  }
494  }
495 
496  if(histfract) yvals/=sum(yvals); // Each slot reflects the fraction of total points
497  yvals.write_asc_file(histfile, xvals);
498 
499  if(histslotmapfile!="") if(histslotmap.autowrite(histslotmapfile,wopts,&prot)<0) return -1;
500 
501  }
502 
503 
504  if(meanfile!="" || fluctfile!="" || stdevfile!="" || tcoursefile!="" || cogfile!="") {
505  TinyVector<int,4> inshape=data1.shape();
506  outshape=inshape;
507  ODINLOG(odinlog,infoLog) << "calculating general statistics for shape " << outshape << " ..." << STD_endl;
508  outshape(0)=1;
509  Data<float,4> meanresult(outshape); meanresult=0.0;
510  Data<float,4> fluctresult(outshape); fluctresult=0.0;
511  Data<float,4> stdevresult(outshape); stdevresult=0.0;
512  Data<float,1> tcourseresult(data1.extent(0)); tcourseresult=0.0;
513 
514  farray cogsum(inshape(0), 3);
515  fvector masssum(inshape(0));
516 
517  int maskpoints=0;
518  for(unsigned int i=0; i<meanresult.numElements(); i++) {
519  TinyVector<int,4> index=meanresult.create_index(i);
520  if( !(maskptr && maskdata(index)==0.0) ) {
521  statisticResult stats=statistics(data1(all,index(1),index(2),index(3)));
522  meanresult(index)= stats.mean;
523  fluctresult(index)=secureDivision(stats.stdev,stats.mean);
524  stdevresult(index)=stats.stdev;
525  tcourseresult(all)+=data1(all,index(1),index(2),index(3));
526  ODINLOG(odinlog,normalDebug) << "mean/stdev(" << index << ")=" << stats.mean << "/" << stats.stdev << STD_endl;
527 
528  for(int irep=0; irep<inshape(0); irep++) {
529  float mass=data1(irep,index(1),index(2),index(3));
530  masssum[irep]+=mass;
531  for(int idim=0; idim<3; idim++) {
532  cogsum(irep,idim)+=mass*index(1+idim);
533  }
534  }
535 
536  maskpoints++;
537  }
538  }
539  ODINLOG(odinlog,infoLog) << "maskpoints=" << maskpoints << STD_endl;
540  tcourseresult/=float(maskpoints);
541 
542  if(meanfile!="") if(meanresult.autowrite(meanfile,wopts,&prot)<0) return -1;
543  if(fluctfile!="") if(fluctresult.autowrite(fluctfile,wopts,&prot)<0) return -1;
544  if(stdevfile!="") if(stdevresult.autowrite(stdevfile,wopts,&prot)<0) return -1;
545  if(tcoursefile!="") if(tcourseresult.autowrite(tcoursefile,wopts,&prot)<0) return -1;
546 
547  if(cogfile!="") {
548  STD_string cogstr;
549  for(int irep=0; irep<inshape(timeDim); irep++) {
550  cogstr+=ftos(cogsum(irep, 0)/masssum[irep])+" "+ftos(cogsum(irep, 1)/masssum[irep])+" "+ftos(cogsum(irep, 2)/masssum[irep])+"\n";
551  }
552  write(cogstr, cogfile);
553  }
554 
555 
556  } else {
557  STD_cout << statistics(data1,maskptr) << STD_endl;
558  }
559 // STD_cout << "median = " << median(data1) << STD_endl;
560 
561 
562 
563  }
564 
565  return 0;
566 }
int autoread(const STD_string &filename, const FileReadOpts &opts=FileReadOpts(), Protocol *prot=0, ProgressMeter *progmeter=0)
TinyVector< int, N_rank > create_index(unsigned long index) const
static STD_string autoformats_str(const STD_string &indent="")
STD_string get_cmdline_usage(const STD_string &lineprefix) const
bool apply(FileIO::ProtocolDataMap &pdmap) const
static bool set_log_levels(int argc, char *argv[], bool trigger_error=true)
static STD_string get_usage()
Definition: tjlog.h:218
Protocol proxy.
Definition: protocol.h:33
System system
Definition: protocol.h:78
SeqPars seqpars
Definition: protocol.h:88
SeqPars & set_MatrixSize(direction dir, unsigned int size, parameterMode parmode=edit)
System & set_data_type(const STD_string &type)
Definition: system.h:261
T median(const Array< T, N_rank > &ensemble, const Array< T, N_rank > *mask=0)
Definition: statistics.h:146
correlationResult correlation(const Array< T, N_rank > &x, const Array< T, N_rank > &y)
Definition: correlation.h:61
correlationResult kendall(const Array< T, N_rank > &x, const Array< T, N_rank > &y)
Definition: correlation.h:106
bool same_shape(const Array< T, N_rank > &a1, const Array< T, N_rank > &a2, const TinyVector< int, N_rank > &dimmask=1)
Definition: utils.h:168
statisticResult statistics(const Array< T, N_rank > &ensemble, const Array< T, N_rank > *mask=0)
Definition: statistics.h:79
const char * configInfo()
int isCommandlineOption(int argc, char *argv[], const char *option, bool modify=true)
double secureDivision(double numerator, double denominator)
int write(const STD_string &str, const STD_string &filename, fopenMode mode=overwriteMode)
int hasHelpOption(int argc, char *argv[])
int getCommandlineOption(int argc, char *argv[], const char *option, char *returnvalue, int maxchar, bool modify=true)
const char * helpUsage()
STD_string ftos(double f, unsigned int digits=_DEFAULT_DIGITS_, expFormat eformat=autoExp)