-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can plotting recipies for TH1D, TGraph, TGraphError be a part of the package? #10
Comments
Well, we should definitely add support for And you're right, Plots recipes for some things would be useful, too. |
do you know how to check subtypes of the PyObject? I am afraid it cannot be done by the dispatch, i.e. requires conversion to Julia structure upfront. I saw you do something similar in the how will this work for TH*, TGraph*? |
I think it will just be done via further additions to |
any experience with reading TCanvas in TFile using uproot? o._fields # Vector{Any} with 0 elements
o._members # PyObject <bound method ROOTStreamedObject._members of <class 'uproot.rootio.Undefined_TCanvas'>>
o.__getattribute__ # PyObject <method-wrapper '__getattribute__' of Undefined_TCanvas object at 0x000000005067A0F0> |
Haven't tried yet - but if Python can read it, there must be a way to get at it. :-) |
I have got the next opportunity (an urgent need) to get the extraction of the canvas data working. julia> c0 = TFile("file.root")["page0"]
PyObject <Undefined_TCanvas at 0x00000256f6d0>
julia> keys(c0)
39-element Vector{Symbol}:
:__class__
:__delattr__
:__dict__
:__dir__
:__doc__
:__eq__
:__format__
:__ge__
:__getattribute__
:__gt__
:__hash__
:__init__
:__init_subclass__
:__le__
:__lt__
:__metaclass__
:__module__
:__ne__
:__new__
:__reduce__
:__reduce_ex__
:__repr__
:__setattr__
:__sizeof__
:__str__
:__subclasshook__
:__weakref__
:_classname
:_classversion
:_copycontext
:_cursor
:_fields
:_members
:_postprocess
:_readinto
:_recarray
:_recarray_dtype
:classname
:read any idea where to look for the right methods? |
I am a bit confused. What is the main issue? Accessing the data from a |
Is it possible to upload the ROOT-file somewhere? (e.g. here, as a ZIP file) |
sure
|
In the ROOT I would do something like this: root> c1 = (TCanvas*)page0->GetListOfPrimitives()->First()
root> l1 = c1->GetListOfPrimitives()->FirstLink()
root> m1 = (TMultiGraph*)l1->Next()->GetObject()
root> m1->GetListOfGraphs()->GetEntries()
(int) 11
root> g1 = (TGraph*)m1->GetListOfGraphs()->First()
root> N = g1->GetN()
(int) 85
root> xv = g1->GetX()
root> yv = g1->GetY() ah, root |
I fear that this stuff is deeply connected with the underlying C++ function mapping. While it might be possible to retrieve the data points if there is valid streamer info (it seems I assume it's worthless to ask if there is a possibility to change the output ROOT format to something which is less dependent of the C++ framework... |
I guess, this points to the same direction julia> pycall(c0, PyObject)[:GetListOfPrimitives]()
PyError ($(Expr(:escape, :(ccall(#= .julia\packages\PyCall\3fwVL\src\pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'TypeError'>
TypeError("'Undefined_TCanvas' object is not callable") Does it?
No way around unwrapping the objects in the root terminal ... :( |
call root from |
AAA! |
BTW, the root structures in JSON look so simple.
|
It's not the data structure that is the problem, it's the parsing of nested C++ classes that lead to the final result |
Here is how I plot
TGraphError
extracted fromTFile
,I think it would make a lot of sense to write a few recipes. I am just not sure how to check subtypes of these
PyObject
without writing the parserThe text was updated successfully, but these errors were encountered: