DataMedSci / pymchelper

Python toolkit for SHIELD-HIT12A and FLUKA
http://datamedsci.github.io/pymchelper/
15 stars 7 forks source link

new files for MCPL #658

Closed grzanka closed 1 year ago

grzanka commented 1 year ago

I've fixed the PDG codes in the 51-phsp-export branch of SHIELD-HIT12A source code. This change needs to be reflected in the testing files for pymchelper. Previously allmost all the particles were neutrons, while we expected protons.

This PR includes as well solid refactoring of tests suite (moving from unittest to pytest framework).

Concatenation for the MCPL data object was also implemented, which should enable dealing with concatenating large files using convertmc --many *.bdo

grzanka commented 1 year ago

/reviewpad run

grzanka commented 1 year ago

/reviewpad summarize

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This pull request introduces changes in the test files and MCPL converter. The main modifications include:

  1. Updating .pre-commit-config.yaml to configure pre-commit hooks.
  2. Adding pre-commit and yapf to tests/requirements-test.txt.
  3. Updating binary file tests/res/shieldhit/phasespace/NB_mcpl.bdo and its corresponding text file tests/res/shieldhit/phasespace/NB_mcpl.txt.
  4. Changing the particle type from neutrons (2112) to protons (2212) in tests/test_mcpl.py.

Overall, the update focuses on configuring pre-commit hooks and ensuring the test files are using protons instead of neutrons as the particle.

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This pull request introduces several changes to the codebase:

  1. A new .pre-commit-config.yaml file has been added, which will allow for automatic formatting and linting of the code using pre-commit hooks from popular libraries such as trailing-whitespace, end-of-file-fixer, check-yaml, check-added-large-files, and yapf.

  2. Some type hints have been added to the pymchelper/estimator.py file to improve readability and provide better type checking.

  3. The requirements-test.txt file has been updated to include pre-commit and yapf packages to facilitate their use in the project's testing environment.

  4. Some minor updates were made to the contents of the tests/res/shieldhit/phasespace/NB_mcpl.txt, affecting PDG codes.

  5. Several adjustments have been made to the tests/test_mcpl.py file to accommodate these changes.

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This pull request includes various updates to the codebase involving type hints, tests, binary files, requirements, pre-commit hooks, and particle data files. Key updates revolve around improving testing of phasespace BDO files, checking their properties, reading their content, generating MCPL files from them, and updating SHIELD-HIT12A particle data. Additional changes involve adding new dependencies and pre-commit hooks, modifying binary files, and improving file organization.

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This pull request includes updates to multiple files, adding new dependencies, binary files, test data, and configuration settings. Key changes include the update of tests/requirements-test.txt to fix a missing newline and add two new dependencies, as well as a number of additions and modifications to files in the tests/res/shieldhit/phasespace directory such as new binary BDO files, new test data TXT files, and changes to existing test data. A new .pre-commit-config.yaml file has been added with a pre-commit configuration and several hooks. The tests/test_mcpl.py file received several updates, focusing on BDO file handling for testing with new fixtures, test function updates, and additional logging. An import statement for Optional from the typing module and type hints in a function signature have also been added. Finally, pytest.ini has been modified to include updated test paths and log settings.

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This pull request introduces various changes across multiple files, including adding new binary and text files for test results in the tests/res/shieldhit/phasespace directory. It also updates the SHIELD-HIT12A version and modifies the PDG particle code in the existing test files.

In pytest.ini, the testpaths are updated, comments are added, and the logging level is set to INFO. Two new dependencies, pre-commit==3.3.3 and yapf==0.40.1, are added to tests/requirements-test.txt, along with a newline at the end.

Tests for MCPL converter have been updated, and additional tests have been added for BDO file generation and concatenation. Logging facilities have been improved in the test suite.

In the input_output.py file, error handling and logging have been enhanced, comments have been updated, and new checks have been added for concatenate normalization. Additionally, type hinting and Optional import have been introduced in multiple files.

