[Rivet] Question about YODA Profile1D: how to show RMS instead of errors of the mean

Andy Buckley andy.buckley at cern.ch
Sat Jun 13 20:56:57 BST 2015


Hi Adrian,

I'm able to read this one ok -- at least with the development version of
YODA that I have installed. What version are you using? I attached the
output of a slightly modified script, now without the red errorbar
overlay for the std err on the mean.

This has been a useful discussion for me -- gives me a few definite
to-do's for the next YODA release that I hope to make before the end of
the month. If you've got more questions just ask... or come find me in
Glasgow this week!

Andy


On 13/06/15 17:41, Adrian Buzatu wrote:
> Sorry, I had attached the wrong .yoda file before. 
> 
> Adrian
> ________________________________________
> From: Adrian Buzatu
> Sent: 13 June 2015 17:38
> To: ab374y-redirect; rivet at projects.hepforge.org
> Cc: Chris Pollard
> Subject: RE: Question about YODA Profile1D: how to show RMS instead of errors of the mean
> 
> Dear Andy,
> 
> Thank you for the clarification that YODA is just the histogramming format and then the plotting is done with Python libraries outside. It seems promising to use this script to adapt the plots. Unfortunately, I get an error. When I print the bins, I get the same erroneous value in all bins and later on the code segfaults when trying to do operations on the bin. I attach my .yoda file with the Profile1D. Maybe you could use it in your script to see if there is something wrong with the .yoda file?
> 
> Thank you,
> Adrian
> 
>  [abuzatu at ppepc137 RivetHbbBJets]$ ./convert.py
> <Profile1D '/RivetHbbBJets/p1_PTm_PTwm' 15 bins, sumw=1.4e+05>
> <ProfileBin1D x=[1.34425e-312, 6.94398e-310)>
> Segmentation fault
> 
> and with "continue"
> [abuzatu at ppepc137 RivetHbbBJets]$ ./convert.py
> <Profile1D '/RivetHbbBJets/p1_PTm_PTwm' 15 bins, sumw=1.5e+05>
> <ProfileBin1D x=[1.34425e-312, 6.91224e-310)>
> <ProfileBin1D x=[1.34425e-312, 6.91224e-310)>
> <ProfileBin1D x=[1.34425e-312, 6.91224e-310)>
> <ProfileBin1D x=[1.34425e-312, 6.91224e-310)>
> <ProfileBin1D x=[1.34425e-312, 6.91224e-310)>
> <ProfileBin1D x=[1.34425e-312, 6.91224e-310)>
> <ProfileBin1D x=[1.34425e-312, 6.91224e-310)>
> <ProfileBin1D x=[1.34425e-312, 6.91224e-310)>
> <ProfileBin1D x=[1.34425e-312, 6.91224e-310)>
> <ProfileBin1D x=[1.34425e-312, 6.91224e-310)>
> <ProfileBin1D x=[1.34425e-312, 6.91224e-310)>
> <ProfileBin1D x=[1.34425e-312, 6.91224e-310)>
> <ProfileBin1D x=[1.34425e-312, 6.91224e-310)>
> <ProfileBin1D x=[1.34425e-312, 6.91224e-310)>
> <ProfileBin1D x=[1.34425e-312, 6.91224e-310)>
> 
> 
> Thanks,
> Adrian
> ________________________________________
> From: Andy Buckley [andy.buckley at cern.ch]
> Sent: 13 June 2015 16:49
> To: Adrian Buzatu; rivet at projects.hepforge.org
> Cc: Chris Pollard
> Subject: Re: Question about YODA Profile1D: how to show RMS instead of errors of the mean
> 
> On 13/06/15 11:37, Adrian Buzatu wrote:
>> Hi RIVET/YODA authors,
>>
>> For the studies I am doing on the jet energy scale it was suggested to
>> me to reproduce some YODA Profile1D where instead of the error bars on
>> the mean to show the RMS of the distribution, as we already have the
>> mean on the Y axis. Do you know how to do that?
>>
>> On a different, but maybe related note, do you know if I can interface
>> ROOT with RIVET to use ROOT insted of YODA? I am familiar with how to do
>> this in ROOT, and then use PyROOT, maybe that can help. But I hope plan
>> A with YODA has a feature for this.
> 
> Hi Adrian,
> 
> There's some confusion here about what YODA does: it mostly just handles
> the statistical definition of histograms, but the plotting is external.
> 
> rivet-cmphistos converts to the simple make-histos format, and the
> decision about what size to give to error bars is built into the
> converter code. It doesn't have a simple flag to change the profile
> error bar plotting, though.
> 
> Our future direction for Rivet and YODA plotting is to use the Python
> matplotlib (mpl) library. There's the start of some helper functions in
> the yoda.plotting Python module, but even without touching those it's
> pretty easy to do mpl plotting of YODA objects:
> 
>   ## Load a profile histo
>   import yoda
>   aos = yoda.read("/home/andy/proj/hep/rivet/Rivet.yoda")
>   p = aos["/MC_GENERIC/EtaSumEt"]
>   assert type(p) is yoda.Profile1D
> 
>   ## Get data points and errors
>   xs, ys, exs, eys, sigys = [], [], [], [], []
>   for b in p.bins:
>       if b.sumW:
>           xs.append(b.xMid)
>           exs.append(b.xWidth/2)
>           ys.append(b.mean)
>           eys.append(b.stdErr)
>           sigys.append(b.stdDev)
> 
>   ## Plot
>   import pylab as pl
>   pl.hold(True)
>   pl.errorbar(xs, ys, xerr=exs, yerr=sigys, marker="None", ls="None",
> ecolor="black")
>   pl.errorbar(xs, ys, xerr=exs, yerr=eys, marker="None", ls="None",
> ecolor="red")
>   pl.plot(xs, ys, "o", color="black")
>   pl.savefig("rmsprofile.pdf")
> 
> With the demo Rivet.yoda file that I had lying around, this produced the
> attached PDF (note that I used the standard deviation rather than RMS
> for this plot, since b.rms() wouldn't subtract the mean value in the
> calculation of the distribution width). It should be pretty easy to
> extend that script, and I can help you to use the yoda.plotting tools if
> you like. I'm also going to add an optional argument to the Profile1D
> mkScatter, function, which will make it possible to do this sort of
> plotting in just a few lines.
> 
> There's also a yoda2root script, which makes use of converter functions
> in the YODA/ROOTCnv.h header... I'm not sure if it works completely for
> profiles, though, since ROOT's interface for populating those is very
> odd. If you go that route, let us know how you get on!
> 
> Andy
> 
> --
> Dr Andy Buckley, Lecturer / Royal Society University Research Fellow
> Particle Physics Expt Group, University of Glasgow
> 


-- 
Dr Andy Buckley, Lecturer / Royal Society University Research Fellow
Particle Physics Expt Group, University of Glasgow
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RivetHbbBJets_p1_PTm_PTwm.pdf
Type: application/pdf
Size: 15973 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20150613/51a4fb04/attachment.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RivetHbbBJets_p1_PTm_PTwt.pdf
Type: application/pdf
Size: 16381 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20150613/51a4fb04/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RivetHbbBJets_p1_PTm_PTwu.pdf
Type: application/pdf
Size: 16164 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20150613/51a4fb04/attachment-0002.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RivetHbbBJets_p1_PTmt_PTwm.pdf
Type: application/pdf
Size: 16424 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20150613/51a4fb04/attachment-0003.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RivetHbbBJets_p1_PTmt_PTwt.pdf
Type: application/pdf
Size: 16699 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20150613/51a4fb04/attachment-0004.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RivetHbbBJets_p1_PTmt_PTwu.pdf
Type: application/pdf
Size: 17375 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20150613/51a4fb04/attachment-0005.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RivetHbbBJets_p1_PTmu_PTwm.pdf
Type: application/pdf
Size: 19882 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20150613/51a4fb04/attachment-0006.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RivetHbbBJets_p1_PTmu_PTwt.pdf
Type: application/pdf
Size: 19252 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20150613/51a4fb04/attachment-0007.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RivetHbbBJets_p1_PTmu_PTwu.pdf
Type: application/pdf
Size: 19332 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20150613/51a4fb04/attachment-0008.pdf>


More information about the Rivet mailing list