Skip to content

Commit 101ad78

Browse files
committed
Refactor unpackOldState to improve state type handling and clarity
1 parent 5b16804 commit 101ad78

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/serialization/StateSerialization.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ end
110110
function unpackOldState(d)
111111
@debug "Dispatching conversion packed variable -> variable for type $(string(d.variableType))"
112112
# Figuring out the variableType
113-
T = parseStateKind(d.variableType)
114-
113+
statekind = parseStateKind(d.variableType)
114+
T = typeof(statekind)
115+
115116
r3 = d.dimval
116117
c3 = r3 > 0 ? floor(Int, length(d.vecval) / r3) : 0
117118
M3 = reshape(d.vecval, r3, c3)
@@ -131,16 +132,16 @@ function unpackOldState(d)
131132
!isempty(d.covar) && error("covar field is not supported")
132133
if label == :parametric
133134
belief =
134-
BeliefRepresentation(GaussianDensityKind(), T; means = vals, covariances = [BW])
135+
BeliefRepresentation(GaussianDensityKind(), statekind; means = vals, covariances = [BW])
135136
else
136137
belief = BeliefRepresentation(
137138
NonparametricDensityKind(),
138-
T;
139+
statekind;
139140
points = vals,
140141
bandwidth = BW,
141142
)
142143
end
143-
return State{typeof(T), getPointType(T)}(;
144+
return State{T, getPointType(T)}(;
144145
label,
145146
belief,
146147
separator = Symbol.(d.separator),

0 commit comments

Comments
 (0)