Coverage for src/gncpy/filters/mcmc_particle_filter_base.py: 90%

10 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-07-19 05:48 +0000

1import abc 

2 

3from gncpy.filters.particle_filter import ParticleFilter 

4 

5 

6class MCMCParticleFilterBase(ParticleFilter): 

7 """Generic base class for Particle filters with an optional Markov Chain Monte Carlo move step. 

8 

9 Attributes 

10 ---------- 

11 use_MCMC : bool, optional 

12 Flag indicating if the move step is run. The default is False. 

13 """ 

14 

15 require_copy_can_dist = True 

16 

17 def __init__(self, use_MCMC=False, **kwargs): 

18 self.use_MCMC = use_MCMC 

19 

20 super().__init__(**kwargs) 

21 

22 @abc.abstractmethod 

23 def move_particles(self, timestep, meas, old_weights, **kwargs): 

24 """Generic interface for the movement function. 

25 

26 This must be overridden in the child class. It is recommended to keep 

27 the same function signature to allow for standardized wrappers. 

28 """ 

29 raise RuntimeError("Must implement thid function in derived class")