Changeset 262
- Timestamp:
- 01/22/11 14:47:17 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/synapse/synapse-render_video.py
r261 r262 19 19 20 20 #import Puzzlebox.Synapse.Interface as tgInterface 21 22 import sys 21 23 22 24 from mpl_toolkits.mplot3d import Axes3D … … 26 28 import numpy 27 29 30 try: 31 import cPickle as pickle 32 except: 33 import pickle 34 28 35 ##################################################################### 29 36 # Globals … … 32 39 DEBUG = 1 33 40 41 DEFAULT_INPUT_FILE = 'untitled.synapse' 34 42 DEFAULT_HISTORY_IMAGE_FILE = 'history.png' 35 43 DEFAULT_CURRENT_VALUES_IMAGE_FILE = 'current.png' 36 44 45 DEFAULT_OUTPUT_DIRECTORY = 'output' 46 47 DEFAULT_ATTENTION_COLOR = 'red' 48 DEFAULT_MEDITATION_COLOR = 'blue' 49 50 DEFAULT_HISTORY_WIDTH = 240 51 DEFAULT_HISTORY_HEIGHT = 180 52 53 DEFAULT_CURRENT_VALUES_WIDTH = 96 54 DEFAULT_CURRENT_VALUES_HEIGHT = 720 55 37 56 ##################################################################### 38 57 # Functions 39 58 ##################################################################### 40 59 41 def render _history(attention=None, \42 43 width = 240, \44 height = 180, \45 attention_color = 'red', \46 mediation_color = 'blue', \47 60 def renderHistoryImage(attention=None, \ 61 meditation=None ,\ 62 width = DEFAULT_HISTORY_WIDTH, \ 63 height = DEFAULT_HISTORY_HEIGHT, \ 64 attention_color = DEFAULT_ATTENTION_COLOR, \ 65 mediation_color = DEFAULT_MEDITATION_COLOR, \ 66 output_file=DEFAULT_HISTORY_IMAGE_FILE): 48 67 49 68 figsize = (width / 100.0, height / 100.0) # @ 100 dpi … … 118 137 119 138 120 121 122 def render _current_values(x=None, y=None ,\123 width = 96, \124 height = 720, \125 x_color = 'red', \126 y_color = 'blue', \127 139 ##################################################################### 140 141 def renderCurrentValuesImage(x=None, y=None ,\ 142 width = DEFAULT_CURRENT_VALUES_WIDTH, \ 143 height = DEFAULT_CURRENT_VALUES_HEIGHT, \ 144 x_color = DEFAULT_ATTENTION_COLOR, \ 145 y_color = DEFAULT_MEDITATION_COLOR, \ 146 output_file=DEFAULT_CURRENT_VALUES_IMAGE_FILE): 128 147 129 148 figsize = (width / 100.0, height / 100.0) # @ 100 dpi … … 178 197 179 198 ##################################################################### 199 200 def openData(input_file=DEFAULT_INPUT_FILE): 201 202 file = open(input_file, 'r') 203 data = pickle.load(file) 204 file.close() 205 206 return(data) 207 208 209 ##################################################################### 180 210 # Main 181 211 ##################################################################### … … 183 213 if __name__ == '__main__': 184 214 185 render_history() 186 render_current_values() 187 215 input_file = DEFAULT_INPUT_FILE 216 output_directory = DEFAULT_OUTPUT_DIRECTORY 217 218 for each in sys.argv: 219 if each.startswith("--file="): 220 input_file = each[ len("--file="): ] 221 if each.startswith("--directory="): 222 server_port = each[ len("--directory="): ] 223 224 data = openData(input_file) 225 renderHistoryImage() 226 renderCurrentValuesImage() 227
Note: See TracChangeset
for help on using the changeset viewer.