Source code for stonesoup.types.particle

# -*- coding: utf-8 -*-

from ..base import Property
from .array import StateVector
from .base import Type

[docs]class Particle(Type): """ Particle type A particle type which contains a state and weight """ state_vector: StateVector = Property(doc="State vector") weight: float = Property(doc='Weight of particle') parent: 'Particle' = Property(default=None, doc='Parent particle') def __init__(self, state_vector, weight, parent=None, *args, **kwargs): if parent: parent.parent = None if state_vector is not None and not isinstance(state_vector, StateVector): state_vector = StateVector(state_vector) super().__init__(state_vector, weight, parent, *args, **kwargs) @property def ndim(self): return self.state_vector.shape[0]