src/PET/PlotResults.jl

Thu, 25 Apr 2024 14:20:38 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Thu, 25 Apr 2024 14:20:38 -0500
changeset 39
b180a4f3b9bd
parent 29
6a0ca7047f68
child 41
3e54b2b54029
permissions
-rw-r--r--

merge

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

mercurial