On using pickle with ROOT histograms

8 views
Skip to first unread message

Angel Campoverde

unread,
Oct 13, 2022, 1:16:43 AM10/13/22
to HEP Software Foundation Technical Forum
Dear HSF people, 

I have found myself using pickle to serialize objects. Once in a while we use data that needs to be stored in histograms and becomes a class attribute. When pickling the object and trying to unpickle it with a version of python different from which was used to pickle, errors happen (e.g. 3.8 vs 3.10).

This means that we will either forever be stuck with a given version of python or we need to redo all the objects we pickled. 

Has anyone encountered this problem? I have talked to people and they have suggested that I use ROOT files to store my histograms, but my histograms are just an attribute of the object I am serializing, maybe 5% of that object. I would have to make the whole class a C++ ROOT object to be able to save it in a ROOT file, which seems much more involved. 

Another alternative would be a tool that stores the histogram's data and can, on demand return histograms. That data container, let's say a "hist_data" class, would be the attribute, not the histogram. I would be glad to know if anyone else has found this issue and how they have got around it.

Cheers.

Graeme A Stewart

unread,
Oct 13, 2022, 7:50:51 AM10/13/22
to Angel Campoverde, HEP Software Foundation Technical Forum

Hi Angel

 

Traffic on this list is a bit weak these days. I would suggest that you ask the question in the PyHEP group, as it’s very much under their purview.

 

If you have a look here:

 

https://hepsoftwarefoundation.org/workinggroups/pyhep.html

 

You will find a link to their Gitter channel, where such things can be discussed with some of the gurus. (There is even a dedicated channel for histogram topics.)

 

Cheers

 

Graeme

--
You received this message because you are subscribed to the Google Groups "HEP Software Foundation Technical Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hsf-tech-foru...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hsf-tech-forum/24ced6ba-3d7c-4d31-b516-fb14a3c7f323n%40googlegroups.com.

Angel Campoverde

unread,
Oct 13, 2022, 8:52:02 AM10/13/22
to HEP Software Foundation Technical Forum
Dear Graeme,

Thanks for the advice, now it is in the PyHEP-histogramming group.

Cheers.

--
You received this message because you are subscribed to a topic in the Google Groups "HEP Software Foundation Technical Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hsf-tech-forum/a77X-2MUQ8w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hsf-tech-foru...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages