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