This section is a skeleton of things Dawn has added in preparation for The Macroscope at Maker Faire 2013, updated from Maker Faire 2012.
Mycelia provides a framework for visualizing and interacting with networks. An easy way to produce networks is with python and the networkx library. Mycelia uses the same structures as networkx.
Mycelia allows one to change the graph properties while they are displayed in Vrui. These instructions are for using Mycelia on a specific 3D TV system.
1. Log on to Archer and launch Mycelia using Vrui-Launcher or the icon Jordan set up.
2. In a terminal window, start iPython
$ ipython
Once in iPython, type:
In [1]: import mycelia In [2]: g = mycelia.Graph() In [3]: g.add_nodes_from( range(100) )
relayout the graph.
In [4]: g.layout()
center the graph.
In [5]: g.center()
Add a node with properties. Re-adding an existing node only changes its attributes. Adding an 'image' makes the node display as the image. Image scale is automatically set to “1” (average node size), but can be changed.
In [6]: g.add_node( 'hello', color='red', size='3', label='Red') In [7]: g.add_node( 'hello', image='/path/to/some/image.png' ) In [7.5]: g.add_node( 'hello', imageScale = 2) In [7.6]: g.add_edge(0,3, color='red')
Align or rotate (all together) textures/images as you rotate the camera.
In [8]: g.set_texture_node_mode('rotate') # or 'align'
To turn a node back to a sphere:
In [9]: g.add_node( 5, image=' ') # there is a space between ' and '
Change the layout to dynamic:
In [10]: g.set_layout_type('dynamic') # or 'static' In [11]: g.start_layout() In [12]: g.stop_layout() In [13]: g.randomize_positions() In [14]: g.clear()
You can do all this scripted as well. To specify which node attributes get added to mycelia. You list them in a list:
In [15]: g.custom_node_attrs = ['height', 'color', 'label']
Then any subsequent adds will add those attributes (if specified) to the node's attributes. They will then display in Mycelia. Note, we still only support 5 attributes at this point.
For now, use g.add_node(<node>, <attribute> = <value>) to change values so that Mycelia knows to update the graph. (The networkx form g[<node>][<attribute>] = <value> is not recognized by Mycelia.)
These are commands to manipulate the Dream Vortex, a project by Dawn and Meredith.
in a terminal window:
cd DreamVortex ipython
in ipython:
from mycelia import * import dreamNetwork as dn run manipulate.py d, att = dn.readDreams('<file name>')
d is a networkx graph, not a mycelia graph, so it will not show up in the mycelia display window. To convert it to a mycelia graph, use
g = dn.netwx2mycelia(d.copy())
To have the images appear and disappear on their own in Mycelia, try:
manipulate(g,d)
You will need to use the hydra to center the graph from the menu to make it look good. You can manipulate the graph as you wish while the images are changing.
To see various properties of the network
att <return> # prints out the available attributes d <return> # prints something like Out[4]: <mycelia.nxwrapper.DiGraph object at 0x2ded290>
d.node[<node number>]['<attribute>']
gives the value of the <attribute>. To change an attribute, type:
d.add_node(<node number>, <attribute> = <value>)
Subsets of a graph can be selected using:
g = dn.att(d.copy(), <attribute>, <value>) CHECK THIS
Special Attributes:
To assign a dream phrase to the label type:
g.add_node(<node number>, label = g.node[<node number>]['phrase'])
or
g = dn.label_nodes(g, <attribute>)
to label all of the nodes with the given attribute value.
To make the nodes appear on the surface of the graph:
g, att = dn.readDreams('<path and file name>') g.set_layout_type('dynamic') g.start_layout()
Set Repulsion Falloff to -0.1 and Connected Const to -1 in the menu for the dynamic layout.
Bundling the edges is also a nice effect.
Open a terminal window and type:
vrui-launcher mycelia -mergeConfig bkcolor.cfg
Open another terminal window and type:
cd DreamVortex ipython
In ipython, type:
from mycelia import * import dreamNetwork as dn run manipulate.py d, att = dn.readDreams('<file name>') g = dn.netwx2mycelia(d.copy()) manipulate(g,d)
1. Log on to Archer
2. Open a terminal
3. Start the VRDeviceDaemon (if not already started)
$ sudo VRDeviceDaemon
4. In another terminal window, start mycelia, merging in the configuration fragment for the Hydra Razor
$ mycelia -mergeConfig /etc/Vrui/RazerHydra.cfg -mergeConfig ~/Desktop/DreamVortex/no_markers.cfg -mergeConfig bgcolor.cfg #TEST THIS
5. In a third terminal window, start iPython and make a graph: (note: replace <…> with the text you need)
cd Desktop/DreamVortex ipython import mycelia run dreamNetwork d, att = readDreams('<file name>') g = small_images(d)
6. Choose “dynamic” from the mycelia menu or type:
g.set_layout_type('dynamic') g.start_layout()
7. (optional) Set Repulsion Falloff to -0.1 and Connected Const to -1 in the menu for the dynamic layout. Center the graph using either g.center() or the button on the dynamic menu. Close the menu.
8. (optional) Choose “Rendering Options” → “Bundle Edges”
9. Using an empty button, choose “Navigation” → “Curve File Animation”. Chose either Reasonable_Spin.curve or Reasonable_sweep.curve. Start/stop the curve by pushing this button.
10. Use menu items and various commands to change the graph: (note: <attribute> needs to be replaced by text in quotes, e.g. 'tag')
g = node_att(d, <attribute>, <value>) g = label_nodes(g, <attribute>) g = label_no_images(g, <attributes>) g = small_images(d) g = large_images(d)