DataMedSci / pymchelper

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

626 idea generate mc summary table #634

Open nbassler opened 1 year ago

nbassler commented 1 year ago

Proposal for MC summary, see discussion in #626

Comments?

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This pull request consists of two patches:

  1. [PATCH 1/2] introduces a feature for adding total times for all estimators, with modifications in pymchelper/estimator.py, pymchelper/input_output.py, pymchelper/readers/shieldhit/binary_spec.py, and pymchelper/readers/shieldhit/reader_bdo2019.py. The changes involve initializing additional variables to track run time, updating the values while averaging with nan, and incorporating the total number of primaries and run times in the fromfilelist method.

  2. [PATCH 2/2] adds a Monte Carlo (MC) summary table based on Sechopoulos et al. (2018), with output in markdown format. The changes affect pymchelper/input_output.py, pymchelper/run.py, pymchelper/writers/common.py, and a newly created file, pymchelper/writers/mcsum.py. In addition to adding the MCSumWriter class, the patch connects the new converter (mcsum) to the writer in common.py and introduces a new parser for mcsum in run.py.

reviewpad[bot] commented 1 year ago

Reviewpad Report

:bangbang: Errors

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This pull request introduces new features to record total run times and primary events for all estimators, as well as a new output format as an MC-summary table. It updates the estimator.py, input_output.py, binary_spec.py, and reader_bdo2019.py files to store various run times and primary event counts. Additionally, it includes a new "mcsum" output format that displays the MC summary table in markdown format, following the example of Sechopoulos et al (2018).

grzanka commented 1 year ago

@nbassler can you add some tests similar to https://github.com/DataMedSci/pymchelper/blob/master/tests/test_hdf.py ?

reviewpad[bot] commented 1 year ago

AI-Generated Summary: This pull request consists of 3 patches that make the following changes:

  1. Add total times support for all estimators: This patch introduces new attributes for estimator class, such as run_time, run_time_sim, total_number_of_primaries, total_run_time, and total_run_time_sim, and updates other related methods to include these changes. It also modifies the reader_bdo2019.py file to set total_number_of_primaries, total_run_time, and total_run_time_sim for the estimator.

  2. Suggestion for MC-summary table, output in markdown format: This patch adds a new MCSumWriter class in mcsum.py file, which generates an MC summary table in markdown format including code version, number of histories, timing, and other fields. It also updates the run.py and common.py files to include mcsum as one of the available converters.

  3. Autofix issues in 2 files: This patch automatically refactors small issues in estimator.py and mcsum.py files using DeepSource Autofix, such as removing unnecessary "elif" statements and making "write" method in MCSumWriter a static method.