phasespace#
import tensorwaves.data.phasespace
Implementations of a DataGenerator for four-momentum samples.
- class PhaseSpaceGenerator(initial_state_mass: float, final_state_masses: Mapping[int, float], bunch_size: int = 50000, *, backend: Literal['numpy', 'tensorflow', 'jax'] = 'numpy')[source]#
Bases:
DataGeneratorImplements a phase space generator on top of phasespace.
- Parameters:
initial_state_mass – Mass of the decaying state.
final_state_masses – A mapping of final state IDs to the corresponding masses.
bunch_size – Size of a bunch that is generated during a hit-and-miss iteration.
backend – Computational backend that phasespace uses to generate the sample. See
WeightedPhaseSpaceGenerator.
- generate(size: int, rng: RealNumberGenerator) DataSample[source]#
Generate a
DataSampleof phase space four-momenta.- Returns:
A
DataSampleof four-momenta arrays of shape \(n \times 4\).
See also
- class WeightedPhaseSpaceGenerator(initial_state_mass: float, final_state_masses: Mapping[int, float], *, backend: Literal['numpy', 'tensorflow', 'jax'] = 'numpy')[source]#
Bases:
DataGeneratorImplements a phase space generator with weights on top of phasespace.
The weights are provided in the returned
DataSampleunder the key"weights".- Parameters:
initial_state_mass – Mass of the decaying state.
final_state_masses – A mapping of final state IDs to the corresponding masses.
backend – Computational backend that phasespace uses to generate the sample. The
"tensorflow"and"jax"backends require thetfandjaxextras. The generated arrays are alwaysnumpyarrays. AnyRealNumberGeneratorcan be used. If its stream cannot be used directly by the backend, a seed is drawn from it, so the sample stays reproducible, but differs from the sample of another backend.
See also
- generate(size: int, rng: RealNumberGenerator) DataSample[source]#
Generate a
DataSampleof phase space four-momenta with weights.- Returns:
A
tupleof aDataSample(four-momenta) with an event-wise sequence of weights. The four-momenta are arrays of shape \(n \times 4\).
- class EvtGenPhaseSpaceGenerator(initial_state_mass: float, final_state_masses: Mapping[int, float])[source]#
Bases:
DataGeneratorImplements a phase space generator using EvtGen through
pyevtgen.Events are unweighted, so no hit-and-miss step is needed and the sample contains no
"weights". This generator works with anyRealNumberGenerator. Therngonly provides a seed for the random engine of EvtGen, so samples are reproducible but differ from those of other generators.Generation becomes impractically slow beyond about nine final state particles, see
pyevtgen.phase_space().- Parameters:
initial_state_mass – Mass of the decaying state.
final_state_masses – A mapping of final state IDs to the corresponding masses.
See also
- generate(size: int, rng: RealNumberGenerator) DataSample[source]#
Generate a
DataSampleof phase space four-momenta.- Returns:
A
DataSampleof four-momenta arrays of shape \(n \times 4\).
- TFPhaseSpaceGenerator[source]#
Alias of
PhaseSpaceGeneratorfor backward compatibility.
- TFWeightedPhaseSpaceGenerator[source]#
Alias of
WeightedPhaseSpaceGeneratorfor backward compatibility.