Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ Listing news on any major breaking changes in DFG. For regular changes, see int

# v0.29
- `AbstractPointParametricEst` (`MeanMaxPPE`) and related `PPE` functions are obsolete, see #1133.
- Rename filter keyword arguments to `where`-prefixed form:
- `solvableFilter` -> `whereSolvable`
- `labelFilter` -> `whereLabel`
- `tagsFilter` -> `whereTags`
- `typeFilter` -> `whereType`
- `blobidFilter` -> `whereBlobid`
- `variableLabelFilter` -> `whereVariableLabel`

# v0.28
- Reading or deserialzing of factor graphs created prior to v0.25 are no longer suppoted with the complete removal of User/Robot/Session
Expand Down
56 changes: 28 additions & 28 deletions src/DataBlobs/services/BlobEntry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ end

function getBlobentries(
node;
labelFilter::Union{Nothing, Function} = nothing,
blobidFilter::Union{Nothing, Function} = nothing,
whereLabel::Union{Nothing, Function} = nothing,
whereBlobid::Union{Nothing, Function} = nothing,
)
entries = collect(values(refBlobentries(node)))
filterDFG!(entries, labelFilter, getLabel)
filterDFG!(entries, blobidFilter, x -> string(x.blobid))
filterDFG!(entries, whereLabel, getLabel)
filterDFG!(entries, whereBlobid, x -> string(x.blobid))
return entries
end

Expand Down Expand Up @@ -207,10 +207,10 @@ end
function getVariableBlobentries(
dfg::AbstractDFG,
variableLabel::Symbol;
labelFilter::Union{Nothing, Function} = nothing,
blobidFilter::Union{Nothing, Function} = nothing,
whereLabel::Union{Nothing, Function} = nothing,
whereBlobid::Union{Nothing, Function} = nothing,
)
return getBlobentries(getVariable(dfg, variableLabel); labelFilter, blobidFilter)
return getBlobentries(getVariable(dfg, variableLabel); whereLabel, whereBlobid)
end

function listVariableBlobentries(dfg::AbstractDFG, variableLabel::Symbol)
Expand All @@ -228,10 +228,10 @@ end
function getFactorBlobentries(
dfg::AbstractDFG,
factorLabel::Symbol;
labelFilter::Union{Nothing, Function} = nothing,
blobidFilter::Union{Nothing, Function} = nothing,
whereLabel::Union{Nothing, Function} = nothing,
whereBlobid::Union{Nothing, Function} = nothing,
)
return getBlobentries(getFactor(dfg, factorLabel); labelFilter, blobidFilter)
return getBlobentries(getFactor(dfg, factorLabel); whereLabel, whereBlobid)
end

function listFactorBlobentries(dfg::AbstractDFG, factorLabel::Symbol)
Expand Down Expand Up @@ -328,22 +328,22 @@ end

function gatherBlobentries(
dfg::AbstractDFG;
labelFilter::Union{Nothing, Function} = nothing,
blobidFilter::Union{Nothing, Function} = nothing,
solvableFilter::Union{Nothing, Function} = nothing,
tagsFilter::Union{Nothing, Function} = nothing,
typeFilter::Union{Nothing, Function} = nothing,
variableLabelFilter::Union{Nothing, Function} = nothing,
whereLabel::Union{Nothing, Function} = nothing,
whereBlobid::Union{Nothing, Function} = nothing,
whereSolvable::Union{Nothing, Function} = nothing,
whereTags::Union{Nothing, Function} = nothing,
whereType::Union{Nothing, Function} = nothing,
whereVariableLabel::Union{Nothing, Function} = nothing,
)
vls = listVariables(
dfg;
solvableFilter,
tagsFilter,
typeFilter,
labelFilter = variableLabelFilter,
whereSolvable,
whereTags,
whereType,
whereLabel = whereVariableLabel,
)
return map(vls) do vl
return vl => getVariableBlobentries(dfg, vl; labelFilter, blobidFilter)
return vl => getVariableBlobentries(dfg, vl; whereLabel, whereBlobid)
end
end
const collectBlobentries = gatherBlobentries
Expand All @@ -356,12 +356,12 @@ Also see: [`getBlobentry`](@ref)
"""
function getfirstBlobentry(
node;
labelFilter::Union{Nothing, Function} = nothing,
blobidFilter::Union{Nothing, Function} = nothing,
whereLabel::Union{Nothing, Function} = nothing,
whereBlobid::Union{Nothing, Function} = nothing,
sortby::Function = getLabel,
sortlt::Function = natural_lt,
)
entries = getBlobentries(node; labelFilter, blobidFilter)
entries = getBlobentries(node; whereLabel, whereBlobid)
if isempty(entries)
return nothing
else
Expand All @@ -372,10 +372,10 @@ end
function getfirstVariableBlobentry(
dfg::AbstractDFG,
label::Symbol;
labelFilter::Union{Nothing, Function} = nothing,
blobidFilter::Union{Nothing, Function} = nothing,
whereLabel::Union{Nothing, Function} = nothing,
whereBlobid::Union{Nothing, Function} = nothing,
)
return getfirstBlobentry(getVariable(dfg, label); labelFilter, blobidFilter)
return getfirstBlobentry(getVariable(dfg, label); whereLabel, whereBlobid)
end

## =============================================================================
Expand Down Expand Up @@ -430,7 +430,7 @@ function incrDataLabelSuffix(
hasund = false
len = 0
try
de = getfirstVariableBlobentry(dfg, vla; labelFilter = contains(string(bllb)))
de = getfirstVariableBlobentry(dfg, vla; whereLabel = contains(string(bllb)))
isnothing(de) && return Symbol(bllb) # no match, return as is
bllb = string(bllb)
# bllb *= bllb[end] != '_' ? "_" : ""
Expand Down
48 changes: 24 additions & 24 deletions src/Deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ function hasTagsNeighbors(
)
#
Base.depwarn(
"hasTagsNeighbors is deprecated, use listNeighbors with tagsFilter instead",
"hasTagsNeighbors is deprecated, use listNeighbors with whereTags instead",
:hasTagsNeighbors,
)
# assume only variables or factors are neighbors
Expand Down Expand Up @@ -337,11 +337,11 @@ end
# Deprecated in favor of getBiadjacencyMatrix as it is not efficient for large graphs.
function getAdjacencyMatrixSymbols(
dfg::AbstractDFG;
solvableFilter::Union{Nothing, Function} = nothing,
whereSolvable::Union{Nothing, Function} = nothing,
)
#
varLabels = sort(map(v -> v.label, getVariables(dfg; solvableFilter)))
factLabels = sort(map(f -> f.label, getFactors(dfg; solvableFilter)))
varLabels = sort(map(v -> v.label, getVariables(dfg; whereSolvable)))
factLabels = sort(map(f -> f.label, getFactors(dfg; whereSolvable)))
vDict = Dict(varLabels .=> [1:length(varLabels)...] .+ 1)

adjMat = Matrix{Union{Nothing, Symbol}}(
Expand Down Expand Up @@ -592,8 +592,8 @@ function mergeGraph!(
variableLabels::Vector{Symbol},
factorLabels::Vector{Symbol} = lsf(sourceDFG),
distance::Int = 0;
solvableFilter = nothing,
tagsFilter = nothing,
whereSolvable = nothing,
whereTags = nothing,
kwargs...,
)
Base.depwarn(
Expand All @@ -609,8 +609,8 @@ function mergeGraph!(
sourceDFG,
union(variableLabels, factorLabels),
distance;
solvableFilter,
tagsFilter,
whereSolvable,
whereTags,
)

copyGraph!(
Expand Down Expand Up @@ -665,37 +665,37 @@ function findShortestPathDijkstra(
dfg::GraphsDFG,
from::Symbol,
to::Symbol;
labelFilterVariables::Union{Function, Nothing} = nothing,
labelFilterFactors::Union{Function, Nothing} = nothing,
tagsFilterVariables::Union{Function, Nothing} = nothing,
tagsFilterFactors::Union{Function, Nothing} = nothing,
typeFilterVariables::Union{Function, Nothing} = nothing,
typeFilterFactors::Union{Function, Nothing} = nothing,
solvableFilter::Union{Function, Nothing} = nothing,
whereVariableLabel::Union{Function, Nothing} = nothing,
whereFactorLabel::Union{Function, Nothing} = nothing,
whereVariableTags::Union{Function, Nothing} = nothing,
whereFactorTags::Union{Function, Nothing} = nothing,
whereVariableType::Union{Function, Nothing} = nothing,
whereFactorType::Union{Function, Nothing} = nothing,
whereSolvable::Union{Function, Nothing} = nothing,
initialized::Union{Nothing, Bool} = nothing,
)
Base.depwarn(
"findShortestPathDijkstra is deprecated, use findPath with `variableLabels`/`factorLabels` kwargs instead.",
:findShortestPathDijkstra,
)
any_active_filters = any(
.!isnothing.([labelFilterVariables, labelFilterFactors, tagsFilterVariables, tagsFilterFactors, typeFilterVariables, typeFilterFactors, initialized, solvableFilter]),
.!isnothing.([whereVariableLabel, whereFactorLabel, whereVariableTags, whereFactorTags, whereVariableType, whereFactorType, initialized, whereSolvable]),
)

if any_active_filters
varList = listVariables(
dfg;
labelFilter = labelFilterVariables,
tagsFilter = tagsFilterVariables,
typeFilter = typeFilterVariables,
solvableFilter,
whereLabel = whereVariableLabel,
whereTags = whereVariableTags,
whereType = whereVariableType,
whereSolvable,
)
fctList = listFactors(
dfg;
labelFilter = labelFilterFactors,
tagsFilter = tagsFilterFactors,
typeFilter = typeFilterFactors,
solvableFilter,
whereLabel = whereFactorLabel,
whereTags = whereFactorTags,
whereType = whereFactorType,
whereSolvable,
)

varList = if initialized !== nothing
Expand Down
Loading
Loading