Skip to content

Commit 71a5c22

Browse files
authored
Merge pull request #1747 from JuliaRobotics/23Q3/ext/gadfly
GadflyExt (not working)
2 parents 8135e2f + f409a2c commit 71a5c22

File tree

7 files changed

+35
-9
lines changed

7 files changed

+35
-9
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
5050
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
5151

5252
[weakdeps]
53+
Gadfly = "c91e804a-d5a3-530f-b6f0-dfbca275c004"
5354
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
5455
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
5556

5657
[extensions]
58+
GadflyExt = "Gadfly"
5759
InteractiveUtilsExt = "InteractiveUtils"
5860
InterpolationsExt = "Interpolations"
5961

src/services/EmbeddedPlottingUtils.jl renamed to ext/GadflyExt.jl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
module GadflyExt
12

2-
@info "Defining spyCliqMat(..) for visualizing association matrix of a clique in the Bayes (Junction) tree"
3+
@info "IncrementalInference.jl is loading plotting extensions relating to Gadfly.jl"
34

4-
exportimg(pl) = Gadfly.PNG(pl)
5+
using Gadfly
6+
using DocStringExtensions
7+
using IncrementalInference: AbstractBayesTree, TreeCliq, getCliqueData, getCliqAssocMat, getCliqMat, getLabel, getCliqMsgMat, getClique
8+
import IncrementalInference: exportimg, spyCliqMat
9+
10+
export exportimg, spyCliqMat
511

6-
export spyCliqMat
12+
exportimg(pl) = Gadfly.PNG(pl)
713

814
"""
915
$SIGNATURES
@@ -59,3 +65,6 @@ function spyCliqMat(
5965
)
6066
return spyCliqMat(getClique(bt, lbl); showmsg = showmsg, suppressprint = suppressprint)
6167
end
68+
69+
70+
end

ext/WeakDepsPrototypes.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
# InteractiveUtils.jl
33
function getCurrentWorkspaceFactors end
44
function getCurrentWorkspaceVariables end
5-
function listTypeTree end
5+
function listTypeTree end
6+
7+
# Gadfly.jl
8+
function exportimg end
9+
function spyCliqMat end

src/Deprecated.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ end
124124
## Deprecate code below before v0.35
125125
##==============================================================================
126126

127+
# exportimg(pl) = error("Please do `using Gadfly` to allow image export.")
128+
127129
# function _perturbIfNecessary(
128130
# fcttype::Union{F, <:Mixture{N_, F, S, T}},
129131
# len::Int = 1,

src/ExportAPI.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,4 +362,7 @@ export MetaPrior
362362
export getCurrentWorkspaceFactors, getCurrentWorkspaceVariables
363363
export listTypeTree
364364

365+
# weakdeps on Gadfly.jl
366+
export exportimg, spyCliqMat
367+
365368
#

src/IncrementalInference.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,13 @@ include("../ext/WeakDepsPrototypes.jl")
239239
# deprecation legacy support
240240
include("Deprecated.jl")
241241

242-
exportimg(pl) = error("Please do `using Gadfly` to allow image export.")
243242
function __init__()
244243
# @require InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" include(
245244
# "services/RequireInteractiveUtils.jl",
246245
# )
247-
@require Gadfly = "c91e804a-d5a3-530f-b6f0-dfbca275c004" include(
248-
"services/EmbeddedPlottingUtils.jl",
249-
)
246+
# @require Gadfly = "c91e804a-d5a3-530f-b6f0-dfbca275c004" include(
247+
# "services/EmbeddedPlottingUtils.jl",
248+
# )
250249
@require DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa" include(
251250
"ODE/DERelative.jl",
252251
)

test/testBasicTreeInit.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11

22
using Test
33
using IncrementalInference
4+
# using Gadfly
45

6+
##
57
@testset "basic per clique stopping criteria" begin
8+
##
69

710
fg = generateGraph_LineStep(1)
811
smtasks = Task[]
@@ -94,7 +97,7 @@ addFactor!(fg, [:s1;:s2], LinearRelative(Normal()))
9497

9598
smtasks = Task[]
9699

97-
solveTree!(fg; smtasks=smtasks, verbose=true)
100+
tree = solveTree!(fg; smtasks=smtasks, verbose=true)
98101

99102

100103
for var in good_vars
@@ -104,6 +107,10 @@ for var in good_vars
104107
end
105108

106109

110+
@error "Restore test on GadflyExt.spyCliqMat"
111+
# pl = spyCliqMat(getClique(tree,1));
112+
113+
##
107114
end
108115

109116
#

0 commit comments

Comments
 (0)