On 09/02/07, Prabhu Ramachandran <[EMAIL PROTECTED]> wrote:
> >>>>> "Fernando" == Fernando Perez <[EMAIL PROTECTED]> writes:
>
>     >> muck_around_with_data_in_ipython_some_more()
>     >> send_new_data_to_mayavi()
>     >>
>     >> much like I can with mpl. The entries in the cookbook suggest
>     >> scripting mayavi, but I'm not sure how to adapt this for
>     >> interactive use.
>
>     Fernando> Prabhu will probably give you more accurate info, but
>
> Not really, your answer is spot on.
>
> [...]
>     Fernando> ipython -wthread
> [...]
>     Fernando> if you want also matplotlib support AND you have
>     Fernando> configured mpl to use one of the WX-based backends.

Yep - I use the WXAgg backend.

>     Fernando> Since Mayavi2 is a WX app, you can only use both WX and
>     Fernando> MPL together if you use the WX backends for MPL.
>
> Just to confirm, yes, that is about all there is to it.

Great, so it sounds like it should be possible. Now, it's just a case
of me not being able to figure out the mechanics of what to type to
make it work. I start ipython with -pylab, and I'm typing into it, as
per the scripting example in the cookbook:

In [1]: from enthought.mayavi.app import Mayavi

In [2]: from enthought.mayavi.sources.array_source import ArraySource

In [3]: dat = numpy.arange(100*100).reshape((100,100))

In [4]: class foo(Mayavi):
   ....:     def run(self):
   ....:         src = ArraySource()
   ....:         src.scalar_data = dat
   ....:         script=self.script
   ....:         script.new_scene()
   ....:         script.add_source(src)

In [5]: mv = foo()

In [6]: mv.main()

And up pops the mayavi2 window but showing now scene or array source,
and an error message is printed in the ipython window:

---------------------------------------------------------------------------
exceptions.SystemError                               Traceback (most
recent call last)

/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_core.py in
<lambda>(event)
  13533         app._CallAfterId = wx.NewEventType()
  13534         app.Connect(-1, -1, app._CallAfterId,
> 13535                     lambda event: event.callable(*event.args, 
> **event.kw) )
  13536     evt = wx.PyEvent()
  13537     evt.SetEventType(app._CallAfterId)

/home/amcmorl/working/local_diam/real_individual/<ipython console> in run(self)
      3
      4
----> 5
      6
      7

/usr/local/scipy/enthought/src/lib/enthought/mayavi/script.py in new_scene(self)
     83         """Creates a new VTK scene window.
     84         """
---> 85         self.engine.new_scene()
     86
     87     def load_visualization(self, fname):

/usr/local/scipy/enthought/src/lib/enthought/mayavi/engine.py in new_scene(self)
    188         """Creates a new VTK scene window.
    189         """
--> 190         active_window = get_active_window(self.application)
    191         action = NewScene(window=active_window)
    192         action.perform()

/usr/local/scipy/enthought/src/lib/enthought/mayavi/engine.py in
get_active_window(app)
     33 def get_active_window(app):
     34     """Get the currently active window given the current application."""
---> 35     wb = app.get_service('enthought.envisage.workbench.IWorkbench')
     36     return wb.active_window
     37

/usr/local/scipy/enthought/src/lib/enthought/envisage/core/application.py
in get_service(self, interface, query)
    622         service = self.service_registry.get_service(interface, query)
    623         if service is None:
--> 624             raise SystemError("Service %s not found" % str(interface))
    625
    626         return service

SystemError: Service enthought.envisage.workbench.IWorkbench not found

What should I be doing differently? I'll put what I get working on to
the wiki, since I think it could be helpful for others too. Once I get
that method working, I'm hoping I can define a foo.__init__ which will
accept a data parameter and make that the scalar data for mayavi. Does
that sound feasible?

Thanks for your time,

Angus.
-- 
AJC McMorland, PhD Student
Physiology, University of Auckland

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
MayaVi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mayavi-users

Reply via email to