pypfilt.event

This module defines a data structure for each particle filter event.

class pypfilt.event.LogLikelihood(obs: Dict[str, Any], log_llhds: numpy.ndarray, weights: numpy.ndarray)

The log-likelihood of an observation according to each particle.

obs: Dict[str, Any]

The observation dictionary.

log_llhds: numpy.ndarray

The log-likelihoods according to each particle (1-D array).

weights: numpy.ndarray

The particle weights prior to this time-step (1-D array).

class pypfilt.event.AfterReweight(ctx: Context, snapshot: Snapshot)

The particle states after weights have been updated in response to one or more observations for the current time-step.

ctx: Context

The simulation context.

snapshot: Snapshot

The current particle states.

class pypfilt.event.BeforeResample(ctx: Context, time: Any, partition: int, vec: numpy.ndarray)

The particle states before resampling, but after updating weights in response to any observations for the current time-step.

ctx: Context

The simulation context.

time: Any

The current time.

partition: int

The (zero-based) number of the partition being resampled.

vec: numpy.ndarray

The history matrix slice for the current time.

class pypfilt.event.BeforeRegularisation(ctx: Context, partition: int, vec: numpy.ndarray)

The particle states before post-regularisation.

ctx: Context

The simulation context.

partition: int

The (zero-based) number of the partition being resampled.

vec: numpy.ndarray

The history matrix slice for the current time-step.

class pypfilt.event.AfterRegularisation(ctx: Context, partition: int, vec: numpy.ndarray)

The particle states after post-regularisation. .

ctx: Context

The simulation context.

partition: int

The (zero-based) number of the partition being resampled.

vec: numpy.ndarray

The history matrix slice for the current time-step.

class pypfilt.event.AfterResample(ctx: Context, time: Any, partition: int, vec: numpy.ndarray)

The particle states after resampling (including post-regularisation, if enabled).

ctx: Context

The simulation context.

time: Any

The current time.

partition: int

The (zero-based) number of the partition being resampled.

vec: numpy.ndarray

The history matrix slice for the current time-step.

class pypfilt.event.AfterTimeStep(ctx: Context, snapshot: Snapshot, obs_list: List[Dict[str, Any]], resample_mask: numpy.ndarray)

The particle states after the completion of a time-step.

ctx: Context

The simulation context.

snapshot: Snapshot

The current particle states.

obs_list: List[Dict[str, Any]]

The observations (if any) for this time-step.

resample_mask: numpy.ndarray

The particles that have been resampled (1-D boolean array).