Forgot to attach the link to the code!
https://gist.github.com/955320

On Wed, May 4, 2011 at 3:42 PM, Michele Mattioni <matti...@gmail.com> wrote:
> Dear Mayavi ML,
>
> I'm wondering if somebody has an hint how to change a scalar array
> when is not offered by the mlab.mlab_source.scalars
>
> In specific I'm trying to change a second scalar, following the atomic orbital
>
>
> http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/auto/example_atomic_orbital.html#example-atomic-orbital
>
> Basically I would like to change the second scalar which is added with
> this code:
>
> src.image_data.point_data.add_array(np.angle(Phi).T.ravel())
> src.image_data.point_data.get_array(1).name = 'angle'
> src.image_data.point_data.update()
>
>
> therefore I'm doing something like:
>
>
> src.image_data.point_data.remove_array('angle')
> src.image_data.point_data.update()
>
> from numpy.random import random
> new_Phi = random(len(Phi.T.ravel()))
> src.image_data.point_data.add_array(new_Phi.T.ravel())
> src.image_data.point_data.get_array(1).name = 'angle'
> src.image_data.point_data.update()
>
> and this code works and the orbital is getting redraw automatically.
>
> however this doesn't work in my script.
>
> The only difference I can spot is the drawing pipeline..
> I'm using a lines pipeline
>      lines = mlab.pipeline.surface(src2)
>
> instead of surface one
>      mlab.pipeline.surface(contour2, colormap='hsv')
>
> However I thought this should make no difference at all!
>
> Any idea/better way to do this?
>
> Thanks,
> Michele.
>

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
MayaVi-users mailing list
MayaVi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users

Reply via email to