@@ -219,7 +219,7 @@ vnd = getVariableSolverData(fg, :x1)
219219end
220220
221221
222- @testset " test propagateBelief w HeatmapSampler and init for PartialPriorPassThrough" begin
222+ @testset " test propagateBelief w HeatmapSampler and init for PartialPriorPassThrough w Priors " begin
223223# #
224224
225225fg = initfg ()
@@ -229,7 +229,7 @@ v0 = addVariable!(fg, :x0, SpecialEuclidean2)
229229img_ = rand (10 ,10 ).+ 5.0
230230x_,y_ = ([- 9 : 2.0 : 9 ;],[- 9 : 2.0 : 9 ;])
231231
232- hmd = HeatmapDensityRegular (img_, (x_,y_), 5.5 , 0.1 , N= 1000 )
232+ hmd = HeatmapDensityRegular (img_, (x_,y_), 5.5 , 0.1 , N= 120 )
233233pthru = PartialPriorPassThrough (hmd, (1 ,2 ))
234234
235235# test without nullhyp
@@ -240,7 +240,7 @@ f0 = addFactor!(fg, [:x0], pthru, graphinit=false)
240240bel, infd = propagateBelief (fg, v0, [f0])
241241
242242@test isPartial (bel)
243- @test length (getPoints (bel)) == 1000
243+ @test length (getPoints (bel)) == 120
244244
245245
246246# # repeat test with nullhypo
@@ -260,14 +260,14 @@ bel, infd = propagateBelief(fg, v0, [f0])
260260
261261doautoinit! (fg, :x0 )
262262
263- @test length (getPoints (getBelief (fg, :x0 ))) == 1000
264- @info " PassThrough transfers the full point count to the graph, unless a product is calculated during the propagateBelief step."
263+ @test length (getPoints (getBelief (fg, :x0 ))) == getSolverParams (fg) . N # 120
264+ # @info "PassThrough transfers the full point count to the graph, unless a product is calculated during the propagateBelief step."
265265
266266# #
267267
268268solveGraph! (fg);
269269
270- @test 1000 == length (getPoints (fg, :x0 ))
270+ @test 120 == length (getPoints (fg, :x0 ))
271271
272272@warn " must still check if bandwidths are recalculated on many points (not necessary), or lifted from this case single prior"
273273
@@ -286,7 +286,7 @@ prp, infd = propagateBelief(fg, v0, [f0;f1])
286286
287287# # check that solve corrects the point count on graph variable
288288
289- @test 1000 == length (getPoints (fg, :x0 ))
289+ @test 120 == length (getPoints (fg, :x0 ))
290290
291291solveGraph! (fg);
292292
299299
300300
301301
302+
303+ @testset " test point count on propagate, solve, init for PartialPriorPassThrough w Relative" begin
304+ # #
305+
306+ fg = initfg ()
307+
308+ v0 = addVariable! (fg, :x0 , SpecialEuclidean2)
309+
310+ img_ = rand (10 ,10 ).+ 5.0
311+ x_,y_ = ([- 9 : 2.0 : 9 ;],[- 9 : 2.0 : 9 ;])
312+
313+ hmd = HeatmapDensityRegular (img_, (x_,y_), 5.5 , 0.1 , N= 120 )
314+ pthru = PartialPriorPassThrough (hmd, (1 ,2 ))
315+
316+ # test without nullhyp
317+ f0 = addFactor! (fg, [:x0 ], pthru, graphinit= false )
318+
319+ # # test the inference functions
320+ addVariable! (fg, :x1 , SpecialEuclidean2)
321+ mp = ManifoldPrior (SpecialEuclidean (2 ), ProductRepr (@MVector ([0.0 ,0.0 ]), @MMatrix ([1.0 0.0 ; 0.0 1.0 ])), MvNormal ([0.01 , 0.01 , 0.01 ]))
322+ f1 = addFactor! (fg, [:x1 ], mp, graphinit= false )
323+
324+ doautoinit! (fg, :x1 )
325+
326+ # # connect with relative and check calculation size on x0
327+
328+ mf = ManifoldFactor (SpecialEuclidean (2 ), MvNormal ([1 ,2 ,pi / 4 ], [0.01 ,0.01 ,0.01 ]))
329+ f2 = addFactor! (fg, [:x0 , :x1 ], mf, graphinit= false )
330+
331+ # #
332+
333+ bel, infd = propagateBelief (fg, v0, [f0;f2])
334+
335+ @test ! isPartial (bel)
336+ @test getSolverParams (fg). N == length (getPoints (bel))
337+
338+ # # check other functions
339+
340+ solveTree! (fg);
341+
342+ @test getSolverParams (fg). N == length (getPoints (fg, :x0 ))
343+ @test getSolverParams (fg). N == length (getPoints (fg, :x1 ))
344+
345+
346+ # # and check that initAll! works the same (different init sequences may change code execution path)
347+
348+ fg = initfg ()
349+ v0 = addVariable! (fg, :x0 , SpecialEuclidean2)
350+ img_ = rand (10 ,10 ).+ 5.0
351+ x_,y_ = ([- 9 : 2.0 : 9 ;],[- 9 : 2.0 : 9 ;])
352+ hmd = HeatmapDensityRegular (img_, (x_,y_), 5.5 , 0.1 , N= 120 )
353+ pthru = PartialPriorPassThrough (hmd, (1 ,2 ))
354+ f0 = addFactor! (fg, [:x0 ], pthru, graphinit= false )
355+ addVariable! (fg, :x1 , SpecialEuclidean2)
356+ mp = ManifoldPrior (SpecialEuclidean (2 ), ProductRepr (@MVector ([0.0 ,0.0 ]), @MMatrix ([1.0 0.0 ; 0.0 1.0 ])), MvNormal ([0.01 , 0.01 , 0.01 ]))
357+ f1 = addFactor! (fg, [:x1 ], mp, graphinit= false )
358+ mf = ManifoldFactor (SpecialEuclidean (2 ), MvNormal ([1 ,2 ,pi / 4 ], [0.01 ,0.01 ,0.01 ]))
359+ f2 = addFactor! (fg, [:x0 , :x1 ], mf, graphinit= false )
360+
361+ # #
362+
363+ bel, infd = propagateBelief (fg, v0, [f0;f2])
364+
365+ @test ! isPartial (bel)
366+ @test getSolverParams (fg). N == length (getPoints (bel))
367+
368+ # #
369+
370+ initAll! (fg)
371+
372+ @test getSolverParams (fg). N == length (getPoints (fg, :x0 ))
373+ @test getSolverParams (fg). N == length (getPoints (fg, :x1 ))
374+
375+ # #
376+ end
377+
378+
302379#
0 commit comments