Skip to content

Commit

Permalink
Merge pull request #1747 from JuliaRobotics/23Q3/ext/gadfly
Browse files Browse the repository at this point in the history
GadflyExt (not working)
  • Loading branch information
dehann authored Jul 12, 2023
2 parents 8135e2f + f409a2c commit 71a5c22
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 9 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

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

[extensions]
GadflyExt = "Gadfly"
InteractiveUtilsExt = "InteractiveUtils"
InterpolationsExt = "Interpolations"

Expand Down
15 changes: 12 additions & 3 deletions src/services/EmbeddedPlottingUtils.jl → ext/GadflyExt.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
module GadflyExt

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

exportimg(pl) = Gadfly.PNG(pl)
using Gadfly
using DocStringExtensions
using IncrementalInference: AbstractBayesTree, TreeCliq, getCliqueData, getCliqAssocMat, getCliqMat, getLabel, getCliqMsgMat, getClique
import IncrementalInference: exportimg, spyCliqMat

export exportimg, spyCliqMat

export spyCliqMat
exportimg(pl) = Gadfly.PNG(pl)

"""
$SIGNATURES
Expand Down Expand Up @@ -59,3 +65,6 @@ function spyCliqMat(
)
return spyCliqMat(getClique(bt, lbl); showmsg = showmsg, suppressprint = suppressprint)
end


end
6 changes: 5 additions & 1 deletion ext/WeakDepsPrototypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
# InteractiveUtils.jl
function getCurrentWorkspaceFactors end
function getCurrentWorkspaceVariables end
function listTypeTree end
function listTypeTree end

# Gadfly.jl
function exportimg end
function spyCliqMat end
2 changes: 2 additions & 0 deletions src/Deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ end
## Deprecate code below before v0.35
##==============================================================================

# exportimg(pl) = error("Please do `using Gadfly` to allow image export.")

# function _perturbIfNecessary(
# fcttype::Union{F, <:Mixture{N_, F, S, T}},
# len::Int = 1,
Expand Down
3 changes: 3 additions & 0 deletions src/ExportAPI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,7 @@ export MetaPrior
export getCurrentWorkspaceFactors, getCurrentWorkspaceVariables
export listTypeTree

# weakdeps on Gadfly.jl
export exportimg, spyCliqMat

#
7 changes: 3 additions & 4 deletions src/IncrementalInference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,13 @@ include("../ext/WeakDepsPrototypes.jl")
# deprecation legacy support
include("Deprecated.jl")

exportimg(pl) = error("Please do `using Gadfly` to allow image export.")
function __init__()
# @require InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" include(
# "services/RequireInteractiveUtils.jl",
# )
@require Gadfly = "c91e804a-d5a3-530f-b6f0-dfbca275c004" include(
"services/EmbeddedPlottingUtils.jl",
)
# @require Gadfly = "c91e804a-d5a3-530f-b6f0-dfbca275c004" include(
# "services/EmbeddedPlottingUtils.jl",
# )
@require DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa" include(
"ODE/DERelative.jl",
)
Expand Down
9 changes: 8 additions & 1 deletion test/testBasicTreeInit.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@

using Test
using IncrementalInference
# using Gadfly

##
@testset "basic per clique stopping criteria" begin
##

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

smtasks = Task[]

solveTree!(fg; smtasks=smtasks, verbose=true)
tree = solveTree!(fg; smtasks=smtasks, verbose=true)


for var in good_vars
Expand All @@ -104,6 +107,10 @@ for var in good_vars
end


@error "Restore test on GadflyExt.spyCliqMat"
# pl = spyCliqMat(getClique(tree,1));

##
end

#

0 comments on commit 71a5c22

Please sign in to comment.