Hi,
I’d like to use C++ objects/classes developped for ROOT from within python.
I need to construct in python the object “data” of type
std::vector< WSeries* >
where WSeries is a non-standard class included in the wavelet.so library.
The final goal is to pass this object to :
std::vector clustering(const double threshold, const std::vector<
WSeries* >& data, const double strip_edges);
In the script below, the object gets created
In [4]: data
Out[4]: <ROOT.vector<WSeries > object at 0x405dae0>
In [5]: data.size()
Out[5]: 1L
but I can’t pass it on:
—> 25 clusters = graph.clustering(400.0,data,8.0)
TypeError: vector wavegraph::clustering(const double threshold,
const vector<WSeries*>& data, const double strip_edges) =>
could not convert argument 2
I suspect this is due to the difference between the expected type vector<WSeries*>
and the created type <ROOT.vector<WSeries > (missing *). I don’t know how to fix this problem.
Any suggestion?
Eric
import ROOT
INSTALL_DIR = “myinstalldir/”
ROOT.gSystem.Load(“libPhysics.so”)
ROOT.gSystem.Load(“libFFTW.so”)
ROOT.gSystem.Load(“libHtml.so”)
ROOT.gSystem.Load(“libTreeViewer.so”)
ROOT.gSystem.Load(INSTALL_DIR + “wavelet.so”)
ROOT.gSystem.Load(INSTALL_DIR + “wavegraph.so”)
from ROOT import WSeries
from ROOT.std import vector
from ROOT import wavegraph
wseries_double = WSeries(“double”)
wseries_vector = vector(wseries_double)
data = wseries_vector()
w = wseries_double()
data.push_back(w)
graph = wavegraph();
graph.create(‘test_graph.txt’)
clusters = graph.clustering(400.0,data,8.0)