Skip to content

Commit

Permalink
fixing bug: array and keys did not match in particle_filter
Browse files Browse the repository at this point in the history
  • Loading branch information
mstraut committed Aug 17, 2023
1 parent b9e3ff5 commit 6ace408
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/progpy/state_estimators/particle_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ def __init__(self, model, x0, **kwargs):
# Added to avoid float/int issues
self.parameters['num_particles'] = int(self.parameters['num_particles'])
sample_gen = x0.sample(self.parameters['num_particles'])
samples = [array(sample_gen.key(k), dtype=float64) for k in x0.keys()]

self.particles = model.StateContainer(array(samples, dtype=float64))
samples = {k: array(sample_gen.key(k), dtype=float64) for k in x0.keys()}
self.particles = model.StateContainer(samples)

if 'R' in self.parameters:
# For backwards compatibility
Expand Down

0 comments on commit 6ace408

Please sign in to comment.