diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 559e1b9..84ae294 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: python-version: ["3.8"] - corsika-version: ["77500"] + corsika-version: ["77550"] os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4766d9a..b1a394d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: matrix: python-version: ["3.11"] poetry-version: ["1.3"] - corsika-version: ["77500"] + corsika-version: ["77550"] os: [ubuntu-latest] runs-on: ${{ matrix.os }} permissions: diff --git a/panama/read.py b/panama/read.py index 3ab62eb..16fb5d1 100644 --- a/panama/read.py +++ b/panama/read.py @@ -386,6 +386,8 @@ def add_mother_columns( else False for pdgid in pdgids } + # explicitly force an invalid PDGID to not be charm + has_charm[PDGID_ERROR_VAL] = False # this follows the MCEq definition lifetimes = { @@ -395,6 +397,8 @@ def add_mother_columns( for pdgid in lifetimes: if lifetimes[pdgid] is None: lifetimes[pdgid] = 0 + # explicitly force invalid PDGID to have infinite lifetime + lifetimes[PDGID_ERROR_VAL] = inf is_resonance = { pdgid: "*" in Particle.from_pdgid(pdgid).name @@ -402,6 +406,8 @@ def add_mother_columns( else False for pdgid in pdgids } + # explicitly force an invalid PDGID to not be a resonance + is_resonance[PDGID_ERROR_VAL] = False df_particles["mother_lifetimes"] = df_particles["mother_pdgid"].map( lifetimes, na_action=None diff --git a/pdm.lock b/pdm.lock index feb87e0..0e10def 100644 --- a/pdm.lock +++ b/pdm.lock @@ -4,8 +4,11 @@ [metadata] groups = ["default", "dev", "hdf"] strategy = ["cross_platform"] -lock_version = "4.4.1" -content_hash = "sha256:841616f19ebdf6cfc93ad4b8292b98d3747ecd22d145988992325f2b0321245a" +lock_version = "4.5.0" +content_hash = "sha256:e2bcaec8f930c4c515ce93e885c5b0128ee92cb8db45f7272db99c43c742ac96" + +[[metadata.targets]] +requires_python = ">=3.8,<3.12" [[package]] name = "accessible-pygments" @@ -61,6 +64,7 @@ requires_python = ">=3.7" summary = "Argon2 for Python" dependencies = [ "argon2-cffi-bindings", + "typing-extensions; python_version < \"3.8\"", ] files = [ {file = "argon2_cffi-23.1.0-py3-none-any.whl", hash = "sha256:c670642b78ba29641818ab2e68bd4e6a78ba53b7eff7b4c3815ae16abf91c7ea"}, @@ -119,6 +123,7 @@ version = "2.4.1" summary = "Annotate AST trees with source code positions" dependencies = [ "six>=1.12.0", + "typing; python_version < \"3.5\"", ] files = [ {file = "asttokens-2.4.1-py2.py3-none-any.whl", hash = "sha256:051ed49c3dcae8913ea7cd08e46a606dba30b79993209636c4875bc1d637bc24"}, @@ -143,6 +148,9 @@ name = "attrs" version = "23.1.0" requires_python = ">=3.7" summary = "Classes Without Boilerplate" +dependencies = [ + "importlib-metadata; python_version < \"3.8\"", +] files = [ {file = "attrs-23.1.0-py3-none-any.whl", hash = "sha256:1f28b4522cdc2fb4256ac1a020c78acf9cba2c6b461ccd2c126f3aa8e8335d04"}, {file = "attrs-23.1.0.tar.gz", hash = "sha256:6279836d581513a26f1bf235f9acd333bc9115683f14f7e8fae46c98fc50e015"}, @@ -155,6 +163,7 @@ requires_python = ">=3.7" summary = "Internationalization utilities" dependencies = [ "pytz>=2015.7; python_version < \"3.9\"", + "setuptools; python_version >= \"3.12\"", ] files = [ {file = "Babel-2.13.1-py3-none-any.whl", hash = "sha256:7077a4984b02b6727ac10f1f7294484f737443d7e2e66c5e4380e41a3ae0b4ed"}, @@ -194,6 +203,7 @@ dependencies = [ "pathspec>=0.9.0", "platformdirs>=2", "tomli>=1.1.0; python_full_version < \"3.11.0a7\"", + "typed-ast>=1.4.2; python_version < \"3.8\" and implementation_name == \"cpython\"", "typing-extensions>=3.10.0.0; python_version < \"3.10\"", ] files = [ @@ -405,6 +415,7 @@ requires_python = ">=3.7" summary = "Composable command line interface toolkit" dependencies = [ "colorama; platform_system == \"Windows\"", + "importlib-metadata; python_version < \"3.8\"", ] files = [ {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, @@ -451,6 +462,7 @@ requires_python = ">=3.8" summary = "Python library for calculating contours of 2D quadrilateral grids" dependencies = [ "numpy<2.0,>=1.16; python_version <= \"3.11\"", + "numpy<2.0,>=1.26.0rc1; python_version >= \"3.12\"", ] files = [ {file = "contourpy-1.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:46e24f5412c948d81736509377e255f6040e94216bf1a9b5ea1eaa9d29f6ec1b"}, @@ -790,6 +802,9 @@ name = "fqdn" version = "1.5.1" requires_python = ">=2.7, !=3.0, !=3.1, !=3.2, !=3.3, !=3.4, <4" summary = "Validates fully-qualified domain names against RFC 1123, so that they are acceptable to modern bowsers" +dependencies = [ + "cached-property>=1.3.0; python_version < \"3.8\"", +] files = [ {file = "fqdn-1.5.1-py3-none-any.whl", hash = "sha256:3a179af3761e4df6eb2e026ff9e1a3033d3587bf980a0b1b2e1e5d08d7358014"}, {file = "fqdn-1.5.1.tar.gz", hash = "sha256:105ed3677e767fb5ca086a0c1f4bb66ebc3c100be518f0e0d755d9eae164d89f"}, @@ -841,6 +856,7 @@ version = "6.8.0" requires_python = ">=3.8" summary = "Read metadata from Python packages" dependencies = [ + "typing-extensions>=3.6.4; python_version < \"3.8\"", "zipp>=0.5", ] files = [ @@ -1205,6 +1221,9 @@ name = "kiwisolver" version = "1.4.5" requires_python = ">=3.7" summary = "A fast implementation of the Cassowary constraint solver" +dependencies = [ + "typing-extensions; python_version < \"3.8\"", +] files = [ {file = "kiwisolver-1.4.5-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:05703cf211d585109fcd72207a31bb170a0f22144d68298dc5e61b3c946518af"}, {file = "kiwisolver-1.4.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:146d14bebb7f1dc4d5fbf74f8a6cb15ac42baadee8912eb84ac0b3b2a3dc6ac3"}, @@ -1777,6 +1796,9 @@ name = "overrides" version = "7.4.0" requires_python = ">=3.6" summary = "A decorator to automatically detect mismatch when overriding a method." +dependencies = [ + "typing; python_version < \"3.5\"", +] files = [ {file = "overrides-7.4.0-py3-none-any.whl", hash = "sha256:3ad24583f86d6d7a49049695efe9933e67ba62f0c7625d53c59fa832ce4b8b7d"}, {file = "overrides-7.4.0.tar.gz", hash = "sha256:9502a3cca51f4fac40b5feca985b6703a5c1f6ad815588a7ca9e285b9dca6757"}, @@ -1895,6 +1917,9 @@ files = [ name = "pickleshare" version = "0.7.5" summary = "Tiny 'shelve'-like database with concurrency support" +dependencies = [ + "pathlib2; python_version in \"2.6 2.7 3.2 3.3\"", +] files = [ {file = "pickleshare-0.7.5-py2.py3-none-any.whl", hash = "sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56"}, {file = "pickleshare-0.7.5.tar.gz", hash = "sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca"}, @@ -1968,6 +1993,9 @@ name = "platformdirs" version = "3.11.0" requires_python = ">=3.7" summary = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +dependencies = [ + "typing-extensions>=4.7.1; python_version < \"3.8\"", +] files = [ {file = "platformdirs-3.11.0-py3-none-any.whl", hash = "sha256:e9d171d00af68be50e9202731309c4e658fd8bc76f55c11c7dd760d023bda68e"}, {file = "platformdirs-3.11.0.tar.gz", hash = "sha256:cf8ee52a3afdb965072dcc652433e0c7e3e40cf5ea1477cd4b3b1d2eb75495b3"}, @@ -2123,6 +2151,7 @@ summary = "pytest: simple powerful testing with Python" dependencies = [ "colorama; sys_platform == \"win32\"", "exceptiongroup>=1.0.0rc8; python_version < \"3.11\"", + "importlib-metadata>=0.12; python_version < \"3.8\"", "iniconfig", "packaging", "pluggy<2.0,>=0.12", @@ -2980,6 +3009,7 @@ summary = "Virtual Python Environment builder" dependencies = [ "distlib<1,>=0.3.7", "filelock<4,>=3.12.2", + "importlib-metadata>=6.6; python_version < \"3.8\"", "platformdirs<4,>=3.9.1", ] files = [ @@ -2991,6 +3021,9 @@ files = [ name = "wcwidth" version = "0.2.9" summary = "Measures the displayed width of unicode strings in a terminal" +dependencies = [ + "backports-functools-lru-cache>=1.2.1; python_version < \"3.2\"", +] files = [ {file = "wcwidth-0.2.9-py2.py3-none-any.whl", hash = "sha256:9a929bd8380f6cd9571a968a9c8f4353ca58d7cd812a4822bba831f8d685b223"}, {file = "wcwidth-0.2.9.tar.gz", hash = "sha256:a675d1a4a2d24ef67096a04b85b02deeecd8e226f57b5e3a72dbb9ed99d27da8"}, diff --git a/tests/files/compare/DAT000000 b/tests/files/compare/DAT000000 index 7a968c9..60e74b4 100644 Binary files a/tests/files/compare/DAT000000 and b/tests/files/compare/DAT000000 differ diff --git a/tests/files/noEHIST/DAT101001 b/tests/files/noEHIST/DAT101001 new file mode 100644 index 0000000..9dff7a0 Binary files /dev/null and b/tests/files/noEHIST/DAT101001 differ diff --git a/tests/test_cli.py b/tests/test_cli.py index 8e0af46..f0bf483 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -5,8 +5,8 @@ from panama import read_DAT import pytest -CORSIKA_VERSION = "corsika-77500" -CORSIKA_EXECUTABLE = "corsika77500Linux_SIBYLL_urqmd" +CORSIKA_VERSION = "corsika-77550" +CORSIKA_EXECUTABLE = "corsika77550Linux_SIBYLL_urqmd" def test_cli_missing_executable( test_file_path=Path(__file__).parent / "files" / "example_corsika.template", diff --git a/tests/test_read.py b/tests/test_read.py index aa9bb1e..7a75f6f 100644 --- a/tests/test_read.py +++ b/tests/test_read.py @@ -15,6 +15,7 @@ SINGLE_TEST_FILE = Path(__file__).parent / "files" / "DAT000000" GLOB_TEST_FILE = Path(__file__).parent / "files" / "DAT*" +NOEHIST_TEST_FILE = Path(__file__).parent / "files" / "noEHIST" / "DAT101001" def test_noparse(test_file_path=SINGLE_TEST_FILE): @@ -61,6 +62,13 @@ def check_eq(file, df_run, df_event, particles, skip_mother=False): num += 1 +def test_noehist(test_file_path=NOEHIST_TEST_FILE): + # This used to fail (see issue #103) + df_run, df_event, df = panama.read_DAT(glob=test_file_path, mother_columns=True) + + check_eq(test_file_path, df_run, df_event, df, skip_mother=False) + + def test_noadd(test_file_path=SINGLE_TEST_FILE): with pytest.raises(ValueError, match="requires"): df_run, df_event, particles = panama.read_DAT( diff --git a/tests/test_run.py b/tests/test_run.py index 2ac234d..2680a8d 100644 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -9,8 +9,8 @@ import pytest import numpy as np -CORSIKA_VERSION = "corsika-77500" -CORSIKA_EXECUTABLE = "corsika77500Linux_SIBYLL_urqmd" +CORSIKA_VERSION = "corsika-77550" +CORSIKA_EXECUTABLE = "corsika77550Linux_SIBYLL_urqmd" def test_corsika_runner_cleanup(