[Rivet] [PATCH] filter nan's in make-plots

Andy Buckley andy.buckley at cern.ch
Wed Aug 16 12:49:32 BST 2017


Agreed: make-plots should handle NaNs nicely. They are valid float 
values in .yoda and maybe .dat files, so the plotting should handle them 
somehow.

I'll apply the patch for Rivet 2.6.0.

Andy


On 14/08/17 01:18, Dmitry Kalinkin wrote:
> Hi Chris,
> 
> This behavior is already used in many places of make-plots, and this patch only fixes one place where it is missing. In context of plotting TProfiles NaN’s will arise during conversion from yoda to flat file format because yoda’s API will give out NaN values for uncertainties when there are zero entries in the bin. Later is not an extraordinary situation and make-plots certainly is not supposed to produce invalid latex code in response to that.
> 
> Dmitry
> 
>> On 13 Aug 2017, at 14:30, Chris Pollard <cpollard at cern.ch> wrote:
>>
>> Hi,
>>
>> Is this the behavior we want in make-plots? I'm not sure if it's better to throw an error in NaN-valued bins or to just plot nothing, but by default I prefer the former.
>>
>> Chris
>>
>> On Wed, Jul 12, 2017 at 8:09 AM, Dmitry Kalinkin <dmitry.kalinkin at gmail.com> wrote:
>> Hi,
>>
>> There is a bug in make-plots which prevents it from generating correct latex when I try to compare TProfile1D’s with occasional empty bins. Patch below fixes the problem for me. Could you please integrate it.
>>
>> Thanks,
>>
>> Best,
>> Dmitry
>>
>> diff --git a/bin/make-plots b/bin/make-plots
>> index 4cbdfacf..ecaf4dbe 100755
>> --- a/bin/make-plots
>> +++ b/bin/make-plots
>> @@ -1810,6 +1810,9 @@ class Histogram(DrawableObject, Described):
>>                   if self.getErrorBands():
>>                       self.description['SmoothLine'] = 0
>>                       for b in self.data:
>> +                        if isnan(b.val) or isnan(b.err[0]) or isnan(b.err[1]):
>> +                            seen_nan = True
>> +                            continue
>>                           out += ('\\psframe[dimen=inner,linewidth=0pt,linestyle=none,fillstyle=solid,fillcolor=%s,opacity=%s]' % (self.getErrorBandColor(),self.getErrorBandOpacity()))
>>                           out += ('(' + coors.strphys2frameX(b.xmin) + ', ' \
>>                                       + coors.strphys2frameY(b.val - b.err[0]) + ')(' \
>>
>> _______________________________________________
>> Rivet mailing list
>> Rivet at projects.hepforge.org
>> https://www.hepforge.org/lists/listinfo/rivet
>>
> 
> _______________________________________________
> 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