skip to main |
skip to sidebar
Don't miss out
Get Moving Again
================================================================================================================================== I recently switched to Suse Linux 11.1 from Windows and Digikam 0.9.4 was installed by the distribution DVD. I think its very good but it doesn't list my camera (Pentax K200D) as supported. If I want to upgrade Digikam to version 0.10.0, should I uninstall the existing package first or just install the new RPM over the top? Thanks in advance Graham Dicker _______________________________________________ Digikam-users mailing list Digi ... @kde.org https://mail.kde.org/mailman/listinfo/digikam-users hi Patrick, here you can find my solution: remember that I used igraph python module to produce vertex and edge sequence and that in my .net file there where 5 different type of edges (grey, blue, red, yellow, green)... which I try to reproduce with their different weights and, most of all, remember that my code - I am sure - is not the best possible... http://www.digitaldust.it/movie/mainWindow.py comments and improvements MORE than welcome! ;) cheers, Simone Il giorno 29/dic/08, alle ore 18:28, Gael Varoquaux ha scritto: On Mon, Dec 29, 2008 at 04:52:31PM +0100, Patrick wrote: At the outset, I have n 3d points defined by 'nodes': nx3 array, i.e. 3d coordinates 'nodeIDs': nx1 array, i.e. the point IDs 'edges': (n-1)x2 array, i.e. indicating the IDs of the pairs of points to be connected The task now is to connect the points given in 'nodes' using the edge information given in 'edges'. In Matlab this can easily be done using the plot3 function. Say we have a set of 10 points, then the input to matlab's plot3 function can be made to be three 2x10 arrays containing the x,y and z coordinates of the beginning and end point of the edges in their respective columns. For the last few days I have been trying to get this to work using the excellent mlab module of mayavi2 (I am using the most recent python(x,y) distribution). My problem is that the input arrays I was passing to Matlab's plot3 function do not work in mlab's plot3d() function. After several hours of searching on the internet, I came across a very similar problem posted recently: https://mail.enthought.com/pipermail/enthought-dev/2008-October/017835.html After following the advice given in the above posts, I am now able to manually (not automatically, which is necessary due to the large amount of data) connect points by explicitly indicating the labels assigned to the points after calling "labels = mlab.pipeline.labels(points)". Unfortunately I have not been able to automate this procedure, especially since the labels assigned to the points do not coincide with the labels in my 'nodeIDs' and 'edges' arrays. I am not sure what is the problem that you are having. The labels probably don't coincide exactly with the labels that you where using in matlab, but this can easily be worked around. The labels number of a point is its number in the array of positions that you specified initialy, starting from 0. Here is an example that demonstrates it clearly: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++ import numpy as np from enthought.mayavi import mlab nodes_x = np.arange(10) nodes_y = 2*np.arange(10) nodes_z = np.zeros_like(nodes_y) mlab.clf() nodes = mlab.pipeline.scalar_scatter(nodes_x, nodes_y, nodes_z) ## Use the following if you want the nodes to be displayed as spheres. #nodes = mlab.points3d(nodes_x, nodes_y, nodes_z, # mode='sphere', scale_factor=0.1, # opacity=0.5) # Label the points with their ID labels = mlab.pipeline.labels(nodes) labels.mapper.label_format = '%.f' # Connect point 1 and 2, as well as 3 and 4 nodes.mlab_source.dataset.lines = np.array(((1, 2), (3, 4), (7, 8))) nodes.mlab_source.update() # And now display the lines lines = mlab.pipeline.surface(nodes) mlab.show() +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++ As you can see in this example, the lines are drawn between the second and third point, the fourth and fifth, and the heighth and nineth. Now if you have an array of labels, you just need to convert these labels to positions. One way would be to sort all arrays so that points are ordered in increasing and continuing label order. Another would simply be to create an array mapping your labels with the mayavi labels, ie the ordering number of the labels. I've coded an example using some fairly ugly numpy code. Robert (if you are around) is there a cleaner way to create do this? Creating an inverse mapping between values and indices seems like a common task. In particular, my solution doesn't scale well at all when the label array is very sparse. The following example builds the very exact same set of line than the previous one, but uses a fancy labelling order: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++ import numpy as np from enthought.mayavi import mlab nodes_x = np.arange(10) nodes_y = 2*np.arange(10) nodes_z = np.zeros_like(nodes_y) labels = np.array((15, 14, 13, 12, 11, 0, 1, 2, 3, 4)) # Create a mapping from index in label array to label number. label_numbers = np.zeros(labels.max() + 1, np.int) - 1 label_numbers[labels] = np.arange(labels.size) mlab.clf() nodes = mlab.pipeline.scalar_scatter(nodes_x, nodes_y, nodes_z) # The connection array, in label numbers connected_labels = np.array(((14, 13), (12, 11), (2, 3))) # Using fancy indexing on our mapping array, label_numbers, # to convert label numbers to indices nodes.mlab_source.dataset.lines = label_numbers[connected_labels] nodes.mlab_source.update() # And now display the lines lines = mlab.pipeline.surface(nodes) mlab.show() +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++ I hope this sorts you out. If it does not, could you send me a minimal representative set of your data (say the first 3 points, if this is representative). Cheers, Gaël _______________________________________________ Enthought-dev mailing list Enth ... @mail.enthought.com https://mail.enthought.com/mailman/listinfo/enthought-dev _______________________________________________ Enthought-dev mailing list Enth ... @mail.enthought.com https://mail.enthought.com/mailman/listinfo/enthought-dev