Finally, a new .pre-commit-config.yaml file has been added with various pre-commit hooks to maintain code quality.

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This pull request introduces various updates and additions across multiple files. Key changes include adding import statements for Optional and updating functions with type hints in estimator.py and input_output.py. Several modifications were made to the tests/test_mcpl.py, including adding new pytest fixtures, updating variable names, passing file paths as strings, and adding new test functions. The pytest.ini file has been updated to improve test discovery and logging settings.

Additionally, this PR adds new binary files in the tests/res/shieldhit/phasespace directory along with corresponding *.txt files presenting the text data from the binary files. The tests/requirements-test.txt file has been updated with new dependencies for pre-commit and yapf. A new .pre-commit-config.yaml file has been created to set up pre-commit hooks for the project.

Finally, several updates have been made to the input_output.py file, improving error handling, injecting type annotations, and modifying the function definition of convertfrompattern().

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This pull request includes various changes to improve code quality, maintain a consistent code style, enhance error handling, and extend functionality. Key modifications include updating particle data in test files, adding pre-commit hooks, refactoring test cases using pytest fixtures and assertions, improving typing and error handling, updating dependencies, and adding new test files containing simulated data. Additionally, new pytest fixtures and utility functions have been added for downloading and installing the demo version of SHIELD-HIT12A.

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This pull request includes several updates to the test framework, such as the addition of new test files, fixtures, utility functions, and test cases, as well as modifications to existing test files. The main focus is on the testing of different aspects of MCPL file conversion and validation, binary file handling, SHIELD-HIT12A demo version setup, and input file generation. New test functions have been introduced to validate specific cards within the generated input files, verify exit codes and file formats, and test the ability to concatenate multiple BDO files. A new .pre-commit-config.yaml file has been added for pre-commit hooks and updates were made to the test requirements file. The pytest.ini configuration file was also modified. Additionally, the SHIELD-HIT12A version has been updated from v1.0.1-23-gd578015e to v1.0.1-25-g25c9bf46, and the file pymchelper/estimator.py includes updates to function type hints.

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This pull request includes several updates to files, including adding new binary files in 'tests/res/shieldhit/phasespace' directory, modifying '.gitignore', removing the binary file 'tests/res/shieldhit/executable/shieldhit', updating test configuration and requirement files, and introducing new test files. Furthermore, changes have been made to improve logging, error handling, and concatenation feature support in various files. Test functions have been refactored from a unittest class structure into individual pytest functions for better readability and modularity. The pull request also adds several pre-commit hooks to the project, addressing code formatting and file management issues. Finally, new tests for BDO files and MCPL conversion have been added, improving overall test coverage.

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This pull request includes changes to several test files, refactoring and improving test implementations, and additional files and fixtures related to SHIELD-HIT12A, such as new BDO files and MCPL simulation results. It adds type hinting and error handling in the input_output.py script, as well as configuration updates to the pytest.ini file and the addition of pre-commit hooks for code formatting and quality checks. The pull request also contains changes to the .gitignore file, removal of obsolete binary files, and improvements in logging and the running variance algorithm. Additionally, new test functions and fixtures are introduced for checking file types and file conversion. Overall, these changes enhance the project's functionality, test coverage, and code quality.

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This pull request introduces various changes to the project's files, including:

  1. Updates to dependencies in tests/requirements-test.txt and changes to the .gitignore file.
  2. Modifications to several source code files, such as pymchelper/input_output.py, pymchelper/estimator.py, and test files like tests/test_mcpl.py and tests/test_call_entry.py. These changes involve adding type hinting, updated function definitions, and improved test suites.
  3. Addition, deletion, and updating of binary files related to SHIELD-HIT12A simulations and test resources.
  4. Creation of new files, such as .pre-commit-config.yaml for setting up pre-commit hooks, conftest.py for downloading and extracting Shieldhit demo binaries, test files like test_example.py and test_runner.py, and result files like NB_mcpl_0001.txt and NB_mcpl_0002.txt.
  5. Changes to configuration files like pytest.ini.

Overall, the pull request contains numerous improvements to the codebase, such as enhanced readability, maintainability, and test coverage.