-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patches for GAMP parsing and Particle display
The memory module of GAMP would use a dictionary to store the particle data as an intermediate step, using the particle IDs as the key in the dictionary. This worked great, until there were multiple particles with the same ID. This patches that out by using the index of the particle instead. This assumes that each event will have particles appear in the same order consistently throughout the file, which _should_ be a safe bet. There was also an issue with some rushed out code involving the how Particles are visually represented in iPython and Jupyter. The underlying data structures were safe, but when the user would try to view the values, errors would occur. This should also patch those issues. However, there are no improvements in Testing with these sort of functions since at this time I have not found a reliable way to test that the display function is operating correctly.
- Loading branch information
1 parent
5237879
commit a6287c7
Showing
8 changed files
with
110 additions
and
20 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
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
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
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
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
|
||
__author__ = "PyPWA Team and Contributors" | ||
__license__ = "GPLv3" | ||
__version__ = "3.2.0" | ||
__version__ = "3.2.1" | ||
__email__ = "[email protected]" | ||
__status__ = "development" | ||
|
||
|
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
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,41 @@ | ||
import pytest | ||
|
||
from PyPWA.plugins.data import gamp | ||
from PyPWA.libs.vectors import particle | ||
|
||
from pathlib import Path | ||
|
||
ROOT = (Path(__file__).parent / "../../test_data/docs").resolve() | ||
LARGE = ROOT / "large.gamp" | ||
MULTI = ROOT / "multiple.gamp" | ||
|
||
|
||
@pytest.fixture() | ||
def gamp_mem(): | ||
return gamp._GampMemory() | ||
|
||
|
||
@pytest.fixture() | ||
def large_gamp(gamp_mem): | ||
return gamp_mem.parse(LARGE) | ||
|
||
|
||
@pytest.fixture() | ||
def multi_gamp(gamp_mem): | ||
return gamp_mem.parse(MULTI) | ||
|
||
|
||
def test_large_has_all_events(large_gamp): | ||
assert 1000 == large_gamp.event_count | ||
|
||
|
||
def test_multi_has_all_events(multi_gamp): | ||
assert 5 == multi_gamp.event_count | ||
|
||
|
||
def test_large_has_four_particles(large_gamp): | ||
assert 4 == len(large_gamp) | ||
|
||
|
||
def test_multi_has_six_particles(multi_gamp): | ||
assert 6 == len(multi_gamp) |
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,35 @@ | ||
6 | ||
1 0 0 0 9 9 | ||
14 1 0.489366 1.16687 1.53077 2.19651 | ||
11 1 -0.120747 -0.252622 1.82881 1.91485 | ||
12 -1 -0.0471136 -0.468373 2.86627 2.94632 | ||
1 0 0.144554 -0.0924801 0.396306 0.431864 | ||
1 0 -0.46606 -0.353392 2.37784 2.44872 | ||
6 | ||
1 0 0 0 9 9 | ||
14 1 0.0482325 0.574326 0.588864 1.24871 | ||
11 1 0.147839 0.175565 3.20347 3.2494 | ||
12 -1 0.113935 0.0947125 1.91567 1.9838 | ||
1 0 0.116443 -0.468739 1.61144 1.68227 | ||
1 0 -0.426449 -0.375865 1.68055 1.77409 | ||
6 | ||
1 0 0 0 9 9 | ||
14 1 -0.603583 0.264803 7.6721 7.75731 | ||
11 1 0.277164 -0.0236316 0.372865 0.678319 | ||
12 -1 0.0582607 -0.150773 0.285835 0.592907 | ||
1 0 0.0214529 0.210537 0.337733 0.39856 | ||
1 0 0.246705 -0.300936 0.331466 0.511171 | ||
6 | ||
1 0 0 0 9 9 | ||
14 1 -0.6922 -0.280769 4.1272 4.29791 | ||
11 1 0.59143 0.0433621 2.47691 2.59431 | ||
12 -1 0.56086 0.262788 2.14699 2.28843 | ||
1 0 -0.220055 0.120091 0.374064 0.450299 | ||
1 0 -0.240035 -0.145471 -0.125159 0.307316 | ||
6 | ||
1 0 0 0 9 9 | ||
14 1 -1.08832 -0.149006 2.61188 2.98478 | ||
11 1 0.620169 -0.015586 2.69034 2.80472 | ||
12 -1 0.534044 -0.126931 3.35861 3.43879 | ||
1 0 -0.00930206 -0.143393 0.206859 0.251871 | ||
1 0 -0.0565951 0.434916 0.132317 0.458108 |