openmc.lib.sample_external_source
- openmc.lib.sample_external_source(n_samples: int = 1000, prn_seed: int | None = None, as_array: bool = False) ParticleList | ndarray[source]
Sample external source and return source particles.
Added in version 0.13.1.
- Parameters:
n_samples (int) – Number of samples
prn_seed (int) – Pseudorandom number generator (PRNG) seed; if None, one will be generated randomly.
as_array (bool) – If True, return a numpy structured array instead of a
ParticleList. The array has fields'r'(float64, shape 3),'u'(float64, shape 3),'E'(float64),'time'(float64),'wgt'(float64),'delayed_group'(int32),'surf_id'(int32), and'particle'(int32). This avoids the overhead of constructing individualSourceParticleobjects and is substantially faster for large sample counts.
- Returns:
List of sampled source particles, or a structured array when as_array is True.
- Return type: