Skip to content

Commit 74991a2

Browse files
committed
estimateDict -> ppeDict
1 parent e29390f commit 74991a2

File tree

8 files changed

+88
-69
lines changed

8 files changed

+88
-69
lines changed

src/CloudGraphsDFG/services/CloudGraphsDFG.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ function mergeUpdateVariableSolverData!(dfg::CloudGraphsDFG, sourceVariable::DFG
256256
error("Source variable '$(sourceVariable.label)' doesn't exist in the graph.")
257257
end
258258
var = getVariable(dfg, sourceVariable.label)
259-
newEsts = merge!(var.estimateDict, deepcopy(sourceVariable.estimateDict))
259+
newEsts = merge!(var.ppeDict, deepcopy(sourceVariable.ppeDict))
260260
newSolveData = merge!(var.solverDataDict, sourceVariable.solverDataDict)
261-
Neo4j.setnodeproperty(dfg.neo4jInstance.graph, var._internalId, "estimateDict",
261+
Neo4j.setnodeproperty(dfg.neo4jInstance.graph, var._internalId, "ppeDict",
262262
JSON2.write(newEsts))
263263
Neo4j.setnodeproperty(dfg.neo4jInstance.graph, var._internalId, "solverDataDict",
264264
JSON2.write(Dict(keys(newSolveData) .=> map(vnd -> pack(dfg, vnd), values(newSolveData)))))

src/Deprecated.jl

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# deprecation staging area
2+
3+
## quick deprecation handle
4+
import Base: propertynames, getproperty
5+
6+
Base.propertynames(x::VariableDataLevel1, private::Bool=false) = private ? (:estimateDict, :ppeDict) : (:ppeDict,)
7+
8+
Base.getproperty(x::VariableDataLevel1,f::Symbol) = begin
9+
if f == :estimateDict
10+
@warn "estimateDict is deprecated, use ppeDict instead"
11+
getfield(x, :ppeDict)
12+
else
13+
getfield(x,f)
14+
end
15+
end
16+
17+
18+
19+
"""
20+
$SIGNATURES
21+
22+
Return the estimates for a variable.
23+
"""
24+
function getEstimates(v::VariableDataLevel1)
25+
@warn "Deprecated getEstimates, use getVariablePPE/getPPE instead."
26+
getVariablePPEs(vari)
27+
end
28+
29+
"""
30+
$SIGNATURES
31+
32+
Return the estimates for a variable.
33+
34+
DEPRECATED, estimates -> getVariablePPEs/getPPEs
35+
"""
36+
function estimates(v::VariableDataLevel1)
37+
@warn "Deprecated estimates, use getVariablePPEs/getPPE instead."
38+
getVariablePPEs(v)
39+
end
40+
41+
"""
42+
$SIGNATURES
43+
44+
Return a keyed estimate (default is :default) for a variable.
45+
46+
DEPRECATED use getVariablePPE/getPPE instead.
47+
"""
48+
function getEstimate(v::VariableDataLevel1, key::Symbol=:default)
49+
@warn "Deprecated getEstimate, use getVariablePPE/getPPE instead."
50+
getVariablePPE(v, key)
51+
end
52+
53+
"""
54+
$SIGNATURES
55+
56+
Return a keyed estimate (default is :default) for a variable.
57+
"""
58+
function estimate(v::VariableDataLevel1, key::Symbol=:default)
59+
@warn "DEPRECATED estimate, use getVariablePPE/getPPE instead."
60+
getVariablePPE(v, key)
61+
end
62+
63+
64+
"""
65+
$SIGNATURES
66+
67+
Return the softtype for a variable.
68+
69+
DEPRECATED, softtype -> getSofttype
70+
"""
71+
function softtype(v::VariableDataLevel1)
72+
@warn "Deprecated softtype, use getSofttype instead."
73+
getSofttype(v)
74+
end

src/DistributedFactorGraphs.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ include("entities/AbstractDFG.jl")
1515
include("entities/DFGFactor.jl")
1616
include("entities/DFGVariable.jl")
1717
include("entities/AbstractDFGSummary.jl")
18+
include("Deprecated.jl")
1819

1920
export AbstractDFG
2021
export AbstractParams, NoSolverParams

src/entities/DFGVariable.jl

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ mutable struct DFGVariable <: AbstractDFGVariable
145145
label::Symbol
146146
timestamp::DateTime
147147
tags::Vector{Symbol}
148-
estimateDict::Dict{Symbol, <: AbstractPointParametricEst}
148+
ppeDict::Dict{Symbol, <: AbstractPointParametricEst}
149149
solverDataDict::Dict{Symbol, VariableNodeData}
150150
smallData::Dict{String, String}
151151
bigData::Dict{Symbol, AbstractBigDataEntry}
@@ -183,7 +183,7 @@ mutable struct DFGVariableSummary <: AbstractDFGVariable
183183
label::Symbol
184184
timestamp::DateTime
185185
tags::Vector{Symbol}
186-
estimateDict::Dict{Symbol, <:AbstractPointParametricEst}
186+
ppeDict::Dict{Symbol, <:AbstractPointParametricEst}
187187
softtypename::Symbol
188188
_internalId::Int64
189189
end
@@ -216,7 +216,7 @@ Return dictionary with Parametric Point Estimates (PPE) values.
216216
Notes:
217217
- Equivalent to `getPPEs`.
218218
"""
219-
getVariablePPEs(vari::VariableDataLevel1)::Dict = vari.estimateDict
219+
getVariablePPEs(vari::VariableDataLevel1)::Dict = vari.ppeDict
220220

221221
"""
222222
$SIGNATURES
@@ -248,50 +248,6 @@ end
248248

249249
getVariablePPE(dfg::AbstractDFG, vsym::Symbol, solveKey::Symbol=:default) = getVariablePPE(getVariable(dfg,vsym), solveKey)
250250

251-
"""
252-
$SIGNATURES
253-
254-
Return the estimates for a variable.
255-
"""
256-
function getEstimates(v::VariableDataLevel1)
257-
@warn "Deprecated getEstimates, use getVariablePPE/getPPE instead."
258-
getVariablePPEs(vari)
259-
end
260-
261-
"""
262-
$SIGNATURES
263-
264-
Return the estimates for a variable.
265-
266-
DEPRECATED, estimates -> getVariablePPEs/getPPEs
267-
"""
268-
function estimates(v::VariableDataLevel1)
269-
@warn "Deprecated estimates, use getVariablePPEs/getPPE instead."
270-
getVariablePPEs(v)
271-
end
272-
273-
"""
274-
$SIGNATURES
275-
276-
Return a keyed estimate (default is :default) for a variable.
277-
278-
DEPRECATED use getVariablePPE/getPPE instead.
279-
"""
280-
function getEstimate(v::VariableDataLevel1, key::Symbol=:default)
281-
@warn "Deprecated getEstimate, use getVariablePPE/getPPE instead."
282-
getVariablePPE(v, key)
283-
end
284-
285-
"""
286-
$SIGNATURES
287-
288-
Return a keyed estimate (default is :default) for a variable.
289-
"""
290-
function estimate(v::VariableDataLevel1, key::Symbol=:default)
291-
@warn "DEPRECATED estimate, use getVariablePPE/getPPE instead."
292-
getVariablePPE(v, key)
293-
end
294-
295251

296252
"""
297253
$(SIGNATURES)
@@ -319,18 +275,6 @@ getSofttype(v::DFGVariableSummary)::Symbol = v.softtypename
319275

320276

321277

322-
"""
323-
$SIGNATURES
324-
325-
Return the softtype for a variable.
326-
327-
DEPRECATED, softtype -> getSofttype
328-
"""
329-
function softtype(v::VariableDataLevel1)
330-
@warn "Deprecated softtype, use getSofttype instead."
331-
getSofttype(v)
332-
end
333-
334278

335279
"""
336280
$SIGNATURES

src/services/AbstractDFG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ function mergeUpdateVariableSolverData!(dfg::AbstractDFG, sourceVariable::Abstra
511511
end
512512
var = getVariable(dfg, sourceVariable.label)
513513
# We don't know which graph this came from, must be copied!
514-
merge!(var.estimateDict, deepcopy(sourceVariable.estimateDict))
514+
merge!(var.ppeDict, deepcopy(sourceVariable.ppeDict))
515515
# If this variable has solverDataDict (summaries do not)
516516
:solverDataDict in fieldnames(typeof(var)) && merge!(var.solverDataDict, deepcopy(sourceVariable.solverDataDict))
517517
return sourceVariable

src/services/DFGVariable.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function packVariable(dfg::G, v::DFGVariable)::Dict{String, Any} where G <: Abst
55
props["label"] = string(v.label)
66
props["timestamp"] = string(v.timestamp)
77
props["tags"] = JSON2.write(v.tags)
8-
props["estimateDict"] = JSON2.write(v.estimateDict)
8+
props["ppeDict"] = JSON2.write(v.ppeDict)
99
props["solverDataDict"] = JSON2.write(Dict(keys(v.solverDataDict) .=> map(vnd -> pack(dfg, vnd), values(v.solverDataDict))))
1010
props["smallData"] = JSON2.write(v.smallData)
1111
props["solvable"] = v.solvable
@@ -19,7 +19,7 @@ function unpackVariable(dfg::G, packedProps::Dict{String, Any})::DFGVariable whe
1919
timestamp = DateTime(packedProps["timestamp"])
2020
tags = JSON2.read(packedProps["tags"], Vector{Symbol})
2121
#TODO this will work for some time, but unpacking in an <: AbstractPointParametricEst would be lekker.
22-
estimateDict = JSON2.read(packedProps["estimateDict"], Dict{Symbol, MeanMaxPPE})
22+
ppeDict = JSON2.read(packedProps["ppeDict"], Dict{Symbol, MeanMaxPPE})
2323
smallData = nothing
2424
smallData = JSON2.read(packedProps["smallData"], Dict{String, String})
2525
bigDataElemTypes = JSON2.read(packedProps["bigDataElemType"], Dict{Symbol, Symbol})
@@ -37,7 +37,7 @@ function unpackVariable(dfg::G, packedProps::Dict{String, Any})::DFGVariable whe
3737
end
3838
variable.timestamp = timestamp
3939
variable.tags = tags
40-
variable.estimateDict = estimateDict
40+
variable.ppeDict = ppeDict
4141
variable.solverDataDict = solverData
4242
variable.smallData = smallData
4343
variable.solvable = packedProps["solvable"]
@@ -156,7 +156,7 @@ end
156156
Convert a DFGVariable to a DFGVariableSummary.
157157
"""
158158
function convert(::Type{DFGVariableSummary}, v::DFGVariable)
159-
return DFGVariableSummary(v.label, v.timestamp, deepcopy(v.tags), deepcopy(v.estimateDict), Symbol(typeof(getSofttype(v))), v._internalId)
159+
return DFGVariableSummary(v.label, v.timestamp, deepcopy(v.tags), deepcopy(v.ppeDict), Symbol(typeof(getSofttype(v))), v._internalId)
160160
end
161161

162162
"""

test/LightDFGSummaryTypes.jl

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

100100
if VARTYPE == DFGVariableSummary
101101
@test getTimestamp(v1) == v1.timestamp
102-
@test getVariablePPEs(v1) == v1.estimateDict
102+
@test getVariablePPEs(v1) == v1.ppeDict
103103
@test getVariablePPE(v1, :notfound) == nothing
104104
@test getSofttype(v1) == :Pose2
105105
@test internalId(v1) == v1._internalId

test/attic/HexagonalCloud.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ tree, smtasks = solveTree!(localFg)
5050
# Checking estimates
5151
for variable in getVariables(localFg)
5252
@show variable.label
53-
@show variable.estimateDict
53+
@show variable.ppeDict
5454

5555
# means = mean(getData(variable).val, dims=2)[:]
56-
# variable.estimateDict[:default] = Dict{Symbol, VariableEstimate}(:Mean => VariableEstimate(:default, :Mean, means, now()))
56+
# variable.ppeDict[:default] = Dict{Symbol, VariableEstimate}(:Mean => VariableEstimate(:default, :Mean, means, now()))
5757
end
5858

5959
bel = getKDE(getVariable(localFg, :x0))

0 commit comments

Comments
 (0)