ptrc_statistics.sce 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. dataFile0="../example_stat_report0.txt";
  2. dataFile1="../example_stat_report1.txt";
  3. graphSize=[720,860];
  4. function strOfVals=readStrOfFlts(dataFile)
  5. res=[]; n=1;
  6. while(mgetstr(1,dataFile)<>ascii(10))
  7. res(n)=mfscanf(1,dataFile,"%f"); n=n+1;
  8. end
  9. strOfVals=res;
  10. endfunction
  11. function dataN=readFileFunc(fileName)
  12. dat.fileName=fileName;
  13. dataFile=mopen(fileName,'rb');
  14. for i=1:1:9
  15. execstr([strcat(["dat.",mfscanf(1,dataFile,"%s"),..
  16. "=mfscanf(1,dataFile,""%f"");"])]);
  17. end
  18. for i=1:1:9
  19. execstr([strcat(["dat.",mfscanf(1,dataFile,"%s"),..
  20. "=readStrOfFlts(dataFile);"])]);
  21. end
  22. mclose(dataFile);
  23. dataN=dat;
  24. endfunction
  25. function mnL=mainLeg(dat)
  26. mnL=[strcat(["Dim:",string(dat.Dimensionality),..
  27. "; Known spheres:",string(dat.Number_of_known_spheres),..
  28. "; Mult:",string(dat.Multiplier),..
  29. "; Runs:",string(dat.Number_of_runs),";"]),..
  30. strcat(["Uncertainties:[",..
  31. string(dat.Start_uncertainty),", ",..
  32. string(dat.End_uncertainty),"], increment:",..
  33. string(dat.Uncertainty_incr),"; "]),..
  34. strcat(["Samples:",..
  35. string(dat.Samples_for_one_uncertainty_value),..
  36. " x Uncertainties; ",..
  37. "Statistical discretisation:",..
  38. string(dat.Statistical_discretisation)," "])];
  39. endfunction
  40. function gw=DrawPlotFor(windowsIdx,postfix,title)
  41. gw=scf(graphWindows(windowsIdx)); clf();
  42. xlfont(strcat(["../../documentation/fonts/cm-unicode-0.7.0/",..
  43. "CMU_Typewriter_Text-Medium.otf"]),0);
  44. xtitle(title,"Sensor uncertainty","Expected value");
  45. cidx=(length(gw.color_map)/3)+1;
  46. gw.color_map(cidx,1:3)=0.5; ax0=gca();
  47. ax0.grid=[cidx,cidx]; ax0.grid_style=[9,9]; ax0.grid_thickness=[1,1];
  48. ax0.filled="off"; ax0.font_style=0;ax0.font_size=3;
  49. ax0.title.font_style=0; ax0.title.font_size=4;
  50. ax0.x_label.font_style=0; ax0.x_label.font_size=3;
  51. ax0.y_label.font_style=0; ax0.y_label.font_size=3;
  52. execstr([strcat(["yVals=data0.Expected_",postfix])]);
  53. cEE0=plot(data0.Sensor_uncertainty,yVals,'Color','#0000aa');
  54. cEE0.thickness=2; cEE0.line_mode="on";
  55. cS=plot([0],[0]); cS.line_mode="off";cS=plot([0],[0]); cS.line_mode="off";
  56. execstr([strcat(["yVals=data0.Expected_",postfix,"+",..
  57. "data0.Sigma_",postfix])]);
  58. cSE0=plot(data0.Sensor_uncertainty,yVals,'Color','#5555c7');
  59. cSE0.thickness=2; cSE0.line_mode="on"; cSE0.line_style=3;
  60. execstr([strcat(["yVals=data0.Min_",postfix])]);
  61. cMinE0=plot(data0.Sensor_uncertainty,yVals,'Color','#5555c7');
  62. cMinE0.thickness=2; cMinE0.line_mode="on"; cMinE0.line_style=7;
  63. execstr([strcat(["yVals=data1.Expected_",postfix])]);
  64. cEE1=plot(data1.Sensor_uncertainty,yVals,'Color','#aa0000');
  65. cEE1.thickness=2; cEE1.line_mode="on";
  66. cS=plot([0],[0]); cS.line_mode="off";cS=plot([0],[0]); cS.line_mode="off";
  67. execstr([strcat(["yVals=data1.Expected_",postfix,"+",..
  68. "data1.Sigma_",postfix])]);
  69. cSE1=plot(data1.Sensor_uncertainty,yVals,'Color','#c75555');
  70. cSE1.thickness=2; cSE1.line_mode="on"; cSE1.line_style=3;
  71. execstr([strcat(["yVals=data1.Min_",postfix])]);
  72. cMinE1=plot(data1.Sensor_uncertainty,yVals,'Color','#c75555');
  73. cMinE1.thickness=2; cMinE1.line_mode="on"; cMinE1.line_style=7;
  74. execstr([strcat(["yVals=data0.Max_",postfix])]);
  75. cMaxE0=plot(data0.Sensor_uncertainty,yVals,'Color','#5555c7');
  76. cMaxE0.thickness=2;cMaxE0.line_mode="on"; cMaxE0.line_style=7;
  77. execstr([strcat(["yVals=data1.Max_",postfix])]);
  78. cMaxE1=plot(data1.Sensor_uncertainty,yVals,'Color','#c75555');
  79. cMaxE1.thickness=2; cMaxE1.line_mode="on"; cMaxE1.line_style=7;
  80. legend(ax0,mainLeg(data0),"Expected+StdDeviation","min/max",..
  81. mainLeg(data1),"Expected+StdDeviation","min/max",-6);
  82. endfunction
  83. data0=readFileFunc(dataFile0);
  84. data1=readFileFunc(dataFile1);
  85. if exists("graphWindows")==0 for i=1:1:2 graphWindows(i)=scf(); end end
  86. /* expected error */
  87. DrawPlotFor(1,"err","Expected Error Value");
  88. obj=gcf(); obj.figure_size=graphSize; obj.children.margins(3)=0.05;
  89. obj.children.margins(4)=obj.children.margins(4)-2*obj.children.margins(3);
  90. obj.anti_aliasing="16x";
  91. xs2png(obj,"errors.png");
  92. xs2svg(obj,"errors.svg");/* add "fill-opacity:0;" to svg-background */
  93. /* expected solves */
  94. DrawPlotFor(2,"solves","Expected Solves");
  95. obj=gcf(); obj.figure_size=graphSize; obj.children.margins(3)=0.05;
  96. obj.children.margins(4)=obj.children.margins(4)-2*obj.children.margins(3);
  97. obj.anti_aliasing="16x";
  98. xs2png(obj,"solves.png");
  99. xs2svg(obj,"solves.svg");/* add "fill-opacity:0;" to svg-background */