[Rivet] rebinning histograms

Viesturs Veckalns viesturs.veckalns at cern.ch
Tue Apr 12 18:25:39 BST 2016


Dear Andy,
I have a problem with the script you sent: h is considered as str and no methods of histo1D are applicable.

AttributeError: 'str' object has no attribute 'rebin'

Cheers,
Viesturs
________________________________________
From: Andy Buckley
Sent: 03 April 2016 23:22
To: Viesturs Veckalns; rivet at projects.hepforge.org
Subject: Re: [Rivet] rebinning histograms

Hi Viesturs,

Yes, histograms have several rebinning methods. You can use a Python
script for simple rebinning like this:

import yoda
hists = yoda.read("myfile.yoda")
for h in hists:
     h.rebin(3) #< factor of 3 rebinning
yoda.write(hists, "newfile.yoda")

Not tested, but it should work: see http://yoda.hepforge.org/pydoc/ and
search for "rebin" to get documentation. You can also pass a list of
explicit new bin edges to rebin() or use explicit rebinBy & rebinTo methods.

Andy


On 01/04/16 19:31, Viesturs Veckalns wrote:
> Dear Rivet team,
> Is it possible to rebin yoda histograms?
> Cheers,
> Viesturs
>
>
> _______________________________________________
> Rivet mailing list
> Rivet at projects.hepforge.org
> https://www.hepforge.org/lists/listinfo/rivet
>


--
Dr Andy Buckley, Lecturer / Royal Society University Research Fellow
Particle Physics Expt Group, University of Glasgow


More information about the Rivet mailing list