cminject.sources package

Implementations of cminject.base.Source.

class cminject.sources.VariableDistributionSource(number_of_particles: int, position: List[cminject.utils.distributions.Distribution], velocity: List[cminject.utils.distributions.Distribution], radius: cminject.utils.distributions.Distribution, density: cminject.utils.distributions.Distribution, seed=None, particle_class: Type[cminject.particles.spherical.SphericalParticle] = <class 'cminject.particles.spherical.SphericalParticle'>, particle_kwargs: Optional[Dict[Any, Any]] = None)

Bases: cminject.base.Source, cminject.utils.global_config.ConfigSubscriber

A Source for particles that allows variable distributions for each dimension of the initial phase space. A distribution is a subclass of cminject.utils.distributions.Distribution.

config_change(key: cminject.utils.global_config.ConfigKey, value: Any)

Will be called whenever the value of any subscribed key changes. Will be called once at the time of subscribing, IF the value for the subscribed key(s) is not None.

Parameters
  • key – The ConfigKey that the change occurred for.

  • value – The new value of the configuration value stored for the key key.

Returns

Nothing (unused).

generate_particles(start_time: float = 0.0) List[cminject.particles.spherical.SphericalParticle]

Generates a list of particles. How this is done is entirely up to the subclass, by (this is mandatory!) implementing this method in some way.

Returns

A list of Particle instances.

Submodules

cminject.sources.variable_distributions module

class cminject.sources.variable_distributions.VariableDistributionSource(number_of_particles: int, position: List[cminject.utils.distributions.Distribution], velocity: List[cminject.utils.distributions.Distribution], radius: cminject.utils.distributions.Distribution, density: cminject.utils.distributions.Distribution, seed=None, particle_class: Type[cminject.particles.spherical.SphericalParticle] = <class 'cminject.particles.spherical.SphericalParticle'>, particle_kwargs: Optional[Dict[Any, Any]] = None)

Bases: cminject.base.Source, cminject.utils.global_config.ConfigSubscriber

A Source for particles that allows variable distributions for each dimension of the initial phase space. A distribution is a subclass of cminject.utils.distributions.Distribution.

config_change(key: cminject.utils.global_config.ConfigKey, value: Any)

Will be called whenever the value of any subscribed key changes. Will be called once at the time of subscribing, IF the value for the subscribed key(s) is not None.

Parameters
  • key – The ConfigKey that the change occurred for.

  • value – The new value of the configuration value stored for the key key.

Returns

Nothing (unused).

generate_particles(start_time: float = 0.0) List[cminject.particles.spherical.SphericalParticle]

Generates a list of particles. How this is done is entirely up to the subclass, by (this is mandatory!) implementing this method in some way.

Returns

A list of Particle instances.