Chris Kees | 1 Feb 2012 01:51
Picon
Gravatar

building mayavi on os x 10.7

Hi,

I'm trying to build mayavi in a custom installation and am wondering if I
can get some pointers.  When I run 'python ets.py develop' things go fine
until mayavi, which gives the following error. It looks like it fails
trying to build the docs, but I don't understand why it's trying to do that
before successfully building mayavi. If I just run 'python setup.py
install' I get seg fault and can't seem to get any information about why
it's failing. I'd appreciate any pointers on how to get more information
about why the build is failing.

Thanks,
Chris

Running command
['/Users/cekees/proteus/darwinclang/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python',
'setup.py', 'develop'] in package mayavi
running develop
running gen_docs
running build_docs
make -f MakefileMayavi html
sphinx-build -b html -d build/mayavi/doctrees   source/mayavi
build/mayavi/html
Running Sphinx v1.1.2
loading pickled environment... done
building [html]: targets for 1 source files that are out of date
updating environment: 0 added, 5 changed, 0 removed
Traceback (most recent call last):_view_objects

  File
(Continue reading)

Adam Hughes | 1 Feb 2012 02:33
Picon

Re: Using HasTraits functions to set extended trait names

Jonathan,

Thanks for getting back to me.  I'll get an example out tomorrow, sorry for
the delay.

On Tue, Jan 31, 2012 at 5:03 PM, Jonathan Rocher <jrocher@...>wrote:

> Hi Adam,
>
> Do you have a sample code to make sure I understand what you are trying to
> do? Why could you not use getattr and setattr?
>
> Thanks,
> Jonathan
>
> On Mon, Jan 30, 2012 at 7:30 PM, Adam Hughes <hugadams@...
> >wrote:
>
> > Hi,
> >
> > I've been using some of the built-in features of HasTraits to run
> > simulations, mainly by using trait_get() and trait_set() methods.  I've
> > designed a structure that I think is fairly powerful for simulations,
> > because it allows a user to specify a set of ranges for valid float
> traits,
> > then the simulation will update all of these traits step by step, so it's
> > very easy to run simulations over many different types of variables in
> the
> > program using this same framework.  All the user has to provide are the
> > correct trait names.
(Continue reading)

Gael Varoquaux | 1 Feb 2012 09:18
Favicon
Gravatar

Re: building mayavi on os x 10.7

On Tue, Jan 31, 2012 at 06:51:52PM -0600, Chris Kees wrote:
> I'm trying to build mayavi in a custom installation and am wondering if I
> can get some pointers.  When I run 'python ets.py develop' things go fine
> until mayavi, which gives the following error. It looks like it fails
> trying to build the docs,

That should be just a warning, and not a failure. Can you confirm that
Mayavi does not isntall properly? If so, can you give more details?

Cheers,

G
Robert Kern | 1 Feb 2012 12:15
Gravatar

Re: Table Filter [I]

On Tue, Jan 31, 2012 at 10:15 AM, Sam Wedge <sam.wedge@...> wrote:
> Classification: Serco Internal
>
> Hi,
>
> I have been playing around with TableEditor and TabularEditor to display some data in a table, and would
now like to apply a filter to my data. Out of the two, I think I would rather use TabularEditor over
TableEditor, but in order to get a filter working I am willing to use whichever is necessary.
>
> By trawling the documentation, I am aware that I need to create a function that outputs True or False for my
filter. What I am not sure about is how I can actually link this to my table view.
>
> Have I missed any good examples on how to do this, or does anyone have any snippets that they wouldn't mind sharing?

https://github.com/enthought/traitsui/blob/master/examples/demo/Advanced/Table_editor_with_live_search_and_cell_editor.py#L153

The basic idea is to use the filter_name trait on the TableEditor to
give the name of the trait on the edited object that has this
function. In this example, the filter function is dynamically created
through a Property that returns an appropriate function parameterized
by the search terms.

https://github.com/enthought/traitsui/blob/master/examples/demo/Advanced/Table_editor_with_live_search_and_cell_editor.py#L272

--

-- 
Robert Kern
Enthought
Adam Hughes | 1 Feb 2012 17:47
Picon

Re: Using HasTraits functions to set extended trait names

I've made a working example.  This code uses a random number generator to
set trait values, and when the trait is a trait of the main class, it
works; however, when it is a trait of the subclass, it doesn't.  I've
chosen this method because I think it's very amenable to simulations; all
the user does is specify the trait he/she wants as a string, rather than
opening the source and referring to the trait variable explicitly.  Aka I
realize I could make this work by saying "self.sub.a.set()" but I'd rather
use this notation if possible.

from traits.api import *
from traitsui.api import *
from random import random

class SubClass(HasTraits):
    a=Float(1.0)

