Problems adding arrays and setting active attributes

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

Problems adding arrays and setting active attributes

Richard Beare
Hi,
More details of my problem with the plot_graph routine posted earlier
on this list.

The error occurs when attempting to set the active attribute after
having added an array to the point_data. I've looked at lots of
examples of adding arrays, and this seems to be the way it should be
done. Certainly, if I get_array(1).name after having added it, the
array seems to be there. However it doesn't show up in the pipeline
view (and I don't know whether it should). And obviously the
set_active_attribute can't find the name. What am I missing?

        edges_src = mlab.pipeline.scalar_scatter(x[indices],
                                                y[indices],
                                                z[indices],
                                                np.c_[edge_scalar,
                                                        edge_scalar].ravel())

        edges_src.mlab_source.dataset.point_data.add_array(
                                                np.abs(np.c_[values,
                                                            values].ravel()))
        edges_src.mlab_source.dataset.point_data.get_array(1).name = 'radius'
        edges_src.mlab_source.dataset.lines = np.array((
                                                2*np.arange(len(values)),
                                                2*np.arange(len(values))+1,
                                                )).T
        edges_src.mlab_source.update()

        if tube_radius is not None:
            tubes = mlab.pipeline.tube(
                            mlab.pipeline.set_active_attribute(
                                edges_src, point_scalars='radius'),
                                tube_radius=tube_radius,
                                )
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev