def test_gen_random_events(nevents, nparticles, dim, mass): if mass == 'array': mass = np.random.rand(nevents, nparticles) events = ef.gen_random_events(nevents, nparticles, dim=dim, mass=mass) assert events.shape == (nevents, nparticles, dim) if mass != 'random': assert epsilon_diff(ef.ms_from_ps(events)**2, mass**2, 10**-13)
def test_gen_random_events(nevents, nparticles, dim, mass): if mass == 'array': mass = np.random.rand(nevents, nparticles) events = ef.gen_random_events(nevents, nparticles, dim=dim, mass=mass) assert events.shape == (nevents, nparticles, dim) if not (isinstance(mass, six.string_types) and mass == 'random'): assert epsilon_diff(ef.ms_from_ps(events)**2, mass**2, 10**-13)
def test_ms_from_ps(dim, nevents, nparticles): masses = np.random.rand(nevents, nparticles) events = ef.gen_random_events(nevents, nparticles, mass=masses, dim=dim) masses = masses.reshape(events.shape[:-1]) results = ef.ms_from_ps(events) assert epsilon_diff(results, masses, 1e-10) if dim == 4: assert epsilon_diff(results, ef.ms_from_p4s(events), 1e-10)
def test_gen_random_events_mcom(nevents, nparticles, dim): events = ef.gen_random_events_mcom(nevents, nparticles, dim=dim) assert events.shape == (nevents, nparticles, dim) assert epsilon_diff(ef.ms_from_ps(events)**2 / dim, 0, 10**-12) assert epsilon_diff(np.sum(events, axis=1)[:, 1:], 0, 10**-12)
def test_gen_massless_phase_space(nevents, nparticles): events = ef.gen_massless_phase_space(nevents, nparticles) assert events.shape == (nevents, nparticles, 4) assert epsilon_diff(ef.ms_from_ps(events)**2, 0, 10**-13)