[Mayavi] - Delaunay interpolation on XYZR dataset

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

[Mayavi] - Delaunay interpolation on XYZR dataset

Thomas Lecocq
Hi all,

I'm creating a source for mayavi :

def mplot(self):
        pd = tvtk.UnstructuredGrid()
        pd.points = self.points # is an array([[x0,y0,z0],[x1,y1,z1],...,[xn,yn,zn]]), where y0 is always 0.0
        cells = arange(0,len(self.xin),1)
        cells.shape=(len(self.xin),1)
        pd.set_cells(1,cells)
        pd.point_data.scalars = self.Rin.ravel() #is an array([0,...,n])
        pd.point_data.scalars.name='Resistivity'
        src = VTKDataSource(data=pd)
        return src

when I add it to the pipeline :

engine.add_source(src)

it show up OK, I can add a Surface module, but when I add the Delaunay2D filter and a Surface Module, it doesn't show up !

Any idea would be super welcome !

Cheers,

Thom



**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************


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

Re: [Mayavi] - Delaunay interpolation on XYZR dataset

Gael Varoquaux
Hi Thomas,

Any chance that you can make a small example that I run and that
reproduces the problem. It would help me figure out what is going on.

Cheers,

Gaël

On Mon, Apr 12, 2010 at 12:26:57PM +0000, Thomas Lecocq wrote:
>    Hi all,

>    I'm creating a source for mayavi :

>    def mplot(self):
>            pd = tvtk.UnstructuredGrid()
>            pd.points = self.points # is an
>    array([[x0,y0,z0],[x1,y1,z1],...,[xn,yn,zn]]), where y0 is always 0.0
>            cells = arange(0,len(self.xin),1)
>            cells.shape=(len(self.xin),1)
>            pd.set_cells(1,cells)
>            pd.point_data.scalars = self.Rin.ravel() #is an array([0,...,n])
>            pd.point_data.scalars.name='Resistivity'
>            src = VTKDataSource(data=pd)
>            return src

>    when I add it to the pipeline :

>    engine.add_source(src)

>    it show up OK, I can add a Surface module, but when I add the Delaunay2D
>    filter and a Surface Module, it doesn't show up !

>    Any idea would be super welcome !

>    Cheers,

>    Thom

>    **********************
>    Thomas Lecocq
>    Geologist
>    Ph.D.Student (Seismology)
>    Royal Observatory of Belgium
>    **********************

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


--
    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] - Delaunay interpolation on XYZR dataset

Thomas Lecocq
Gael,


I think the problem is more general :

When I create :

import numpy as N
xin = N.random.random(100)
yin = N.zeros(100)
zin = N.random.random(100)
rin = 20* abs(N.random.random(100))
from enthought.mayavi import mlab

mlab.pipeline.scalar_scatter(xin,yin,zin,rin)


The object that gets added to the pipeline is NOT plottable using Surface, which is my first problem. BUT, Glyph is rendering the point+scalar OK !


I'm preparing a reproducible case with UnstructuredGrid



Thomas



**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************



> Date: Mon, 12 Apr 2010 15:30:32 +0200
> From: [hidden email]
> To: [hidden email]
> Subject: Re: [Enthought-Dev] [Mayavi] - Delaunay interpolation on XYZR dataset
>
> Hi Thomas,
>
> Any chance that you can make a small example that I run and that
> reproduces the problem. It would help me figure out what is going on.
>
> Cheers,
>
> Gaël
>
> On Mon, Apr 12, 2010 at 12:26:57PM +0000, Thomas Lecocq wrote:
> > Hi all,
>
> > I'm creating a source for mayavi :
>
> > def mplot(self):
> > pd = tvtk.UnstructuredGrid()
> > pd.points = self.points # is an
> > array([[x0,y0,z0],[x1,y1,z1],...,[xn,yn,zn]]), where y0 is always 0.0
> > cells = arange(0,len(self.xin),1)
> > cells.shape=(len(self.xin),1)
> > pd.set_cells(1,cells)
> > pd.point_data.scalars = self.Rin.ravel() #is an array([0,...,n])
> > pd.point_data.scalars.name='Resistivity'
> > src = VTKDataSource(data=pd)
> > return src
>
> > when I add it to the pipeline :
>
> > engine.add_source(src)
>
> > it show up OK, I can add a Surface module, but when I add the Delaunay2D
> > filter and a Surface Module, it doesn't show up !
>
> > Any idea would be super welcome !
>
> > Cheers,
>
> > Thom
>
> > **********************
> > Thomas Lecocq
> > Geologist
> > Ph.D.Student (Seismology)
> > Royal Observatory of Belgium
> > **********************
>
> > _______________________________________________
> > Enthought-Dev mailing list
> > [hidden email]
> > https://mail.enthought.com/mailman/listinfo/enthought-dev
>
>
> --
> 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

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

