DataMedSci / pymchelper

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

1254 fluka output #691

Closed hendzeld closed 8 months ago

hendzeld commented 8 months ago

Update handling of Fluka's USRBIN scoring card.

Update description of axis with Particles/scorings and units

hendzeld commented 8 months ago

Current results runmc --jobs 1 --out-type plot -w . proton.inp Where proton.inp is https://github.com/DataMedSci/pymchelper/blob/7919273be1c881d2ffca8d36b3e3147f32bf02ae/tests/res/fluka/proton.inp

obraz

I will create tests to check these results :

  1. generate Fluka output files
  2. use FlukaReader to generate estimators
  3. test expected values in estimators
grzanka commented 8 months ago

Current results runmc --jobs 1 --out-type plot -w . proton.inp Where proton.inp is https://github.com/DataMedSci/pymchelper/blob/7919273be1c881d2ffca8d36b3e3147f32bf02ae/tests/res/fluka/proton.inp

obraz

I will create tests to check these results :

  1. generate Fluka output files
  2. use FlukaReader to generate estimators
  3. test expected values in estimators

As for now it looks good !

grzanka commented 8 months ago

I see another issue: the results from SHIELD-HIT12A may be inconsistent with Fluka due to different units used. Maybe in subsequent PR we can introduce some postprocessing to adjust units to common measure. I suspect that may be a better task for backend code

reviewpad[bot] commented 8 months ago

AI-Generated Summary: This pull request includes modifications to the fluka.py and test_fluka_minimal.py files. Some refactoring was done to improve code clarity and readability. The most important changes include the addition of the get_particle_from_db, UsrbinScoring, and verify_axis functions, as well as the modification of the parse_usrbin, parse_usrbdx and parse_usrtrack functions in fluka.py. Methods for getting specific scoring and units were added, and exception handling was improved.

reviewpad[bot] commented 8 months ago

AI-Generated Summary: This pull request introduces several changes to the pymchelper/readers/fluka.py file of the PyMC helper library, a Python support library for Monte Carlo particle radiation transport simulations. Changes include:

  1. The import of Optional from typing and Particle from pymchelper.flair.Input.

  2. Addition of docstrings and comments for improved readability and understanding of the code.

  3. Numerous changes to the FlukaReaderFactory, parse_usrbin, parse_usrbdx, parse_usrtrack, and read_data methods in the form of renaming of variables, updates to the methods logic, formatting improvements and more informative comments.

  4. A significant addition is the creation of two new classes, UsrbinScoring and get_particle_from_db. The former contains constant lists representing various scoring types used in the USRBIN estimator and a method to get the unit for a given scoring name. The latter queries Flair's database for a particle by its id.

In tests/mock/test_fluka_minimal.py, several changes were also made:

  1. The expected results in the expected_results method have been updated to include more detailed information.

  2. An additional import of MeshAxis from pymchelper.axis has been added.

  3. A new verification method, verify_axis, is created to compare the Axis of the generated FLUKA file with expected values.

The pull request provides comprehensive and diligent changes that improve the clarity, readability, and functionality of the involved code while enhancing the testing and verification process.