traits and scalar data fields

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

traits and scalar data fields

David Sinden
Hi I am new to python, mayavi and the traits framework, so i apologize if this is a badly posed question or trivial, but how can i modify the any of the examples to ensure that visualisation can be done for a scalar field i define rather than an numpy array?

i have done this for the simple traits_ui example, but this is probably luck! i can't get it to work on others. For example i read in both the x,y,z and the data arrays are read in using commands which follow

        z, x, y = np.mgrid[z0:z1:nzz, x0:x1:nrr, y0:y1:nrr]
        data  = np.reshape(struct.unpack('134400d',*int(nrr.imag)*int(nrr.imag)*int(nzz.imag))

i'd then try and pass src into the the object implementing the dialog but i get an errors, so in

traits.trait_errors.TraitError: The 'scalar_data' trait of an ArraySource instance must be a 2D or 3D numpy array, but a value of <mayavi.sources.array_source.ArraySource object at 0xc12047c> <class 'mayavi.sources.array_source.ArraySource'> was specified.

traits.trait_errors.TraitError: The 'data' trait of a VolumeSlicer instance must be an array, but a value of <mayavi.sources.array_source.ArraySource object at 0xcc3f3ec> <class 'mayavi.sources.array_source.ArraySource'> was specified.

Can a minimal working example or a modification of an existing example be produced?

Thanks, david

The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addressee only.  If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer and network.
Enthought-Dev mailing list
[hidden email]