Skip to content

Commit f9a7c79

Browse files
authored
Merge pull request #844 from JuliaRobotics/22Q1/depr/rm_old
update deprecations
2 parents 6c14cc8 + 7a548e2 commit f9a7c79

File tree

12 files changed

+49
-154
lines changed

12 files changed

+49
-154
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Listing news on any major breaking changes in DFG. For regular changes, see int
66
- Switch to GraphsDFG, deprecating archived LightGraphs.jl (#826).
77
- Workaround: packed factor data `.fnc` encoded as base64 to avoid escape character problems (#834).
88
- Towards distributions serialized via JSON, getting away from custom strings.
9+
- `LocalDFG` replaces `DefaultDFG` (#844).
10+
- Optimized creation of CGDFG / `createDfgSessionIfNotExist` (#839, #815).
11+
- `plotDFG` replaces `dfgplot` (#841, #844).
912

1013
# v0.16.0
1114

attic/MetaGraphsDFG/DFGPlots.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ using GraphPlot
99
using DistributedFactorGraphs, DistributedFactorGraphs.DFGPlots
1010
# ... Make graph...
1111
# Using GraphViz plotting
12-
dfgplot(fg)
12+
plotDFG(fg)
1313
# Save to PDFG
1414
using Compose
15-
draw(PDF("/tmp/graph.pdf", 16cm, 16cm), dfgplot(fg))
15+
draw(PDF("/tmp/graph.pdf", 16cm, 16cm), plotDFG(fg))
1616
```
1717
1818
More information at [GraphPlot.jl](https://github.com/JuliaGraphs/GraphPlot.jl)
1919
"""
20-
function dfgplot(dfg::DistributedFactorGraphs.MetaGraphsDFG, p::DFGPlotProps = DFGPlotProps())
20+
function plotDFG(dfg::DistributedFactorGraphs.MetaGraphsDFG, p::DFGPlotProps = DFGPlotProps())
2121
@info "Deprecated, please use GraphsDFG or LightDFG."
2222
nodesize = [has_prop(dfg.g,i,:factor) ? p.nodesize.fac : p.nodesize.var for i=vertices(dfg.g)]
2323
if p.drawlabels

docs/src/DrawingGraphs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ using GraphPlot
1818
using DistributedFactorGraphs
1919
```
2020

21-
Any factor graph can then be drawn by calling [`dfgplot`](@ref):
21+
Any factor graph can then be drawn by calling [`plotDFG`](@ref):
2222

2323
```@example plots
2424
using Cairo # hide
@@ -35,7 +35,7 @@ f1 = addFactor!(dfg, [:l0; :x0], LinearConditional(Normal(40.0,5.0)), solvable=1
3535
f1 = addFactor!(dfg, [:l0; :x1], LinearConditional(Normal(-10.0,5.0)), solvable=1)
3636
3737
# Plot graph
38-
dfgplot(dfg)
38+
plotDFG(dfg)
3939
```
4040

4141
### Rendering GraphPlot to PDF
@@ -49,7 +49,7 @@ dfg.solverParams.graphinit = false # hide
4949
addVariable!(dfg, :x2, ContinuousScalar);
5050
addFactor!(dfg, [:x1; :x2], LinearConditional(Normal(50.0,2.0)));
5151
# Save to SVG
52-
draw(SVG("graph.svg", 10cm, 10cm), dfgplot(dfg));
52+
draw(SVG("graph.svg", 10cm, 10cm), plotDFG(dfg));
5353
nothing # hide
5454
```
5555
![](graph.svg)

src/CloudGraphsDFG/services/CloudGraphsDFG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ end
978978

979979
export SkeletonDFG
980980
function SkeletonDFG(cfg::CloudGraphsDFG)
981-
sfg = DefaultDFG{NoSolverParams, SkeletonDFGVariable, SkeletonDFGFactor}()
981+
sfg = LocalDFG{NoSolverParams, SkeletonDFGVariable, SkeletonDFGFactor}()
982982
addVariable!.(sfg, _getSkeletonVariables(cfg))
983983
addFactor!.(sfg, _getSkeletonFactors(cfg))
984984
return sfg

src/DFGPlots/DFGPlots.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import ..GraphPlot: gplot
99
using ...DistributedFactorGraphs
1010

1111
export
12-
dfgplot,
12+
plotDFG,
1313
DFGPlotProps
1414

1515
struct DFGPlotProps
@@ -40,15 +40,15 @@ using GraphPlot
4040
using DistributedFactorGraphs, DistributedFactorGraphs.DFGPlots
4141
# ... Make graph...
4242
# Using GraphViz plotting
43-
dfgplot(fg)
43+
plotDFG(fg)
4444
# Save to PDF
4545
using Compose
46-
draw(PDF("/tmp/graph.pdf", 16cm, 16cm), dfgplot(fg))
46+
draw(PDF("/tmp/graph.pdf", 16cm, 16cm), plotDFG(fg))
4747
```
4848
4949
More information at [GraphPlot.jl](https://github.com/JuliaGraphs/GraphPlot.jl)
5050
"""
51-
function dfgplot(dfg::GraphsDFG, p::DFGPlotProps = DFGPlotProps())
51+
function plotDFG(dfg::GraphsDFG, p::DFGPlotProps = DFGPlotProps())
5252

5353
nodetypes = [haskey(dfg.g.variables, s) for s in dfg.g.labels]
5454

@@ -66,11 +66,11 @@ function dfgplot(dfg::GraphsDFG, p::DFGPlotProps = DFGPlotProps())
6666

6767
end
6868

69-
function dfgplot(dfg::AbstractDFG, p::DFGPlotProps = DFGPlotProps())
69+
function plotDFG(dfg::AbstractDFG, p::DFGPlotProps = DFGPlotProps())
7070
# TODO implement convert functions
7171
ldfg = GraphsDFG{NoSolverParams}()
7272
copyGraph!(ldfg, dfg, listVariables(dfg), listFactors(dfg), copyGraphMetadata=false)
73-
dfgplot(ldfg, p)
73+
plotDFG(ldfg, p)
7474
end
7575

7676
function gplot(dfg::GraphsDFG; keyargs...)
@@ -79,14 +79,14 @@ end
7979

8080
#TODO decide if we want to overload show for display in juno, It's a bit annoying with development
8181
# function Base.show(io::IO, ::MIME"application/prs.juno.plotpane+html", dfg::AbstractDFG)
82-
function dfgplot(io::IO, ::MIME"application/prs.juno.plotpane+html", dfg::AbstractDFG)
82+
function plotDFG(io::IO, ::MIME"application/prs.juno.plotpane+html", dfg::AbstractDFG)
8383

8484
if length(ls(dfg)) != 0
8585
size = get(io, :juno_plotsize, [100, 100])
8686

8787
plot_output = IOBuffer()
8888
GraphPlot.draw(GraphPlot.SVGJS(plot_output, GraphPlot.Compose.default_graphic_width,
89-
GraphPlot.Compose.default_graphic_width, false), dfgplot(dfg))
89+
GraphPlot.Compose.default_graphic_width, false), plotDFG(dfg))
9090
plotsvg = String(take!(plot_output))
9191

9292
print(io,

src/Deprecated.jl

Lines changed: 18 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,14 @@
1-
##==============================================================================
2-
# deprecation staging area
3-
##==============================================================================
4-
##==============================================================================
5-
## Deprecated in v0.9 Remove in the v0.10 cycle
6-
##==============================================================================
7-
8-
@deprecate listSolvekeys(x...) listSolveKeys(x...)
9-
10-
##==============================================================================
11-
## Deprecated in v0.10 Remove in 0.11
12-
##==============================================================================
13-
14-
@deprecate getMaxPPE(est::AbstractPointParametricEst) getPPEMax(est)
15-
@deprecate getMeanPPE(est::AbstractPointParametricEst) getPPEMean(est)
16-
@deprecate getSuggestedPPE(est::AbstractPointParametricEst) getPPESuggested(est)
17-
18-
@deprecate addVariableSolverData!(dfg::AbstractDFG, variablekey::Symbol, vnd::VariableNodeData, solveKey::Symbol) addVariableSolverData!(dfg, variablekey, vnd)
19-
20-
@deprecate updatePPE!(dfg::AbstractDFG, variablekey::Symbol, ppe::AbstractPointParametricEst, ppekey::Symbol) updatePPE!(dfg, variablekey, ppe)
21-
22-
@deprecate addPPE!(dfg::AbstractDFG, variablekey::Symbol, ppe::AbstractPointParametricEst, ppekey::Symbol) addPPE!(dfg, variablekey, ppe)
23-
24-
25-
export AbstractDataStore
26-
abstract type AbstractDataStore end
27-
struct GeneralDataEntry <: AbstractDataEntry end
28-
GeneralDataEntry(args...; kwargs...) = error("`GeneralDataEntry` is deprecated, use `BlobStoreEntry`")
29-
30-
export InMemoryDataStore, FileDataStore
31-
32-
struct FileDataStore <: AbstractDataStore end
33-
FileDataStore(args...; kwargs...) = error("`FileDataStore` is deprecated, use `FolderStore`")
34-
35-
struct InMemoryDataStore <: AbstractDataStore end
36-
InMemoryDataStore(args...; kwargs...) = error("`InMemoryDataStore` is deprecated, use TBD")#TODO
37-
38-
_uniqueKey(dfg::AbstractDFG, v::AbstractDFGVariable, key::Symbol)::Symbol = error("_uniqueKey is deprecated")
39-
40-
getDataBlob(store::AbstractDataStore, entry::AbstractDataEntry) = error("AbstractDataStore $(typeof(store)) is deprecated.")
41-
addDataBlob!(store::AbstractDataStore, entry::AbstractDataEntry, data) = error("AbstractDataStore $(typeof(store)) is deprecated.")
42-
updateDataBlob!(store::AbstractDataStore, entry::AbstractDataEntry, data) = error("AbstractDataStore $(typeof(store)) is deprecated.")
43-
deleteDataBlob!(store::AbstractDataStore, entry::AbstractDataEntry) = error("AbstractDataStore $(typeof(store)) is deprecated.")
44-
listDataBlobs(store::AbstractDataStore) = error("AbstractDataStore $(typeof(store)) is deprecated.")
45-
46-
47-
addData!(dfg::AbstractDFG,
48-
lbl::Symbol,
49-
datastore::Union{FileDataStore, InMemoryDataStore},
50-
descr::Symbol,
51-
mimeType::AbstractString,
52-
data::Vector{UInt8} ) = error("This API, FileDataStore and in MemoryDataStore is deprecated use new api parameter order and FolderStore")
53-
54-
export addDataElement!
55-
addDataElement!(dfg::AbstractDFG,
56-
lbl::Symbol,
57-
datastore::Union{FileDataStore, InMemoryDataStore},
58-
descr::Symbol,
59-
mimeType::AbstractString,
60-
data::Vector{UInt8} ) = error("This API, FileDataStore and in MemoryDataStore is deprecated use addData! and FolderStore")
61-
62-
63-
64-
export getDataEntryBlob
65-
getDataEntryBlob(dfg::AbstractDFG,
66-
dfglabel::Symbol,
67-
datastore::Union{FileDataStore, InMemoryDataStore},
68-
datalabel::Symbol) = error("This API, FileDataStore and in MemoryDataStore is deprecated use getData and FolderStore")
69-
70-
export fetchDataEntryElement
71-
const fetchDataEntryElement = getDataEntryBlob
72-
export fetchData
73-
const fetchData = getDataEntryBlob
74-
75-
#
76-
77-
## softtype deprections
78-
function Base.getproperty(x::InferenceVariable, f::Symbol)
79-
if f==:dims
80-
Base.depwarn("varType $(typeof(x)), field dims is deprecated, extend and use `getDimension` instead",:getproperty)
81-
elseif f==:manifolds
82-
Base.depwarn("varType $(typeof(x)), field manifolds is deprecated, extend and use `getManifold` instead",:getproperty)
83-
else
84-
if !(@isdefined softtypeFieldsWarnOnce)
85-
Base.depwarn("varType $(typeof(x)), will be required to be a singleton type in the future and can no longer have fields. *.$f called. Further warnings are suppressed",:getproperty)
86-
global softtypeFieldsWarnOnce = true
87-
end
88-
end
89-
return getfield(x,f)
90-
end
91-
1+
## ================================================================================
2+
## LEGACY ON TIMESTAMPS, TODO DEPRECATE
3+
##=================================================================================
924

935

94-
# SmallData is now a Symbol Dict
95-
function createSymbolDict(d::Dict{String, String})
96-
newsmalld = Dict{Symbol,SmallDataTypes}()
97-
for p in pairs(d)
98-
push!(newsmalld, Symbol(p.first) => p.second)
99-
end
100-
return newsmalld
101-
end
102-
103-
@deprecate setSmallData!(v::DFGVariable, smallData::Dict{String, String}) setSmallData!(v, createSymbolDict(smallData))
104-
105-
#update deprecation with warn_if_absent
106-
function updateVariableSolverData!(dfg::AbstractDFG,
107-
variablekey::Symbol,
108-
vnd::VariableNodeData,
109-
useCopy::Bool,
110-
fields::Vector{Symbol},
111-
verbose::Bool)
112-
Base.depwarn("updateVariableSolverData! argument verbose is deprecated in favor of keyword argument `warn_if_absent`, see #643", :updateVariableSolverData!)
113-
updateVariableSolverData!(dfg, variablekey, vnd, useCopy, fields; warn_if_absent = verbose)
114-
end
115-
116-
function updateVariableSolverData!(dfg::AbstractDFG,
117-
variablekey::Symbol,
118-
vnd::VariableNodeData,
119-
solveKey::Symbol,
120-
useCopy::Bool,
121-
fields::Vector{Symbol},
122-
verbose::Bool)
123-
Base.depwarn("updateVariableSolverData! argument verbose is deprecated in favor of keyword argument `warn_if_absent`, see #643", :updateVariableSolverData!)
124-
updateVariableSolverData!(dfg, variablekey, vnd, solveKey, useCopy, fields; warn_if_absent = verbose)
6+
Base.promote_rule(::Type{DateTime}, ::Type{ZonedDateTime}) = DateTime
7+
function Base.convert(::Type{DateTime}, ts::ZonedDateTime)
8+
@warn "DFG now uses ZonedDateTime, temporary promoting and converting to DateTime local time"
9+
return DateTime(ts, Local)
12510
end
12611

127-
128-
12912
## ================================================================================
13013
## Deprecate before v0.17
13114
##=================================================================================
@@ -202,13 +85,19 @@ end
20285
## Deprecate before v0.19
20386
##=================================================================================
20487

88+
@deprecate dfgplot(w...;kw...) plotDFG(w...;kw...)
89+
90+
export FunctorInferenceType, PackedInferenceType
91+
20592
const FunctorInferenceType = AbstractFactor # will eventually deprecate
20693
const PackedInferenceType = AbstractPackedFactor # will eventually deprecate
20794

208-
Base.promote_rule(::Type{DateTime}, ::Type{ZonedDateTime}) = DateTime
209-
function Base.convert(::Type{DateTime}, ts::ZonedDateTime)
210-
@warn "DFG now uses ZonedDateTime, temporary promoting and converting to DateTime local time"
211-
return DateTime(ts, Local)
212-
end
95+
## ================================================================================
96+
## Deprecate before v0.20
97+
##=================================================================================
98+
99+
export DefaultDFG
100+
101+
const DefaultDFG = LightDFG
213102

214103
#

src/DistributedFactorGraphs.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export updateUserData!, updateRobotData!, updateSessionData!, deleteUserData!, d
7272
export emptyUserData!, emptyRobotData!, emptySessionData!
7373

7474
# Graph Types: exported from modules or @reexport
75-
export InMemoryDFGTypes, DefaultDFG
75+
export InMemoryDFGTypes, LocalDFG
7676

7777
# AbstractDFG Interface
7878
export exists,
@@ -205,7 +205,6 @@ export addData!
205205
# Factor Data
206206
export GenericFunctionNodeData, PackedFunctionNodeData, FunctionNodeData
207207
export AbstractFactor, AbstractPackedFactor
208-
export FunctorInferenceType, PackedInferenceType # NOTE might be deprecated in the future (const aliases)
209208
export AbstractPrior, AbstractRelative, AbstractRelativeRoots, AbstractRelativeMinimize, AbstractManifoldMinimize
210209
export FactorOperationalMemory
211210

@@ -297,9 +296,10 @@ include("GraphsDFG/GraphsDFG.jl")
297296

298297
include("LightDFG/LightDFG.jl")
299298
@reexport using .LightDFGs
299+
300300
#supported in Memory fg types
301301
const InMemoryDFGTypes = Union{GraphsDFG, LightDFG}
302-
const DefaultDFG = LightDFG
302+
const LocalDFG = GraphsDFG
303303

304304
# Common includes
305305
include("services/CommonAccessors.jl")

src/services/AbstractDFG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ function buildSubgraph(dfg::AbstractDFG,
11981198
variableFactorLabels::Vector{Symbol},
11991199
distance::Int=0;
12001200
kwargs...)
1201-
return buildSubgraph(DefaultDFG, dfg, variableFactorLabels, distance; kwargs...)
1201+
return buildSubgraph(LocalDFG, dfg, variableFactorLabels, distance; kwargs...)
12021202
end
12031203

12041204
"""

src/services/DFGVariable.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,9 @@ addPPE!(dfg::AbstractDFG, sourceVariable::DFGVariable, ppekey::Symbol=:default)
812812
"""
813813
$(SIGNATURES)
814814
Update PPE data if it exists, otherwise add it -- one call per `key::Symbol=:default`.
815+
816+
Notes
817+
- uses `ppe.solveKey` as solveKey.
815818
"""
816819
function updatePPE!(dfg::AbstractDFG, variablekey::Symbol, ppe::AbstractPointParametricEst; warn_if_absent::Bool=true)
817820
var = getVariable(dfg, variablekey)

test/attic/IIF4DoorsTests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ mlc = MixturePrior(Normal.(doors[1,:], bws[1]), 0.25*ones(4))
6767
addFactor!(fg,[:x7], mlc )
6868

6969

70-
dfgplot(fg)
70+
plotDFG(fg)
7171

7272
tree = solveTree!(fg)
7373

0 commit comments

Comments
 (0)