Plotting multiple histograms

Hi

I’m trying to plot multiple histograms at once, using “g4see.py plot ~/g4see/myPro/” but I got the following error.

katto@katto-pc:~/g4see/g4see-scripts/scripts$ python3 g4see.py plot ~/g4see/myPro/
Traceback (most recent call last):

  • File “g4see.py”, line 144, in *
  • plotter(args.data, args.hist, output=args.output, norm_factor=args.normFactor, norm_bin=args.normBin)*
  • File “/home/katto/g4see/g4see-scripts/scripts/plot_histograms.py”, line 62, in plotter*
  • if round(data[‘Edep’][2]-data[‘Edep’][1], 8) != round(data[‘Edep’][3]-data[‘Edep’][2], 8): # type: ignore*
    TypeError: ‘NoneType’ object is not subscriptable

Furthermore, I also want to use [-nf NORMFACTOR] [-nb NORMBIN] functionally. How can I use it?

*katto@katto-pc:~/g4see/g4see-scripts/scripts$ python3 g4see.py plot NORMBIN Ekin_2_histogram.out *
usage: g4see.py [-h] {submit,monitor,delete,view,merge,plot} …
g4see.py: error: unrecognized arguments: Ekin_2_histogram.out
*katto@katto-pc:~/g4see/g4see-scripts/scripts$ python3 g4see.py plot [NORMBIN] Ekin_2_histogram.out *
usage: g4see.py [-h] {submit,monitor,delete,view,merge,plot} …
g4see.py: error: unrecognized arguments: Ekin_2_histogram.out

Thanks and regards
Aamir

Hello Aamir,

to plot multiple histograms at once, the file names must end with histogram.out (you can create these files using g4see.py merge and mergeHistograms). For example, if you want to plot multiple histograms for the kinetic energy of particles, with all file names starting with Ekin and ending with histogram.out, you can do this with command:

python3 /path/to/g4see/scripts/g4see.py plot -ht Ekin* /path/to/directory/with/histograms/files/

If you want to normalize the plot by, for example, the number of primary particles (pp), just add -nf pp to the command I mentioned above.

Regards,
Eva

Please note: if running using Zsh (Z shell), the shell will interpret the ‘*’ in the command as a wildcard and incorrectly produce the error:

zsh: no matches found: Ekin*

This can be avoided however if one puts a backlash before the ‘*’ in the following way:

python3 /path/to/g4see/scripts/g4see.py plot -ht Ekin\* /path/to/directory/with/histograms/files/