|
| 1 | + |
| 2 | +# moved here from DistributedFactorGraphs.jl, replace with new way. |
| 3 | +function typeModuleName(variableType::StateType) |
| 4 | + Base.depwarn("typeModuleName is obsolete", :typeModuleName) |
| 5 | + io = IOBuffer() |
| 6 | + ioc = IOContext(io, :module => DistributedFactorGraphs) |
| 7 | + show(ioc, typeof(variableType)) |
| 8 | + return String(take!(io)) |
| 9 | +end |
| 10 | + |
| 11 | +""" |
| 12 | + $(SIGNATURES) |
| 13 | +Get a type from the serialization module. |
| 14 | +""" |
| 15 | +function getTypeFromSerializationModule(_typeString::AbstractString) |
| 16 | + @debug "DFG converting type string to Julia type" _typeString |
| 17 | + try |
| 18 | + # split the type at last `.` |
| 19 | + split_st = split(_typeString, r"\.(?!.*\.)") |
| 20 | + #if module is specified look for the module in main, otherwise use Main |
| 21 | + if length(split_st) == 2 |
| 22 | + m = getfield(Main, Symbol(split_st[1])) |
| 23 | + else |
| 24 | + m = Main |
| 25 | + end |
| 26 | + noparams = split(split_st[end], r"{") |
| 27 | + ret = if 1 < length(noparams) |
| 28 | + # fix #671, but does not work with specific module yet |
| 29 | + bidx = findfirst(r"{", split_st[end])[1] |
| 30 | + @error("getTypeFromSerializationModule eval obsolete") |
| 31 | + Core.eval(m, Base.Meta.parse("$(noparams[1])$(split_st[end][bidx:end])")) |
| 32 | + else |
| 33 | + getfield(m, Symbol(split_st[end])) |
| 34 | + end |
| 35 | + |
| 36 | + return ret |
| 37 | + |
| 38 | + catch ex |
| 39 | + @error "Unable to deserialize type $(_typeString)" |
| 40 | + io = IOBuffer() |
| 41 | + showerror(io, ex, catch_backtrace()) |
| 42 | + err = String(take!(io)) |
| 43 | + @error(err) |
| 44 | + end |
| 45 | + return nothing |
| 46 | +end |
| 47 | + |
| 48 | + |
1 | 49 | ## ================================================================================================ |
2 | 50 | ## Deprecated in v0.36 |
3 | 51 | ## ================================================================================================ |
@@ -161,7 +209,7 @@ setVariablePosteriorEstimates!(args...; kw...) = error("PPEs are obsolete (use ` |
161 | 209 |
|
162 | 210 | @deprecate calcPPE( |
163 | 211 | var::VariableCompute, |
164 | | - varType::StateType = getVariableType(var); |
| 212 | + varType::StateType = getStateKind(var); |
165 | 213 | solveKey::Symbol = :default, |
166 | 214 | kwargs..., |
167 | 215 | ) calcMeanMaxSuggested(var, solveKey) |
|
246 | 294 | # function ManifoldsVector(fg::AbstractDFG, varIds::Vector{Symbol}) |
247 | 295 | # manis = Bool[] |
248 | 296 | # for k = varIds |
249 | | -# push!(manis, getVariableType(fg, k) |> getManifold) |
| 297 | +# push!(manis, getStateKind(fg, k) |> getManifold) |
250 | 298 | # end |
251 | 299 | # ManifoldsVector(manis) |
252 | 300 | # end |
@@ -309,7 +357,7 @@ function solveGraphParametric2( |
309 | 357 |
|
310 | 358 | for vId in varIds |
311 | 359 | p = getState(fg, vId, solvekey).val[1] |
312 | | - flatvar[vId] = getCoordinates(getVariableType(fg, vId), p) |
| 360 | + flatvar[vId] = getCoordinates(getStateKind(fg, vId), p) |
313 | 361 | end |
314 | 362 |
|
315 | 363 | initValues = flatvar.X |
|
379 | 427 | # ) where {N_, F <: AbstractRelativeRoots, S, T} |
380 | 428 | # # |
381 | 429 | # # error("<:AbstractRelativeRoots is obsolete, use one of the other <:AbstractRelative types instead.") |
382 | | -# # TODO get xDim = getDimension(getVariableType(Xi[sfidx])) but without having Xi |
| 430 | +# # TODO get xDim = getDimension(getStateKind(Xi[sfidx])) but without having Xi |
383 | 431 | # if testshuffle || ccwl.partial |
384 | 432 | # error( |
385 | 433 | # "<:AbstractRelativeRoots factors with less or more measurement dimensions than variable dimensions have been discontinued, rather use <:AbstractManifoldMinimize.", |
@@ -442,8 +490,8 @@ function Base.getproperty(ccw::CommonConvWrapper, f::Symbol) |
442 | 490 | error("CommonConvWrapper.params is deprecated, use .varValsAll instead") |
443 | 491 | return ccw.varValsAll[] |
444 | 492 | elseif f == :vartypes |
445 | | - @warn "CommonConvWrapper.vartypes is deprecated, use typeof.(getVariableType.(ccw.fullvariables) instead" maxlog=3 |
446 | | - return typeof.(getVariableType.(ccw.fullvariables)) |
| 493 | + @warn "CommonConvWrapper.vartypes is deprecated, use typeof.(getStateKind.(ccw.fullvariables) instead" maxlog=3 |
| 494 | + return typeof.(getStateKind.(ccw.fullvariables)) |
447 | 495 | elseif f == :hypotheses |
448 | 496 | @warn "CommonConvWrapper.hypotheses is now under ccw.hyporecipe.hypotheses" maxlog=5 |
449 | 497 | return ccw.hyporecipe.hypotheses |
|
0 commit comments