class Main(HasTraits):
    b=Float(2.0)
    sub=Instance(SubClass,())

    set_random=Button

    def _set_random_fired(self):
        bnew={'b':random()}
        self.set(**bnew)  #Works

        anew={'sub.a':random()}
        self.set(**anew) #Doesn't work

    traits_view=View(
(Continue reading)

Chris Kees | 1 Feb 2012 18:03
Picon
Gravatar

Re: building mayavi on os x 10.7

Hi Gael,

When I try to run the mayavi tests I get:

% cd mayavi
% nosetests
Segmentation fault

I've also tried just running 'python setup.py build' in mayavi, but I get a
segmentation fault there as well. I'm including some information below from
running 'python setup.py'.

Please let me know what else would be useful. It appears that all the other
ets tools install after fixing a few simple syntax error in 'enable', which
I'm guessing are just due to clang being slightly more picky than g++.
 I've also installed wx (demos seem to work fine) and configobj, since
those were recommended in the mayavi configuration.

Thanks,
Chris

Python 2.7.2 (default, Jan 30 2012, 11:51:47)
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)]
sys.platform = 'darwin'
sys.prefix =
'/Users/cekees/proteus/darwinclang/Library/Frameworks/Python.framework/Versions/2.7'
sys.byteorder = 'little'
sys.path =
['/Users/cekees/proteus/darwinclang/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.9.3-osx_cocoa',
 '/Users/cekees/proteus/externalPackages/ets/mayavi',
(Continue reading)

Gael Varoquaux | 1 Feb 2012 18:18
Favicon
Gravatar

Re: building mayavi on os x 10.7

On Wed, Feb 01, 2012 at 11:03:42AM -0600, Chris Kees wrote:
> I've also tried just running 'python setup.py build' in mayavi, but I get a
> segmentation fault there as well. I'm including some information below from
> running 'python setup.py'.

OK, so you do have a problem. Could you run a C-level debugger to know
where this segfault is coming from.

> Please let me know what else would be useful. It appears that all the other
> ets tools install after fixing a few simple syntax error in 'enable', which
> I'm guessing are just due to clang being slightly more picky than g++.

Do you know for a fact that VTK and the VTK Python bindings work under
clang? This might simply be the problem.

Alternatively, can you run some simple VTK code using wx and vtk, but not
Mayavi. For instance, in the Mayavi code base, the file
mayavi/tvtk/pyface/ui/wx/wxVTKRenderWindowInteractor.py

Cheers,

Gaƫl
Jonathan Rocher | 2 Feb 2012 00:42

Re: Using HasTraits functions to set extended trait names

Hi again Adam,

I see now. The way I would do it is to replace
       self.set(**anew) #Doesn't work
by
       setattr(self.sub, 'a', random())

In fact that's what the set/trait_set method does: simply call setattr
dealing with change notification around it. It wouldn't be that hard to
extend the method to accept the input you are suggesting.

Jonathan

On Wed, Feb 1, 2012 at 10:47 AM, Adam Hughes <hugadams@...>wrote:

> I've made a working example.  This code uses a random number generator to
> set trait values, and when the trait is a trait of the main class, it
> works; however, when it is a trait of the subclass, it doesn't.  I've
> chosen this method because I think it's very amenable to simulations; all
> the user does is specify the trait he/she wants as a string, rather than
> opening the source and referring to the trait variable explicitly.  Aka I
> realize I could make this work by saying "self.sub.a.set()" but I'd rather
> use this notation if possible.
>
> from traits.api import *
> from traitsui.api import *
> from random import random
>
> class SubClass(HasTraits):
>    a=Float(1.0)
(Continue reading)

Jonathan Rocher | 2 Feb 2012 00:52

Re: Using HasTraits functions to set extended trait names

To finish, the reason why what you tried doesn't work is that setattr
doesn't take dotted notation in the second argument. So if you get the
string you are describing, you would have to split it on the last dot, and
do an eval("self"+first part) for the first argument and the second part
for the second argument to setattr. Didn't try it but I don't see why that
wouldn't work.

HTH,
Jonathan

On Wed, Feb 1, 2012 at 5:42 PM, Jonathan Rocher <jrocher@...>wrote:

> Hi again Adam,
>
> I see now. The way I would do it is to replace
>        self.set(**anew) #Doesn't work
> by
>        setattr(self.sub, 'a', random())
>
> In fact that's what the set/trait_set method does: simply call setattr
> dealing with change notification around it. It wouldn't be that hard to
> extend the method to accept the input you are suggesting.
>
> Jonathan
>
>
> On Wed, Feb 1, 2012 at 10:47 AM, Adam Hughes <hugadams@...>wrote:
>
>> I've made a working example.  This code uses a random number generator to
>> set trait values, and when the trait is a trait of the main class, it
(Continue reading)

Adam Hughes | 2 Feb 2012 02:16
Picon

Re: Using HasTraits functions to set extended trait names

Thanks Jonathan, I appreciate your help very much.

On Wed, Feb 1, 2012 at 6:52 PM, Jonathan Rocher <jrocher@...>wrote:

> To finish, the reason why what you tried doesn't work is that setattr
> doesn't take dotted notation in the second argument. So if you get the
> string you are describing, you would have to split it on the last dot, and
> do an eval("self"+first part) for the first argument and the second part
> for the second argument to setattr. Didn't try it but I don't see why that
> wouldn't work.
>
> HTH,
> Jonathan
>
> On Wed, Feb 1, 2012 at 5:42 PM, Jonathan Rocher <jrocher@...
> >wrote:
>
> > Hi again Adam,
> >
> > I see now. The way I would do it is to replace
> >        self.set(**anew) #Doesn't work
> > by
> >        setattr(self.sub, 'a', random())
> >
> > In fact that's what the set/trait_set method does: simply call setattr
> > dealing with change notification around it. It wouldn't be that hard to
> > extend the method to accept the input you are suggesting.
> >
> > Jonathan
> >
(Continue reading)


Gmane