Using ROOT from the repo, I get a segfault when calling ‘TKDE::Draw()’. The following snippet is enough to generate the crash:
import ROOT as R
import numpy as np
arr = np.array([10., 20., 30.])
kde = R.TKDE(len(arr), arr)
# No crash up to here
Drawing into a canvas or opening a file does not change anything. The same code in a macro does not cause any problem.
Am I maybe doing something wrong in the way I pass the array?
By the way, it’s not really the right forum for this, but I’ve noticed it is not possible to write a TKDE object to a ROOT file because the sub-class TKernel does not have a dictionary generated by default…
This class TKDE has members which are basically pointers to methods or functions, so it is not trivial to make objects of this class persistent.
So, for the time being what we can do is to document property that you cannot write objects of this class to files. If you describe your use case perhaps we could investigate a way to do it or workaround.
I don’t have a real use-case for the moment, I was kinda playing around to gauge the possibilities (comparing e.g. to scikit-learn KDEs)…
Since instantiating the class from an array is almost free, it looks like it should be possible to use it without persistence. Saving only the TF1 returned by TKDE::GetFunction() might be sufficient for many purposes.
Of course others may have more documented point of views… I’ll update this thread once/if I have a clearer view of real-life uses!
And yes, documenting the missing feature would be good There’s no documentation for this class at the moment…