convert Profile to Hist

16 views
Skip to first unread message

Sebastian Schmitt

unread,
Jun 12, 2013, 4:05:41 AM6/12/13
to rootp...@googlegroups.com
Hi!

In ROOT one can convert a TProfile to an TH1D using ProjectionX. I
thought about adding an easier to memorize named function to rootpy's
Profile like "toHist" that calls internally ProjectionX.

What do you think?

Best,

Sebastian

Peter Waller

unread,
Jun 12, 2013, 8:50:50 AM6/12/13
to rootp...@googlegroups.com
how about "ashist"? (thinking like the "asrootpy" function)

Whatever it's called, I'm happy with it so long as another developer is.



--
You received this message because you are subscribed to the Google Groups "rootpy dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rootpy-dev+...@googlegroups.com.
To post to this group, send email to rootp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rootpy-dev/51B82BD5.60009%40googlemail.com?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.



Peter Waller

unread,
Jun 12, 2013, 9:22:36 AM6/12/13
to rootp...@googlegroups.com
On second thoughts, to_hist is probably more appropriate. "as" has some implication of re-using the underlying structure, whereas "to" implies creating a copy, which is what you're doing here, I guess.

Sebastian Schmitt

unread,
Jun 12, 2013, 8:54:00 AM6/12/13
to rootp...@googlegroups.com
Hi!

Do you see it as a free standing function? Like

def ashist(obj):

if isinstance(obj,Profile):
return obj.ProjectionX():
else:
raise something("don't know how to turn foo into hist")

Or as member function of Profile?

Best,

Sebastian

Sebastian Schmitt

unread,
Jun 14, 2013, 7:27:03 AM6/14/13
to rootp...@googlegroups.com
Hi!

A to_hist function could also be added to Graph.

So, do you agree that we want to add to_hist functions to a series of
classes?

Best,

Sebastian

Noel Dawe

unread,
Jul 11, 2013, 2:17:26 AM7/11/13
to rootp...@googlegroups.com
Hi Sebastian,

Yes, I agree that a to_hist() method on all applicable classes would be a nice feature. Although this can be lossy, for example in Graph that subclasses TGraphAsymmErrors we need some standard for converting the possibly asymmetric errors to symmetric ones.

Noel

Reply all
Reply to author
Forward
0 new messages