[mayavi] Threshold filter & NaN...

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

[mayavi] Threshold filter & NaN...

fred-2
Hi all,

I created two random data, and then put "holes" (nan), randomly.

I converted them in VTK XML files:

http://ktools.free.fr/pas_glop.vti

http://ktools.free.fr/glop.vti

If I run mayavi like this:


mayavi2 -d pas_glop.vti -f Threshold -m Surface

and

mayavi2 -d glop.vti -f Threshold -m Surface

I get the following error message for the first:

ERROR|2010-02-03 11:37:20,144|Exception
Traceback (most recent call last):
  File
"/usr/local/lib/python2.5/site-packages/Mayavi-3.3.1.dev_r25097-py2.5-linux-x86_64.egg/enthought/mayavi/core/source.py",
line 214, in _handle_children
    obj.start()
  File
"/usr/local/lib/python2.5/site-packages/Mayavi-3.3.1.dev_r25097-py2.5-linux-x86_64.egg/enthought/mayavi/core/filter.py",
line 106, in start
    self.update_pipeline()
  File
"/usr/local/lib/python2.5/site-packages/Mayavi-3.3.1.dev_r25097-py2.5-linux-x86_64.egg/enthought/mayavi/filters/threshold.py",
line 141, in update_pipeline
    self._update_ranges()
  File
"/usr/local/lib/python2.5/site-packages/Mayavi-3.3.1.dev_r25097-py2.5-linux-x86_64.egg/enthought/mayavi/filters/threshold.py",
line 182, in _update_ranges
    self.set(lower_threshold = dr[0], trait_change_notify=False)
  File
"/usr/local/lib/python2.5/site-packages/Traits-3.2.1.dev_r25049-py2.5-linux-x86_64.egg/enthought/traits/has_traits.py",
line 1881, in trait_set
    setattr( self, name, value )
  File
"/usr/local/lib/python2.5/site-packages/Traits-3.2.1.dev_r25049-py2.5-linux-x86_64.egg/enthought/traits/trait_types.py",
line 1782, in _set
    self.error( object, name, value )
  File
"/usr/local/lib/python2.5/site-packages/Traits-3.2.1.dev_r25049-py2.5-linux-x86_64.egg/enthought/traits/trait_handlers.py",
line 175, in error
    value )
TraitError: The 'lower_threshold' trait of a Threshold instance must be
nan <= a number <= nan, but a value of nan <type 'float'> was specified.
ERROR|2010-02-03 11:37:22,151|Current object is not active, please
select an active object.


What happens?

What's wrong?

TIA


Cheers,


PS: I have no issue using paraview for instance.

--
Fred

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

Re: [mayavi] Threshold filter & NaN...

Gael Varoquaux
Hi Fred,

Your problem is that you have nans in you data. I checked in a patch
[25280] to make your specific example work, but in general, you will run
in trouble everywhere because of these nans. You should avoid having nans
in you data. Some operations are undefined for nans (like comparisons).

Gaël

On Wed, Feb 03, 2010 at 11:46:42AM +0100, fred wrote:
> Hi all,

> I created two random data, and then put "holes" (nan), randomly.

> I converted them in VTK XML files:

> http://ktools.free.fr/pas_glop.vti

> http://ktools.free.fr/glop.vti

> If I run mayavi like this:


> mayavi2 -d pas_glop.vti -f Threshold -m Surface

> and

> mayavi2 -d glop.vti -f Threshold -m Surface

> I get the following error message for the first:

> ERROR|2010-02-03 11:37:20,144|Exception
> Traceback (most recent call last):
>   File
> "/usr/local/lib/python2.5/site-packages/Mayavi-3.3.1.dev_r25097-py2.5-linux-x86_64.egg/enthought/mayavi/core/source.py",
> line 214, in _handle_children
>     obj.start()
>   File
> "/usr/local/lib/python2.5/site-packages/Mayavi-3.3.1.dev_r25097-py2.5-linux-x86_64.egg/enthought/mayavi/core/filter.py",
> line 106, in start
>     self.update_pipeline()
>   File
> "/usr/local/lib/python2.5/site-packages/Mayavi-3.3.1.dev_r25097-py2.5-linux-x86_64.egg/enthought/mayavi/filters/threshold.py",
> line 141, in update_pipeline
>     self._update_ranges()
>   File
> "/usr/local/lib/python2.5/site-packages/Mayavi-3.3.1.dev_r25097-py2.5-linux-x86_64.egg/enthought/mayavi/filters/threshold.py",
> line 182, in _update_ranges
>     self.set(lower_threshold = dr[0], trait_change_notify=False)
>   File
> "/usr/local/lib/python2.5/site-packages/Traits-3.2.1.dev_r25049-py2.5-linux-x86_64.egg/enthought/traits/has_traits.py",
> line 1881, in trait_set
>     setattr( self, name, value )
>   File
> "/usr/local/lib/python2.5/site-packages/Traits-3.2.1.dev_r25049-py2.5-linux-x86_64.egg/enthought/traits/trait_types.py",
> line 1782, in _set
>     self.error( object, name, value )
>   File
> "/usr/local/lib/python2.5/site-packages/Traits-3.2.1.dev_r25049-py2.5-linux-x86_64.egg/enthought/traits/trait_handlers.py",
> line 175, in error
>     value )
> TraitError: The 'lower_threshold' trait of a Threshold instance must be
> nan <= a number <= nan, but a value of nan <type 'float'> was specified.
> ERROR|2010-02-03 11:37:22,151|Current object is not active, please
> select an active object.


> What happens?

> What's wrong?

> TIA


> Cheers,


> PS: I have no issue using paraview for instance.
--
    Gael Varoquaux
    Research Fellow, INRIA
    Laboratoire de Neuro-Imagerie Assistee par Ordinateur
    NeuroSpin/CEA Saclay , Bat 145, 91191 Gif-sur-Yvette France
    ++ 33-1-69-08-78-35
    ++ 33-6-28-25-64-62
    http://gael-varoquaux.info
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [mayavi] Threshold filter & NaN...

fred-2
Gael Varoquaux a écrit :
> Hi Fred,
Hi Gaël,

> Your problem is that you have nans in you data. I checked in a patch
> [25280] to make your specific example work, but in general, you will run
> in trouble everywhere because of these nans. You should avoid having nans
> in you data. Some operations are undefined for nans (like comparisons).
First, thanks for your patch, it works fine.

I have guessed that NaN were the culprit, but did not understand why
glop.vti works fine, and not pas_glop.vti.

Second, I don't have the choice to have NaN or not in data. These are
customer data :-(


Cheers,

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

Re: [mayavi] Threshold filter & NaN...

Gael Varoquaux
On Mon, Feb 22, 2010 at 12:38:14PM +0100, fred wrote:
> Second, I don't have the choice to have NaN or not in data. These are
> customer data :-(

Filter them :p

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

Re: [mayavi] Threshold filter & NaN...

fred-2
Gael Varoquaux a écrit :
> On Mon, Feb 22, 2010 at 12:38:14PM +0100, fred wrote:
>> Second, I don't have the choice to have NaN or not in data. These are
>> customer data :-(
>
> Filter them :p
I was thinking of replace NaN by a real value, not in the range min/max
and use Threshold filter, indeed...

Better idea?

But I fall on another issue in this case I have already posted here (a
few weeks/months ago), because at the heart of my problem, the idea is
to not use Threshold filter, which yields unstructured grid data...
which looks "bad", ie not smooth.

But I had no time to sort out it.

I only use Threshold on NaN because I have noticed that NaN's without
any filter crashed mayavi, so I tried to filter them to see if I could
get no crash, but unsuccessful.


I wonder if I'm clear here, I'm quite whacked :-/


Cheers,

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

Re: [mayavi] Threshold filter & NaN...

Gael Varoquaux
On Mon, Feb 22, 2010 at 07:07:33PM +0100, fred wrote:
 But I fall on another issue in this case I have already posted here (a
> few weeks/months ago), because at the heart of my problem, the idea is
> to not use Threshold filter, which yields unstructured grid data...
> which looks "bad", ie not smooth.

Use ImageThreshold, or something like this.

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

Re: [mayavi] Threshold filter & NaN...

fred-2
Gael Varoquaux a écrit :
> On Mon, Feb 22, 2010 at 07:07:33PM +0100, fred wrote:
>  But I fall on another issue in this case I have already posted here (a
>> few weeks/months ago), because at the heart of my problem, the idea is
>> to not use Threshold filter, which yields unstructured grid data...
>> which looks "bad", ie not smooth.
>
> Use ImageThreshold, or something like this.
We have already discussed about this, Gaël ;-)

I will concentrate myself on this issue asap.


Cheers,

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