|
[Rivet] aidamergeAndy Buckley andy.buckley at ed.ac.ukSat Aug 20 18:37:42 BST 2011
On 20/08/11 12:27, Daniel Weyh wrote: > Dear Hannes, > >> Dear Riveties >> >> adding several aida files works fine, only in some cases I get the error: >> >> Traceback (most recent call last): >> File "./aidamerge", line 65, in<module> >> sum_err2 += h.getBin(i).getErr()**2 >> OverflowError: (34, 'Numerical result out of range') >> >> I guess it comes when a histo is not properly filled (fro example when a ratio is taken). >> Is there a way to prevent these error message, and to continue with the program ? > > I added a patch to catch the exception, use float('inf') during summing up and in the write out step this 'inf' is converted to a vee..eery large float. > Does this work for you? > > @others: Is this the way it should work - or should we somehow exclude such bins?!? I'm inclined to think that trying to do something automatic is not the right way here... why exactly is this line overflowing the Python float size? That seems mad, and I don't think that replacing all overflows with very large finite numbers is going to give the right answer! So I'm dubious about the wisdom of this patch, especially since as I said in my other mail this script is more of an example than production code, and the logic in it should be clear. In cases where you might be dividing one histogram by another, in which the divisor has empty bins... well, try to avoid having empty bins ;) Again, I think that the response needs to be specific to the problem and application. Silently doing something which may not be appropriate gives a false impression of correctness, since the application does not complain. For that reason I am looking forward to removing the code in Professor that currently ignores empty bins just because they have undefined errors and hence screw up a chi2 calculation: surely not the best way to do things. Andy -- Dr Andy Buckley SUPA Advanced Research Fellow Particle Physics Experiment Group, University of Edinburgh The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
More information about the Rivet mailing list |