[Rivet] zticks bug in make-plots

Dmitry Kalinkin dmitry.kalinkin at gmail.com
Sun Oct 16 18:30:00 BST 2016


Hi Andy,

Sorry, this doesn’t work again
Traceback (most recent call last):
  File "./make-plots-1.txt", line 2737, in <module>
    for i, _ in enumerate(map(process_datfile, datfiles)):
  File "./make-plots-1.txt", line 2474, in process_datfile
    texfile.write(mp.draw(inputdata))
  File "./make-plots-1.txt", line 677, in draw
    out += self._draw(inputdata)
  File "./make-plots-1.txt", line 717, in _draw
    out += colorscale.draw()
  File "./make-plots-1.txt", line 1170, in draw
    drawzlabels = self.description.attr_bool('PlotZTickLabels', True)
AttributeError: 'dict' object has no attribute ‘attr_bool'

Please try the attached dat file

Thanks,

Dmitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: result.dat
Type: application/octet-stream
Size: 232668 bytes
Desc: not available
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20161016/987136c7/attachment.obj>
-------------- next part --------------


> On 16 Oct 2016, at 11:51, Andy Buckley <andy.buckley at cern.ch> wrote:
> 
> Hi Dmitry,
> 
> D'oh, some copy & paste errors there in the code that I moved over from x and y axis tick-handling -- the object structure of the z-colorbar is not quite compatible.
> 
> I think I've fixed that one now... can you try the attached? If not, can you send me an example 2D .dat file to test on?
> 
> Thanks,
> Andy
> 
> 
> 
> On 15/10/16 00:53, Dmitry Kalinkin wrote:
>> Hi Andy,
>> 
>> Sorry for the late reply. I ran your make-plots against stable rivet. Long story short, it doesn’t work:
>> 
>> Traceback (most recent call last):
>>  File "./make-plots", line 2738, in <module>
>>    process_datfile(f)
>>  File "./make-plots", line 2474, in process_datfile
>>    texfile.write(mp.draw(inputdata))
>>  File "./make-plots", line 677, in draw
>>    out += self._draw(inputdata)
>>  File "./make-plots", line 717, in _draw
>>    out += colorscale.draw()
>>  File "./make-plots", line 1166, in draw
>>    if inputdata.attr('ZCustomMinorTicks'):
>> NameError: global name 'inputdata' is not defined
>> 
>> The error is in the chunk you’ve changed (compared to the tip), so I assume you know better than me how to fix it.
>> I’m also including a sample .dat file for you to test against.
>> 
>> Cheers,
>> Dmitry
>> 
>> 
>> 
>> 
>>> On 12 Oct 2016, at 12:15, Andy Buckley <andy.buckley at cern.ch> wrote:
>>> 
>>> Hi Dmitry,
>>> 
>>> Thanks for the patch. Although I found that there was a bug in the first part, because in the case that there were entries in the custom z-ticks list it would have tried to append entries to a None object.
>>> 
>>> I've attached the latest version, which I think should work but I don't have a 2D histogram lying around for testing. Can you try this out and let me know if it also works as you require?
>>> 
>>> Thanks,
>>> Andy
>>> 
>>> 
>>> 
>>> On 11/10/16 12:02, Dmitry Kalinkin wrote:
>>>> Dear Rivet developers,
>>>> 
>>>> Patch below fixes z axis ticks (they don’t get displayed in the current rivet 2.5.2). Only the first hunk is needed for the fix. The remaining three are a style fixes.
>>>> Hope you will find this useful.
>>>> 
>>>> Best,
>>>> Dmitry
>>>> 
>>>> 
>>>> 
>>>> diff --git a/bin/make-plots b/bin/make-plots
>>>> index abb024d..f59293d 100755
>>>> --- a/bin/make-plots
>>>> +++ b/bin/make-plots
>>>> @@ -1152,8 +1152,8 @@ class ColorScale(Described):
>>>> 
>>>>        zcustommajortickmarks = int(self.description.get('ZMajorTickMarks', -1))
>>>>        zcustomminortickmarks = int(self.description.get('ZMinorTickMarks', -1))
>>>> -        zcustommajorticks=[]
>>>> -        zcustomminorticks=[]
>>>> +        zcustommajorticks=None
>>>> +        zcustomminorticks=None
>>>>        if self.description.has_key('ZCustomMajorTicks') and self.description['ZCustomMajorTicks']!='':
>>>>            # TODO: Would be nice to have less invisible separation of the custom ticks than split on tabs
>>>>            ticks = self.description['ZCustomMajorTicks'].strip().split('\t')
>>>> @@ -2214,7 +2214,7 @@ class Ticks(object):
>>>> 
>>>> class XTicks(Ticks):
>>>> 
>>>> -    def draw(self, custommajorticks=[], customminorticks=[], custommajortickmarks=-1, customminortickmarks=-1,drawlabels=True):
>>>> +    def draw(self, custommajorticks=None, customminorticks=None, custommajortickmarks=-1, customminortickmarks=-1,drawlabels=True):
>>>>        twosided = bool(int(self.description.get('XTwosidedTicks', '0')))
>>>>        out = ""
>>>>        out += ('\n%\n% X-Ticks\n%\n')
>>>> @@ -2265,7 +2265,7 @@ class XTicks(Ticks):
>>>> 
>>>> class YTicks(Ticks):
>>>> 
>>>> -    def draw(self, custommajorticks=[], customminorticks=[], custommajortickmarks=-1, customminortickmarks=-1, drawlabels=True):
>>>> +    def draw(self, custommajorticks=None, customminorticks=None, custommajortickmarks=-1, customminortickmarks=-1, drawlabels=True):
>>>>        twosided = bool(int(self.description.get('YTwosidedTicks', '0')))
>>>>        out = ""
>>>>        out += ('\n%\n% Y-Ticks\n%\n')
>>>> @@ -2320,7 +2320,7 @@ class ZTicks(Ticks):
>>>>        self.description = description
>>>>        self.coors = coors
>>>> 
>>>> -    def draw(self, custommajorticks=[], customminorticks=[],
>>>> +    def draw(self, custommajorticks=None, customminorticks=None,
>>>>            custommajortickmarks=-1, customminortickmarks=-1,
>>>>            drawlabels=True):
>>>>        out = ""
>>>> 
>>>> _______________________________________________
>>>> 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
>>> <make-plots.txt>
>> 
> 
> 
> -- 
> Dr Andy Buckley, Lecturer / Royal Society University Research Fellow
> Particle Physics Expt Group, University of Glasgow
> <make-plots.txt>



More information about the Rivet mailing list