Skip to content

Commit 195bd19

Browse files
authored
Merge pull request #251 from JuliaRobotics/feat/4Q19/showvar
add printVariable (wip)
2 parents 6f9006e + 02280e1 commit 195bd19

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

src/DistributedFactorGraphs.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export label, getTimestamp, setTimestamp!, tags, setTags!, estimates, estimate,
2828
export DFGVariableSummary, DFGFactorSummary, AbstractDFGSummary
2929
export addBigDataEntry!, getBigDataEntry, updateBigDataEntry!, deleteBigDataEntry!, getBigDataEntries, getBigDataKeys
3030
export getNeighborhood, getSubgraph, getSubgraphAroundNode
31+
export printFactor, printVariable
3132

3233
#Skeleton types
3334
export SkeletonDFGVariable, SkeletonDFGFactor

src/needsahome.jl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,40 @@ function buildSubgraphFromLabels(dfg::G,
7171
buildSubgraphFromLabels!(dfg, syms, subfg=subfg, solvable=solvable, allowedFactors=allowedFactors )
7272
end
7373

74+
"""
75+
$SIGNATURES
76+
77+
Display and return to console the user factor identified by tag name.
78+
"""
79+
printFactor(fgl::AbstractDFG, fsym::Symbol) = @show getFactor(fgl,fsym)
80+
81+
82+
"""
83+
$SIGNATURES
84+
85+
Display the content of `VariableNodeData` to console for a given factor graph and variable tag`::Symbol`.
86+
87+
Dev Notes
88+
- TODO split as two show macros between AMP and DFG
89+
"""
90+
function printVariable(fgl::AbstractDFG, vsym::Symbol, solveKey::Symbol=:default)
91+
vert = getVariable(fgl, vsym)
92+
vnd = solverData(vert, solveKey)
93+
println("label: $(vert.label)")
94+
println("tags: $(getTags(vert))")
95+
println("size marginal samples $(size(vnd.val))")
96+
println("kde bandwidths: $((vnd.bw)[:,1])")
97+
if 0 < length(getVariablePPEs(vert))
98+
println("PPE.suggested: $(round.(getVariablePPE(vert).suggested,digits=4))")
99+
else
100+
println("No PPEs")
101+
end
102+
# println("kde max: $(round.(getKDEMax(getKDE(vnd)),digits=4))")
103+
# println("kde max: $(round.(getKDEMax(getKDE(vnd)),digits=4))")
104+
println()
105+
vnd
106+
end
107+
74108

75109
## KEEPING COMMENT, WANT TO BE CONSOLIDATED WITH FUNCTION ABOVE -- KEEPING ONLY ONE FOR MAINTAINABILITY
76110
## STILL NEEDS TO BE CONSOLIDATED WITH `DFG._copyIntoGraph`

src/services/AbstractDFG.jl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -674,14 +674,6 @@ function getFactorFunction(dfg::G, fsym::Symbol) where G <: AbstractDFG
674674
end
675675

676676

677-
"""
678-
$SIGNATURES
679-
680-
Display and return to console the user factor identified by tag name.
681-
"""
682-
showFactor(fgl::G, fsym::Symbol) where G <: AbstractDFG = @show getFactor(fgl,fsym)
683-
684-
685677
"""
686678
$(SIGNATURES)
687679
Produces a dot-format of the graph for visualization.

0 commit comments

Comments
 (0)