Re: [Mayavi] - Delaunay interpolation on XYZR dataset

Thomas Lecocq
Gael,

Found something :

Delaunay2D does not work when X and Z are set, with Y set to numpy.zeros, but does work well when X and Y are set, and Z to numpy.zeros !!


Still trying...

Thom

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




From: [hidden email]
To: [hidden email]
Date: Mon, 12 Apr 2010 14:00:33 +0000
Subject: Re: [Enthought-Dev] [Mayavi] - Delaunay interpolation on XYZR dataset

Gael,


I think the problem is more general :

When I create :

import numpy as N
xin = N.random.random(100)
yin = N.zeros(100)
zin = N.random.random(100)
rin = 20* abs(N.random.random(100))
from enthought.mayavi import mlab

mlab.pipeline.scalar_scatter(xin,yin,zin,rin)


The object that gets added to the pipeline is NOT plottable using Surface, which is my first problem. BUT, Glyph is rendering the point+scalar OK !


I'm preparing a reproducible case with UnstructuredGrid



Thomas



**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************



> Date: Mon, 12 Apr 2010 15:30:32 +0200
> From: [hidden email]
> To: [hidden email]
> Subject: Re: [Enthought-Dev] [Mayavi] - Delaunay interpolation on XYZR dataset
>
> Hi Thomas,
>
> Any chance that you can make a small example that I run and that
> reproduces the problem. It would help me figure out what is going on.
>
> Cheers,
>
> Gaël
>
> On Mon, Apr 12, 2010 at 12:26:57PM +0000, Thomas Lecocq wrote:
> > Hi all,
>
> > I'm creating a source for mayavi :
>
> > def mplot(self):
> > pd = tvtk.UnstructuredGrid()
> > pd.points = self.points # is an
> > array([[x0,y0,z0],[x1,y1,z1],...,[xn,yn,zn]]), where y0 is always 0.0
> > cells = arange(0,len(self.xin),1)
> > cells.shape=(len(self.xin),1)
> > pd.set_cells(1,cells)
> > pd.point_data.scalars = self.Rin.ravel() #is an array([0,...,n])
> > pd.point_data.scalars.name='Resistivity'
> > src = VTKDataSource(data=pd)
> > return src
>
> > when I add it to the pipeline :
>
> > engine.add_source(src)
>
> > it show up OK, I can add a Surface module, but when I add the Delaunay2D
> > filter and a Surface Module, it doesn't show up !
>
> > Any idea would be super welcome !
>
> > Cheers,
>
> > Thom
>
> > **********************
> > Thomas Lecocq
> > Geologist
> > Ph.D.Student (Seismology)
> > Royal Observatory of Belgium
> > **********************
>
> > _______________________________________________
> > Enthought-Dev mailing list
> > [hidden email]
> > https://mail.enthought.com/mailman/listinfo/enthought-dev
>
>
> --
> 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

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

Re: [Mayavi] - Delaunay interpolation on XYZR dataset

Gael Varoquaux
On Mon, Apr 12, 2010 at 02:41:26PM +0000, Thomas Lecocq wrote:
>    Delaunay2D does not work when X and Z are set, with Y set to numpy.zeros,
>    but does work well when X and Y are set, and Z to numpy.zeros !!

Yes, I have already noticed this: delaunay 2D fails when the data is flat
in the Z direction. I believe this is due to a degeneracy in the
algorithm. I think it can easily be raised by adding a bit of random
noise (very little) in the Z direction.

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] - Delaunay interpolation on XYZR dataset

Gael Varoquaux
In reply to this post by Thomas Lecocq
On Mon, Apr 12, 2010 at 02:00:33PM +0000, Thomas Lecocq wrote:
>    When I create :

>    import numpy as N
>    xin = N.random.random(100)
>    yin = N.zeros(100)
>    zin = N.random.random(100)
>    rin = 20* abs(N.random.random(100))
>    from enthought.mayavi import mlab

>    mlab.pipeline.scalar_scatter(xin,yin,zin,rin)

>    The object that gets added to the pipeline is NOT plottable using Surface,
>    which is my first problem. BUT, Glyph is rendering the point+scalar OK !

Yes, this makes sens: this data source does not define a surface, but
only a set of points.

Ga�l

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