Skip to content

Commit 68f2af6

Browse files
committed
add test for LP-HGLET
1 parent 87f1638 commit 68f2af6

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

test/runtests.jl

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ using Test, MultiscaleGraphSignalTransforms, LinearAlgebra, SparseArrays, JLD2,
1818
frecon=ghwt_synthesis(dvec,GP,BH)
1919
println("Relative L2 error of the Haar transform: ", norm(G.f-frecon)/norm(G.f))
2020
@test norm(G.f-frecon)/norm(G.f) < 10 * eps()
21-
end
21+
end
2222

2323
@testset "Check the best basis and its expansion coefficients" begin
2424
bbc2f = ghwt_c2f_bestbasis(dc2f, GP)
@@ -151,6 +151,32 @@ using Test, MultiscaleGraphSignalTransforms, LinearAlgebra, SparseArrays, JLD2,
151151
plt = GraphSig_Plot(G)
152152
display(plt)
153153
@test typeof(plt) == Plots.Plot{Plots.GRBackend}
154+
println("\n")
155+
end
156+
157+
###################################################
158+
# 6. Testing LP-HGLET functions on a real dataset #
159+
###################################################
160+
161+
@testset "6. LP-HGLET on RGC100" begin
162+
println("6. LP-HGLET on RGC100")
163+
JLD2.@load "runtests_data/Dendrite.jld2" G
164+
G = G["G_3D"]
165+
f = rand(1154, 1)
166+
G_Sig = GraphSig(1.0 * G["W"]; xy = G["xy"], f = f)
167+
G_Sig = Adj2InvEuc(G_Sig)
168+
GP = partition_tree_fiedler(G_Sig; swapRegion = false)
169+
170+
dmatrixlH, _ = LPHGLET_Analysis_All(G_Sig, GP; ϵ = 0.3)
171+
dvec_lphglet, BS_lphglet, _ = HGLET_GHWT_BestBasis(GP, dmatrixH = dmatrixlH)
172+
173+
fS, GS = LPHGLET_Synthesis(reshape(dvec_lphglet, (length(dvec_lphglet), 1)), GP, BS_lphglet, G_Sig; ϵ = 0.3)
174+
println("The original signal has L1 norm: ", norm(f, 1))
175+
println("The coefficients of LP-HGLET best-basis has L1 norm: ", norm(dvec_lphglet, 1))
176+
println("Relative L2 error of the synthesized signal: ", norm(f - fS) / norm(f))
177+
@test norm(f - fS) / norm(f) < 20 * eps()
178+
println("\n")
154179
end
180+
155181
end
156182
# End of runtests.jl

0 commit comments

Comments
 (0)