[chaco] issue with uint8 data...

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[chaco] issue with uint8 data...

fred-2
Hi all,

I get some issue trying to read uint8 data:

Exception occurred in traits notification handler.
Please check the log file for details.
Exception occurred in traits notification handler for object:
<enthought.chaco.data_range_1d.DataRange1D object at 0x36aa4d0>, trait:
sources_items, old value: <undefined>, new value:
<enthought.traits.trait_handlers.TraitListEvent object at 0x34a2a90>
Traceback (most recent call last):
   File
"/usr/local/lib/python2.6/dist-packages/Traits-3.5.1.dev_r26218-py2.6-linux-x86_64.egg/enthought/traits/trait_notifiers.py",
line 367, in call_2
     self.handler( object, new )
   File
"/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/data_range_1d.py",
line 371, in _sources_items_changed
     self.refresh()
   File
"/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/data_range_1d.py",
line 200, in refresh
     self._refresh_bounds()
   File
"/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/data_range_1d.py",
line 316, in _refresh_bounds
     if source.get_size() > 0]
   File
"/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/image_data.py",
line 154, in get_bounds
     self._cached_bounds = (nanmin(self.raw_value),
   File "/usr/lib/pymodules/python2.6/numpy/lib/function_base.py", line
1494, in nanmin
     return _nanop(np.min, np.inf, a, axis)
   File "/usr/lib/pymodules/python2.6/numpy/lib/function_base.py", line
1353, in _nanop
     y[mask] = fill
OverflowError: cannot convert float infinity to integer

Can someone help me on this?

TIA.

Cheers,

--
Fred

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

cme.py (3K) Download Attachment
uint8.sep (411K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [chaco] issue with uint8 data...

bryce hendrix-2
On Wed, Mar 9, 2011 at 5:21 AM, Fred <[hidden email]> wrote:
Hi all,

I get some issue trying to read uint8 data:

Exception occurred in traits notification handler.
Please check the log file for details.
Exception occurred in traits notification handler for object: <enthought.chaco.data_range_1d.DataRange1D object at 0x36aa4d0>, trait: sources_items, old value: <undefined>, new value: <enthought.traits.trait_handlers.TraitListEvent object at 0x34a2a90>
Traceback (most recent call last):
 File "/usr/local/lib/python2.6/dist-packages/Traits-3.5.1.dev_r26218-py2.6-linux-x86_64.egg/enthought/traits/trait_notifiers.py", line 367, in call_2
   self.handler( object, new )
 File "/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/data_range_1d.py", line 371, in _sources_items_changed
   self.refresh()
 File "/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/data_range_1d.py", line 200, in refresh
   self._refresh_bounds()
 File "/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/data_range_1d.py", line 316, in _refresh_bounds
   if source.get_size() > 0]
 File "/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/image_data.py", line 154, in get_bounds
   self._cached_bounds = (nanmin(self.raw_value),
 File "/usr/lib/pymodules/python2.6/numpy/lib/function_base.py", line 1494, in nanmin
   return _nanop(np.min, np.inf, a, axis)
 File "/usr/lib/pymodules/python2.6/numpy/lib/function_base.py", line 1353, in _nanop
   y[mask] = fill
OverflowError: cannot convert float infinity to integer

Can someone help me on this?


Did you look at the array you read in from the data file? Does it look like what you expect?

Bryce

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [chaco] issue with uint8 data...

fred-2
Le 09/03/2011 17:41, bryce hendrix a écrit :

> On Wed, Mar 9, 2011 at 5:21 AM, Fred <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi all,
>
>     I get some issue trying to read uint8 data:
>
>     Exception occurred in traits notification handler.
>     Please check the log file for details.
>     Exception occurred in traits notification handler for object:
>     <enthought.chaco.data_range_1d.DataRange1D object at 0x36aa4d0>,
>     trait: sources_items, old value: <undefined>, new value:
>     <enthought.traits.trait_handlers.TraitListEvent object at 0x34a2a90>
>     Traceback (most recent call last):
>       File
>     "/usr/local/lib/python2.6/dist-packages/Traits-3.5.1.dev_r26218-py2.6-linux-x86_64.egg/enthought/traits/trait_notifiers.py",
>     line 367, in call_2
>         self.handler( object, new )
>       File
>     "/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/data_range_1d.py",
>     line 371, in _sources_items_changed
>         self.refresh()
>       File
>     "/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/data_range_1d.py",
>     line 200, in refresh
>         self._refresh_bounds()
>       File
>     "/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/data_range_1d.py",
>     line 316, in _refresh_bounds
>         if source.get_size() > 0]
>       File
>     "/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/image_data.py",
>     line 154, in get_bounds
>         self._cached_bounds = (nanmin(self.raw_value),
>       File "/usr/lib/pymodules/python2.6/numpy/lib/function_base.py",
>     line 1494, in nanmin
>         return _nanop(np.min, np.inf, a, axis)
>       File "/usr/lib/pymodules/python2.6/numpy/lib/function_base.py",
>     line 1353, in _nanop
>         y[mask] = fill
>     OverflowError: cannot convert float infinity to integer
>
>     Can someone help me on this?
>
>
> Did you look at the array you read in from the data file? Does it look
> like what you expect?
Yes, Bryce.

--
Fred
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [chaco] issue with uint8 data...

Warren Weckesser


On Wed, Mar 9, 2011 at 11:16 AM, Fred <[hidden email]> wrote:
Le 09/03/2011 17:41, bryce hendrix a écrit :
> On Wed, Mar 9, 2011 at 5:21 AM, Fred <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi all,
>
>     I get some issue trying to read uint8 data:
>
>     Exception occurred in traits notification handler.
>     Please check the log file for details.
>     Exception occurred in traits notification handler for object:
>     <enthought.chaco.data_range_1d.DataRange1D object at 0x36aa4d0>,
>     trait: sources_items, old value: <undefined>, new value:
>     <enthought.traits.trait_handlers.TraitListEvent object at 0x34a2a90>
>     Traceback (most recent call last):
>       File
>     "/usr/local/lib/python2.6/dist-packages/Traits-3.5.1.dev_r26218-py2.6-linux-x86_64.egg/enthought/traits/trait_notifiers.py",
>     line 367, in call_2
>         self.handler( object, new )
>       File
>     "/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/data_range_1d.py",
>     line 371, in _sources_items_changed
>         self.refresh()
>       File
>     "/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/data_range_1d.py",
>     line 200, in refresh
>         self._refresh_bounds()
>       File
>     "/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/data_range_1d.py",
>     line 316, in _refresh_bounds
>         if source.get_size() > 0]
>       File
>     "/usr/local/lib/python2.6/dist-packages/Chaco-3.3.3.dev_r26267-py2.6-linux-x86_64.egg/enthought/chaco/image_data.py",
>     line 154, in get_bounds
>         self._cached_bounds = (nanmin(self.raw_value),
>       File "/usr/lib/pymodules/python2.6/numpy/lib/function_base.py",
>     line 1494, in nanmin
>         return _nanop(np.min, np.inf, a, axis)
>       File "/usr/lib/pymodules/python2.6/numpy/lib/function_base.py",
>     line 1353, in _nanop
>         y[mask] = fill
>     OverflowError: cannot convert float infinity to integer
>
>     Can someone help me on this?
>
>
> Did you look at the array you read in from the data file? Does it look
> like what you expect?
Yes, Bryce.



It's a numpy 1.4 problem.  Here's a simple example:

-----
In [1]: numpy.__version__
Out[1]: '1.4.0'

In [2]: x = array([1,2,3], dtype=uint8)

In [3]: nanmin(x)
---------------------------------------------------------------------------
OverflowError                             Traceback (most recent call last)

/Users/warren/<ipython console> in <module>()

/Library/Frameworks/Python.framework/Versions/6.3/lib/python2.6/site-packages/numpy/lib/function_base.py in nanmin(a, axis)
   1492
   1493     """
-> 1494     return _nanop(np.min, np.inf, a, axis)
   1495
   1496 def nanargmin(a, axis=None):

/Library/Frameworks/Python.framework/Versions/6.3/lib/python2.6/site-packages/numpy/lib/function_base.py in _nanop(op, fill, a, axis)
   1351     # We only need to take care of NaN's in floating point arrays

   1352     if not np.issubdtype(y.dtype, int):
-> 1353        y[mask] = fill
   1354
   1355     res = op(y, axis=axis)

OverflowError: cannot convert float infinity to integer
-----

With numpy 1.5.1:

-----
In [1]: numpy.__version__
Out[1]: '1.5.1'

In [2]: x = array([1,2,3], dtype=uint8)

In [3]: nanmin(x)
Out[3]: 1
-----


Warren


--
Fred
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [chaco] issue with uint8 data...

fred-2
Le 11/03/2011 07:17, Warren Weckesser a écrit :

> With numpy 1.5.1:
>
> -----
> In [1]: numpy.__version__
> Out[1]: '1.5.1'
>
> In [2]: x = array([1,2,3], dtype=uint8)
>
> In [3]: nanmin(x)
> Out[3]: 1
Mmmh, thanks Warren.

But this new version get rid of fread() & fwrite() a lot used in my
codes, so I give up :-(


Cheers,

--
Fred
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev