Home | News | Documentation | Download

TKDE example in pyroot

Dear experts,

Could you point me to a snippet of TKDE use in pyroot?
i.e. something like this ROOT: tutorials/math/exampleTKDE.C File Reference
It’s not clear to me how the syntax would work in python for the constructor.

Thanks!

Hi,

You can simply passes numpy array in the constructor. This works in Python for every C++ function taking an array (e.g. a double *). Here is an example:

import ROOT
import numpy as np
x = np.random.normal(0,1,1000)
kde = ROOT.TKDE(1000, x, -3, 3,"",1.)
kde.Draw()

Lorenzo

thanks!