fred wrote:
> Eric Firing a écrit :
>> Fred,
>>
>> In image.py, the AxesImage.__init__() includes:
>>
>>        self._interpd = {
>>             'nearest'  : _image.NEAREST,
>>             'bilinear' : _image.BILINEAR,
>>             'bicubic'  : _image.BICUBIC,
>>             'spline16' : _image.SPLINE16,
>>             'spline36' : _image.SPLINE36,
>>             'hanning'  : _image.HANNING,
>>             'hamming'  : _image.HAMMING,
>>             'hermite'  : _image.HERMITE,
>>             'kaiser'   : _image.KAISER,
>>             'quadric'  : _image.QUADRIC,
>>             'catrom'   : _image.CATROM,
>>             'gaussian' : _image.GAUSSIAN,
>>             'bessel'   : _image.BESSEL,
>>             'mitchell' : _image.MITCHELL,
>>             'sinc'     : _image.SINC,
>>             'lanczos'  : _image.LANCZOS,
>>             'blackman' : _image.BLACKMAN,
>>         }
>>
>> Logically I suspect this should be a class attribute, not an instance 
>> attribute, which would make things easier for you (and is an easy 
>> change to make--I can make it unless someone quickly points out why 
>> this would be a mistake.)  Maybe the keys should be a separate class 
>> attribute, with no underscore, since although the values in this 
>> dictionary may be implementation-dependent, the keys should not 
>> be--they are part of the external interface.
>>
>> Let me know if making these changes in svn is worthwhile.
>>
> In fact, I would like something like datad for colormaps.
> I use it like this:
> 
>     def __init__(self, **traits):
>     HasTraits.__init__(self, **traits)
>       
>         dict_colormaps = copy(datad)
>         self.cmap = get_cmap(self.default_colormap)
>         for cm in dict_colormaps.keys():
>             if (cm[-2:] == '_r'):
>                 dict_colormaps.pop(cm)
> 
> Doing this, I can display in my traits app the list of colormaps.
> 
> I would like to have something similar for available interpolation
> methods.
> 
> I guess that implies to remove intperd from the AxesImage class,
> as datad does not belong to any class, IIUC.

I don't understand; it seems to me that all you need is _interpd.keys(), 
and since this is specific to AxesImage, it should be an attribute of 
that class, say AxesImage.interpolations.  You can't add interpolation 
methods, and they have no meaning outside AxesImage (or the code it 
calls).  The colormap dictionary is different: much more general and 
flexible, so it is where it belongs: outside any class.

Eric

>  
> Obviously, I can build this list myself, hard-coding it,
> but I would prefer something "cleaner".
> 
> 
> Cheers,
> 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to