src/PET/PlotResults.jl

Fri, 03 May 2024 12:40:13 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Fri, 03 May 2024 12:40:13 -0500
changeset 53
a1ec1a15f3b0
parent 41
3e54b2b54029
permissions
-rw-r--r--

Remove unnecessary deps; anything that requires Conda junk. Update manifest format etc.

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

mercurial