nu-radio / NuRadioMC

A Monte Carlo simulation package for radio neutrino detectors
GNU General Public License v3.0
33 stars 35 forks source link

Remove first if condition, the argparser will throw an error anyway. … #717

Open fschlueter opened 1 month ago

fschlueter commented 1 month ago

…Improve doc-string

This mostly improves the doc-string.

I have to say the code if if len(args.files) == 1: is hard to read. I imagine it was used for some specific library (Gen2?). Is it necessary to keep it where it is? Maybe we can store it in the analysis repo of the Gen2 analysis and simplify this code?

My intention: When I first looked at this script (and the previous doc-string) I thought the script is not suited for my purpose and would need quite some changes to be. I only later learned (when looking at a script by Steffen) that I indeed can use it simply by passing several inputs.

fschlueter commented 1 month ago

Thanks for improving the doc string. Why did you remove f(len(args.files) < 1): etc? Doesn't this script now crashes if you don't specify any file? Or is this validated by the argparser?

Exactly the argparser will complain. files is a positional argument. So the argparser will exit the program with an appropriate error message

cg-laser commented 1 month ago

Please keep the ==1 option. For most productions, NuRadioMC generates files in subfolders. So this command automatically merged parallel simulations runs into a single hdf5 file. The event generator has the option to automatically generate many input files based on the maximum number of events per file. If you use this feature in the event generation, you can use the ==1 feature of the hdf5_merge tool.

fschlueter commented 1 month ago

@cg-laser okay, I kept it. I tried to simplify the code a bit. The only functional change is that I switched from glob("...hdf5.part????") and glob("...hdf5.part??????") to only glob("...hdf5.part*"). Is there a specific reason to allow only 4 and 6 symbols?

fschlueter commented 1 month ago

ping