Changeset - b9db6f3e92be
[Not reviewed]
0 1 2
Tom Bannink - 8 years ago 2017-07-17 17:09:09
tombannink@gmail.com
Add CCM plots
3 files changed with 43 insertions and 13 deletions:
0 comments (0 inline, 0 general)
plots/ccm_construction_successrate.pdf
Show inline comments
 
new file 100644
 
binary diff not shown
plots/ccm_initialtris.pdf
Show inline comments
 
new file 100644
 
binary diff not shown
triangle_gcm_initial_analysis.m
Show inline comments
 
@@ -7,7 +7,7 @@ Needs["ErrorBarPlots`"]
 
(*Data import*)
 

	
 

	
 
gsraw=Import[NotebookDirectory[]<>"data/graphdata_initialtris.m"];
 
gsraw=Import[NotebookDirectory[]<>"data/graphdata_initialtris3.m"];
 
(* gsraw=SortBy[gsraw,{#[[1,1]]&,#[[1,2]]&}]; (* Sort by n and then by tau. The {} forces a *stable* sort because otherwise Mathematica sorts also on triangle count and other things. *) *)
 

	
 

	
 
@@ -21,7 +21,7 @@ gdata=GatherBy[gsraw,{#[[1,2]]&,#[[1,1]]&}];
 
4: {GCM2 starting triangle counts summed, GCM2 number of successes}
 
*)
 
nlabels=Map["n = "<>ToString[#]&,gdata[[1,All,1,1,1]]];
 
taulabels=Map["tau = "<>ToString[#]&,gdata[[All,1,1,1,2]]];
 
taulabels=Map["\[Tau] = "<>ToString[#]&,gdata[[All,1,1,1,2]]];
 

	
 

	
 
(* ::Section:: *)
 
@@ -33,9 +33,9 @@ taulabels=Map["tau = "<>ToString[#]&,gdata[[All,1,1,1,2]]];
 

	
 

	
 
 (* Consider all runs *)
 
getIt[x_,avg_]:=If[x[[2]]>=5, x[[1]]/x[[2]]/avg,-0.5]
 
getIt[x_,avg_]:=If[x[[2]]>=5, x[[1]]/x[[2]]/avg,0]
 
getAverage[run_]:=Module[{avg},
 
    avg=20*run[[2]];
 
    avg=run[[2]];
 
    If[avg>0,
 
    { getIt[run[[3]],avg], getIt[run[[4]],avg] }
 
    , {3,3}]
 
@@ -56,11 +56,24 @@ TableForm[histogramsTotal,TableHeadings->{taulabels,nlabels}]
 
(*Exporting plots*)
 

	
 

	
 
tauIndices={2,5,8};
 
nIndices={2};
 
makeHistogram[datasets_,n_,tau_]:=Histogram[datasets,{0.05},PlotRange->{{-0.5,1.5},Automatic},ImageSize->300,AxesOrigin->{0,0}];
 
histogramsTotal=Map[makeHistogram[#,1000,tau]&,totalStats[[tauIndices,nIndices]],{2}];
 
TableForm[histogramsTotal,TableHeadings->{taulabels[[tauIndices]],nlabels[[nIndices]]}]
 
makeHistogram[datasets_,n_,tau_]:=Histogram[datasets,{0.05},"Probability",
 
PlotRange->{{0,1},{0,0.5}},
 
ImageSize->300,AxesOrigin->{0,0},
 
Frame->True,
 
FrameLabel->{"fraction of average #triangles at CCM start","frequency"},
 
(*LabelingFunction->(Placed[NumberForm[#,{2,3}],Above]&),*)
 
(*LabelingFunction\[Rule](Placed[If[#2[[2]]\[Equal]1,NumberForm[#1,{2,3}],""],Above]&),*)
 
PlotLabel->n<>", "<>tau];
 
histogramsTotal=MapIndexed[makeHistogram[#1,nlabels[[#2[[2]]]],taulabels[[#2[[1]]]]]&,totalStats,{2}];
 

	
 

	
 
tauIndices={1,5,9};
 
nIndices={3};
 
(* TableForm[histogramsTotal[[tauIndices,nIndices]],TableHeadings->{taulabels[[tauIndices]],nlabels[[nIndices]]}] *)
 
plotgrid1=GraphicsGrid[histogramsTotal[[tauIndices,nIndices]]]
 

	
 

	
 
Export[NotebookDirectory[]<>"plots/ccm_initialtris.pdf",plotgrid1]
 

	
 

	
 
(* ::Subsection:: *)
 
@@ -68,16 +81,33 @@ TableForm[histogramsTotal,TableHeadings->{taulabels[[tauIndices]],nlabels[[nIndi
 

	
 

	
 
(* gdata[[ tau index, n index, run index , {ntau, #tris, ds, greedyTriangles} ]] *)
 
successrates=Map[{#[[3,2]],#[[4,2]]}&,gdata,{3}];
 
successrates=Map[{#[[3,2]]/100,#[[4,2]]/100}&,gdata,{3}];
 
successrates=Map[Transpose,successrates,{2}];
 
successratesDelta=Map[#[[3,2]]-#[[4,2]]&,gdata,{3}];
 

	
 
rateHistograms=Map[Histogram[#,{10},PlotRange->{{0,100},Automatic}]&,successrates,{2}];
 
TableForm[rateHistograms,TableHeadings->{taulabels,nlabels}]
 
rateHistograms=Map[Histogram[#,{0.1},"Probability",PlotRange->{{0,1},Automatic}]&,successrates,{2}];
 
rateDeltaHistograms=Map[Histogram[#,{10},"Probability",PlotRange->{{-100,100},Automatic}]&,successratesDelta,{2}];
 

	
 

	
 
rateHistograms=Map[Histogram[#,{10},PlotRange->{{-100,100},Automatic}]&,successratesDelta,{2}];
 
TableForm[rateHistograms,TableHeadings->{taulabels,nlabels}]
 
TableForm[rateDeltaHistograms,TableHeadings->{taulabels,nlabels}]
 
(*TableForm[Transpose[rateHistograms],TableHeadings->{nlabels,taulabels}]*)
 

	
 

	
 
(* For export *)
 
makeHistogram2[datasets_,label_]:=Histogram[datasets,{0.1},"Probability",
 
PlotRange->{{0,1},{0,1}},
 
ImageSize->300,AxesOrigin->{0,0},
 
Frame->True,
 
FrameLabel->{"successrate of CCM construction","frequency"},
 
(*LabelingFunction->(Placed[NumberForm[#,{2,3}],Above]&),*)
 
(*LabelingFunction\[Rule](Placed[If[#2[[2]]\[Equal]1,NumberForm[#1,{2,3}],""],Above]&),*)
 
PlotLabel->label];
 

	
 
plot1=makeHistogram2[successrates[[1,3]],"n = 1000, \[Tau] = 2.1"];
 
plot2=makeHistogram2[successrates[[5,3]],"n = 1000, \[Tau] = 2.5"];
 
plot3=makeHistogram2[successrates[[9,3]],"n = 1000, \[Tau] = 2.9"];
 
columnplot1=GraphicsColumn[{plot1,plot2,plot3}]
 

	
 

	
 
Export[NotebookDirectory[]<>"plots/ccm_construction_successrate.pdf",columnplot1]
0 comments (0 inline, 0 general)