Skip to content

Commit

Permalink
Started with micromaps actor idea. Renamed THANKS to CREDITS
Browse files Browse the repository at this point in the history
  • Loading branch information
unidesigner committed Nov 12, 2010
1 parent b0fc8c6 commit 91e113e
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 2 deletions.
File renamed without changes.
43 changes: 43 additions & 0 deletions examples/dynamic_network.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import numpy as np

from fos import Window
from fos.actor.network import AttributeNetwork

#import fos.lib.pyglet
#fos.lib.pyglet.options['debug_gl'] = True

wi = Window()
w = wi.get_world()

# node positions
pos = np.array( [ [0,0,0], [10,10,10] ], dtype = np.float32)
siz = np.array( [ [1.0, 1.0 ]], dtype = np.float32 )
col = np.array( [ [255,0,0,255],
[0,255,0,255]], dtype = np.ubyte)
edg = np.array( [ [0,1]], dtype = np.uint32 )

aff = np.eye(4, dtype = np.float32)
aff[:3,3] = [0,0,0]

nlabs = {0 : { 'label' : 'Node 1',
'size' : 20,
'font' : 'Times New Roman',
'color' : ( 255, 0, 0, 255 ) },
1 : { 'label' : 'Node 2'}
}

def update(self, dt):
if self.living:
print "t@", dt

cu = AttributeNetwork(affine = aff,
node_position = pos,
node_size = siz,
node_color = col,
node_label = nlabs,
edge_connectivity = edg)
cu.update = update

w.add(cu)
cu.start()
#w.delete(cu)
2 changes: 1 addition & 1 deletion fos/actor/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def update(self, dt):
if self.living:

self.internal_timestamp += dt

print dt
# if self.internal_timestamp > 50.0:
# print "you lived 10 seconds. this is enough"
# self.stop()
Expand Down
18 changes: 18 additions & 0 deletions fos/actor/tests/test_micromaps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
""" An actor to visualize time-depended electrical potential data """

sensor_positions : (N,3)
Location of the sensor positions
connectivity : (M,3)
Triangular connectivity of the sensors to make up the surface

sampling_frequency :
data : (S, N, T)
Number of subjects S, for each sensor N, across time duration T
plot_data :
For each subject and time frame, additional data array
(e.g. probability for microstate)

nr_maps_to_show : int
The number of maps to show simultaneously for each subject

# look for delaunay triangulation of a 2d projected coordinate frame as preprocessing step
2 changes: 1 addition & 1 deletion fos/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_model_matrix(array_type=c_float, glGetMethod=glGetFloatv):
"""
m = (array_type*16)()
glGetMethod(GL_MODELVIEW_MATRIX, m)
print "model matrix", np.array(m)
# print "model matrix", np.array(m)
return m

def get_projection_matrix(array_type=c_float, glGetMethod=glGetFloatv):
Expand Down

0 comments on commit 91e113e

Please sign in to comment.