This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from numpythia import Pythia, hepmc_write, hepmc_read | ||
from numpythia import STATUS, HAS_END_VERTEX, ABS_PDG_ID | ||
from numpythia.testcmnd import get_cmnd | ||
from numpy.testing import assert_array_equal | ||
|
||
def test_first_example(): | ||
pythia = Pythia(get_cmnd('w'), random_state=1) | ||
|
||
selection = ((STATUS == 1) & ~HAS_END_VERTEX & | ||
(ABS_PDG_ID != 12) & (ABS_PDG_ID != 14) & (ABS_PDG_ID != 16)) | ||
|
||
# generate events while writing to ascii hepmc | ||
for event in hepmc_write('events.hepmc', pythia(events=1)): | ||
array1 = event.all(selection) | ||
|
||
# read the same event back from ascii hepmc | ||
for event in hepmc_read('events.hepmc'): | ||
array2 = event.all(selection) | ||
|
||
assert_array_equal(array1, array2) |