ParticleDistribution

class ParticleDistribution(**kwargs)[source]

Bases: object

Particle distribution object.

Helper class for managing arbitrary distributions of particles.

__init__(**kwargs)[source]

Methods

__init__

add_particle

Adds a particle and weight to the distribution.

clear_particles

Clears the particle and weight lists.

update_weights

Updates the weights to match the given list.

Attributes

covariance

Covariance of the particles.

mean

Mean of the particles.

num_particles

Number of particles.

particles

Particles in the distribution.

uncertainties

Read only uncertainty of each particle.

weights

Weights of the partilces.

add_particle(p, w)[source]

Adds a particle and weight to the distribution.

Parameters:
  • p (distributions.Particle or list) – Particle to add or list of particles.

  • w (float or list) – Weight of the particle or list of weights.

Return type:

None.

clear_particles()[source]

Clears the particle and weight lists.

update_weights(w_lst)[source]

Updates the weights to match the given list.

Checks that the length of the weights matches the number of particles.

property covariance

Covariance of the particles.

property mean

Mean of the particles.

property num_particles

Number of particles.

property particles

Particles in the distribution.

Must be set by the distributions.ParticleDistribution.add_particle() method.

Returns:

Each element is a distributions.Particle object.

Return type:

list

property uncertainties

Read only uncertainty of each particle.

Returns:

Each element is a N x N numpy array

Return type:

list

property weights

Weights of the partilces.

Must be set by the distributions.ParticleDistribution.add_particle() or distributions.ParticleDistribution.update_weights() methods.

Returns:

Each element is a float representing the weight of the particle.

Return type:

list