Thu, 25 Apr 2024 13:25:48 -0500
Remove unused old alg attempts
32
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
1 | module PlotResults |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
2 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
3 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
4 | ######################## |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
5 | # Load external modules |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
6 | ######################## |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
7 | |
34
aca9c90f151c
Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents:
32
diff
changeset
|
8 | using CSV, DataFrames |
32
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
9 | using PlotlyJS |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
10 | using Colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
11 | using Statistics |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
12 | |
34
aca9c90f151c
Reduce dependencies; separate Stats from PlotResults (disabled by default to avoid heavy deps)
Tuomo Valkonen <tuomov@iki.fi>
parents:
32
diff
changeset
|
13 | export fv_plot, ssim_plot, psnr_plot |
32
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
14 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
15 | global mystart = 38 |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
16 | global myend = 135 |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
17 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
18 | function fv_plot(name :: String, save_plot::Bool=true) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
19 | save_path = "./img/$(name)200x300_pdps_known_fv_plot.html" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
20 | ################################################# |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
21 | orig = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
22 | ################################################# |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
23 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
24 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
25 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_proximal") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
26 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
27 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
28 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
29 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
30 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
31 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
32 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
33 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
34 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
35 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
36 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
37 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
38 | Y = Float64.(data[mystart:myend, :function_value]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
39 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
40 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
41 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
42 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
43 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
44 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
45 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
46 | line_color=line_color, line_dash="dot", name="proxi (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
47 | push!(orig, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
48 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
49 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
50 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
51 | identity = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
52 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
53 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
54 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
55 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_primalonly") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
56 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
57 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
58 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
59 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
60 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
61 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
62 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
63 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
64 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
65 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
66 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
67 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
68 | Y = Float64.(data[mystart:myend, :function_value]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
69 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
70 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
71 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
72 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
73 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
74 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
75 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
76 | line_color=line_color, line_dash="dashdot", name="primo (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
77 | push!(identity, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
78 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
79 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
80 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
81 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
82 | adhoc = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
83 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
84 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
85 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
86 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_greedy") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
87 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
88 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
89 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
90 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
91 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
92 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
93 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
94 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
95 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
96 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
97 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
98 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
99 | Y = Float64.(data[mystart:myend, :function_value]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
100 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
101 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
102 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
103 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
104 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
105 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
106 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
107 | line_color=line_color, line_dash="dash", name="greed (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
108 | push!(identity, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
109 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
110 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
111 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
112 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
113 | rotation = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
114 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
115 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
116 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
117 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_rotation") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
118 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
119 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
120 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
121 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
122 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
123 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
124 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
125 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
126 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
127 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
128 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
129 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
130 | Y = Float64.(data[mystart:myend, :function_value]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
131 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
132 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
133 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
134 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
135 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
136 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
137 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
138 | line_color=line_color, line_dash="longdashdot", name="rotat (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
139 | push!(identity, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
140 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
141 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
142 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
143 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
144 | affine = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
145 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
146 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
147 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
148 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_dualscaling") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
149 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
150 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
151 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
152 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
153 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
154 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
155 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
156 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
157 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
158 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
159 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
160 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
161 | Y = Float64.(data[mystart:myend, :function_value]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
162 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
163 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
164 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
165 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
166 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
167 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
168 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
169 | line_color=line_color, line_dash="solid", name="dusca (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
170 | push!(identity, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
171 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
172 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
173 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
174 | zerodual = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
175 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
176 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
177 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
178 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_zerodual") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
179 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
180 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
181 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
182 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
183 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
184 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
185 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
186 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
187 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
188 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
189 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
190 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
191 | Y = Float64.(data[mystart:myend, :function_value]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
192 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
193 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
194 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
195 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
196 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
197 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
198 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
199 | line_color=line_color, line_dash="longdash", name="zerod (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
200 | push!(identity, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
201 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
202 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
203 | layout = Layout(yaxis_type="log",legend_title_text="Function values") # Set legend title |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
204 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
205 | if save_plot && !isempty(save_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
206 | plotlyjs = plot([orig;identity;adhoc;rotation;affine;zerodual], layout) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
207 | open(save_path, "w") do io |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
208 | PlotlyBase.to_html(io, plotlyjs.plot) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
209 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
210 | elseif save_plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
211 | println("Please provide a valid save path.") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
212 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
213 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
214 | return plot([orig;identity;adhoc;rotation;affine;zerodual],layout) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
215 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
216 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
217 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
218 | ######################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
219 | # FUNCTION FOR SSIM |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
220 | ######################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
221 | function ssim_plot(name :: String, save_plot::Bool=true) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
222 | save_path = "./img/$(name)200x300_pdps_known_ssim_plot.html" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
223 | ################################################# |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
224 | orig = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
225 | ################################################# |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
226 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
227 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
228 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_proximal") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
229 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
230 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
231 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
232 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
233 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
234 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
235 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
236 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
237 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
238 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
239 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
240 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
241 | Y = Float64.(data[mystart:myend, :ssim]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
242 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
243 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
244 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
245 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
246 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
247 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
248 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
249 | line_color=line_color, line_dash="dot", name="proxi (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
250 | push!(orig, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
251 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
252 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
253 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
254 | identity = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
255 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
256 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
257 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
258 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_primalonly") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
259 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
260 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
261 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
262 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
263 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
264 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
265 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
266 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
267 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
268 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
269 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
270 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
271 | Y = Float64.(data[mystart:myend, :ssim]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
272 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
273 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
274 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
275 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
276 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
277 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
278 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
279 | line_color=line_color, line_dash="dashdot", name="primo (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
280 | push!(identity, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
281 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
282 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
283 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
284 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
285 | adhoc = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
286 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
287 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
288 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
289 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_greedy") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
290 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
291 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
292 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
293 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
294 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
295 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
296 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
297 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
298 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
299 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
300 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
301 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
302 | Y = Float64.(data[mystart:myend, :ssim]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
303 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
304 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
305 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
306 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
307 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
308 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
309 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
310 | line_color=line_color, line_dash="dash", name="greed (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
311 | push!(identity, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
312 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
313 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
314 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
315 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
316 | rotation = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
317 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
318 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
319 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
320 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_rotation") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
321 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
322 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
323 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
324 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
325 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
326 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
327 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
328 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
329 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
330 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
331 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
332 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
333 | Y = Float64.(data[mystart:myend, :ssim]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
334 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
335 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
336 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
337 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
338 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
339 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
340 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
341 | line_color=line_color, line_dash="longdashdot", name="rotat (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
342 | push!(identity, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
343 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
344 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
345 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
346 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
347 | affine = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
348 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
349 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
350 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
351 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_dualscaling") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
352 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
353 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
354 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
355 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
356 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
357 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
358 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
359 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
360 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
361 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
362 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
363 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
364 | Y = Float64.(data[mystart:myend, :ssim]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
365 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
366 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
367 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
368 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
369 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
370 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
371 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
372 | line_color=line_color, line_dash="solid", name="dusca (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
373 | push!(identity, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
374 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
375 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
376 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
377 | zerodual = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
378 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
379 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
380 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
381 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_zerodual") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
382 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
383 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
384 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
385 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
386 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
387 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
388 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
389 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
390 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
391 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
392 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
393 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
394 | Y = Float64.(data[mystart:myend, :ssim]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
395 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
396 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
397 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
398 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
399 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
400 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
401 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
402 | line_color=line_color, line_dash="longdash", name="zerod (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
403 | push!(identity, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
404 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
405 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
406 | layout = Layout(yaxis_type="log", legend_title_text="SSIM") # Set legend title |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
407 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
408 | if save_plot && !isempty(save_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
409 | plotlyjs = plot([orig;identity;adhoc;rotation;affine;zerodual], layout) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
410 | open(save_path, "w") do io |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
411 | PlotlyBase.to_html(io, plotlyjs.plot) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
412 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
413 | elseif save_plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
414 | println("Please provide a valid save path.") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
415 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
416 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
417 | return plot([orig;identity;adhoc;rotation;affine;zerodual],layout) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
418 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
419 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
420 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
421 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
422 | ######################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
423 | # FUNCTION FOR PSNR |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
424 | ######################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
425 | function psnr_plot(name :: String, save_plot::Bool=true) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
426 | save_path = "./img/$(name)200x300_pdps_known_psnr_plot.html" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
427 | ################################################# |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
428 | orig = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
429 | ################################################# |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
430 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
431 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
432 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_proximal") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
433 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
434 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
435 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
436 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
437 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
438 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
439 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
440 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
441 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
442 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
443 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
444 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
445 | Y = Float64.(data[mystart:myend, :psnr]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
446 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
447 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
448 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
449 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
450 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
451 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
452 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
453 | line_color=line_color, line_dash="dot", name="proxi (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
454 | push!(orig, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
455 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
456 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
457 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
458 | identity = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
459 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
460 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
461 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
462 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_primalonly") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
463 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
464 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
465 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
466 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
467 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
468 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
469 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
470 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
471 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
472 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
473 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
474 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
475 | Y = Float64.(data[mystart:myend, :psnr]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
476 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
477 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
478 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
479 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
480 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
481 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
482 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
483 | line_color=line_color, line_dash="dashdot", name="primo (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
484 | push!(identity, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
485 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
486 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
487 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
488 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
489 | adhoc = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
490 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
491 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
492 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
493 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_greedy") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
494 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
495 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
496 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
497 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
498 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
499 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
500 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
501 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
502 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
503 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
504 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
505 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
506 | Y = Float64.(data[mystart:myend, :psnr]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
507 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
508 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
509 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
510 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
511 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
512 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
513 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
514 | line_color=line_color, line_dash="dash", name="greed (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
515 | push!(identity, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
516 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
517 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
518 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
519 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
520 | rotation = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
521 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
522 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
523 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
524 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_rotation") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
525 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
526 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
527 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
528 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
529 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
530 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
531 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
532 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
533 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
534 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
535 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
536 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
537 | Y = Float64.(data[mystart:myend, :psnr]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
538 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
539 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
540 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
541 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
542 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
543 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
544 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
545 | line_color=line_color, line_dash="longdashdot", name="rotat (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
546 | push!(identity, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
547 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
548 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
549 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
550 | affine = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
551 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
552 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
553 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
554 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_dualscaling") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
555 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
556 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
557 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
558 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
559 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
560 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
561 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
562 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
563 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
564 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
565 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
566 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
567 | Y = Float64.(data[mystart:myend, :psnr]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
568 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
569 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
570 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
571 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
572 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
573 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
574 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
575 | line_color=line_color, line_dash="solid", name="dusca (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
576 | push!(identity, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
577 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
578 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
579 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
580 | zerodual = Vector{GenericTrace{Dict{Symbol, Any}}}() |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
581 | ##################################################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
582 | directory_path = "./img/" |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
583 | files = readdir(directory_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
584 | filtered_files = filter(file -> startswith(file, "$(name)200x300_pdps_known_zerodual") && endswith(file, "0.txt"), files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
585 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
586 | # Define an array of line styles and colors |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
587 | # line_styles = ["solid", "dash", "dot", "dashdot", "longdash"] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
588 | line_colors = distinguishable_colors(15) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
589 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
590 | for (index,file) in enumerate(filtered_files) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
591 | filename = directory_path*file |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
592 | #data = readdlm(filename, '\t', skipstart=1) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
593 | data = CSV.File(filename, delim='\t'; header = 2) |> DataFrame |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
594 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
595 | # Extract the columns you want to plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
596 | X = Int64.(data[mystart:myend,:iter]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
597 | Y = Float64.(data[mystart:myend, :psnr]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
598 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
599 | #line_style = line_styles[i] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
600 | line_color = line_colors[index] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
601 | # Extract parameters for legend |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
602 | α, τ₀, σ₀ = extract_parameters(filename) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
603 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
604 | trace = PlotlyJS.scatter(;x=X, y=Y, mode="lines", hovertemplate="%{x:.0f},%{y:.3f}", |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
605 | line_color=line_color, line_dash="longdash", name="zerod (α=$α, τ₀=$τ₀, σ₀=$σ₀)") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
606 | push!(identity, trace) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
607 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
608 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
609 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
610 | layout = Layout(yaxis_type="log", legend_title_text="PSNR") # Set legend title |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
611 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
612 | if save_plot && !isempty(save_path) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
613 | plotlyjs = plot([orig;identity;adhoc;rotation;affine; zerodual], layout) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
614 | open(save_path, "w") do io |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
615 | PlotlyBase.to_html(io, plotlyjs.plot) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
616 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
617 | elseif save_plot |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
618 | println("Please provide a valid save path.") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
619 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
620 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
621 | return plot([orig;identity;adhoc;rotation;affine;zerodual],layout) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
622 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
623 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
624 | ###################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
625 | # Parameter extraction |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
626 | ###################### |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
627 | function extract_parameters(filename :: String) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
628 | # Extracting parameters |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
629 | params_line = readlines(filename)[1] |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
630 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
631 | # Split the line by commas and trim each part |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
632 | params_parts = map(strip, split(params_line, ',')) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
633 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
634 | # Initialize variables to store parameter values |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
635 | α_value, τ₀_value, σ₀_value = missing, missing, missing |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
636 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
637 | # Look for specific substrings to identify the values of α, τ₀, and σ₀ |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
638 | for param_part in params_parts |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
639 | if contains(param_part, "α = ") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
640 | α_value = parse(Float64, split(param_part, '=')[2]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
641 | elseif contains(param_part, "τ₀ = ") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
642 | τ₀_value = parse(Float64, split(param_part, '=')[2]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
643 | elseif contains(param_part, "σ₀ = ") |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
644 | σ₀_value = parse(Float64, split(param_part, '=')[2]) |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
645 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
646 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
647 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
648 | # Assign the values to α, τ₀, and σ₀ |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
649 | α = α_value |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
650 | τ₀ = τ₀_value |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
651 | σ₀ = σ₀_value |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
652 | return α, τ₀, σ₀ |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
653 | end |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
654 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
655 | |
88632284396f
added plotting and table generator
Neil Dizon <neil.dizon@helsinki.fi>
parents:
diff
changeset
|
656 | end # Module |