I want to use pyroot to get contours.
I followed the ContourList.C to get contours of 1sigma, 2sigma CLs.
In this example:
// Get Contours
TObjArray *conts = (TObjArray*)gROOT->GetListOfSpecials()->FindObject("contours");
When I transfer to pyroot as following:
I got following errors:
Traceback (most recent call last):
File "plot2D.py", line 67, in <module>
AttributeError: 'TObject' object has no attribute 'At'
Do you know a way to solve this? Thank you in any case!
ROOT Version: 6.22/00
Platform: MAC OS
Compiler: Not Provided
Could you check whether the
conts Python object is actually pointing to a C++ object?
You can just print it, does it say what you see below?
<cppyy.gbl.TObject object at 0x0>
Yes, I see the same output.
Then what I believe happens is that there is no object called
contours in the list of specials. What you get back is a Python proxy to a C++ null pointer.
Perhaps @couet can clarify why
countours is not in the list of specials in the code you are running.
In C++ it is there. See the C++ code.
@couet could you point to what line in the C++ code makes
countours appear in the list of specials? That could give us a hint about the problem in the translation to Python.
LIST is the trick (see documentation)
// Draw contours as filled regions, and Save points
HistStreamFn->Draw("CONT Z LIST");
c->Update(); // Needed to force the plotting and retrieve the contours in TGraphs
Thank you. It works now.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.