1
########################################################################
3
# Vision Network - Python source code - file generated by vision
4
# Thursday 12 April 2007 13:48:35
6
# The Scripps Research Institute (TSRI)
7
# Molecular Graphics Lab
8
# La Jolla, CA 92037, USA
10
# Copyright: Daniel Stoffler, Michel Sanner and TSRI
12
# revision: Guillaume Vareille
14
#########################################################################
16
# $Header: /opt/cvs/python/packages/share1.5/Vision/doc/Examples/matplotlib/Legend_net_1.py,v 1.2 2007/08/29 20:37:16 vareille Exp $
18
# $Id: Legend_net_1.py,v 1.2 2007/08/29 20:37:16 vareille Exp $
21
from traceback import print_exc
22
## loading libraries ##
23
from Vision.matplotlibNodes import matplotliblib
24
masterNet.getEditor().addLibraryInstance(matplotliblib,"Vision.matplotlibNodes", "matplotliblib")
26
from Vision.StandardNodes import stdlib
27
masterNet.getEditor().addLibraryInstance(stdlib,"Vision.StandardNodes", "stdlib")
30
## saving node ReadTable ##
31
from Vision.StandardNodes import ReadTable
32
ReadTable_0 = ReadTable(constrkw = {}, name='ReadTable', library=stdlib)
33
masterNet.addNode(ReadTable_0,138,9)
34
ReadTable_0.inputPortByName['filename'].widget.set("Vision/Examples/matplotlib/Data/legend_data.dat", run=False)
35
ReadTable_0.inputPortByName['sep'].widget.set(",", run=False)
36
ReadTable_0.inputPortByName['datatype'].widget.set("float", run=False)
37
apply(ReadTable_0.configure, (), {'expanded': True})
39
print "WARNING: failed to restore ReadTable named ReadTable in network masterNet"
44
## saving node Plot ##
45
from Vision.matplotlibNodes import PlotNE
46
Plot_1 = PlotNE(constrkw = {}, name='Plot', library=matplotliblib)
47
masterNet.addNode(Plot_1,4,321)
48
Plot_1.inputPortByName['lineStyle'].widget.set("dotted", run=False)
49
apply(Plot_1.configure, (), {'expanded': True})
51
print "WARNING: failed to restore PlotNE named Plot in network masterNet"
56
## saving node Index ##
57
from Vision.StandardNodes import Index
58
Index_2 = Index(constrkw = {}, name='Index', library=stdlib)
59
masterNet.addNode(Index_2,17,153)
60
apply(Index_2.inputPortByName['index'].widget.configure, (), {'max': 3})
61
Index_2.inputPortByName['index'].widget.set(2, run=False)
62
apply(Index_2.configure, (), {'expanded': True})
64
print "WARNING: failed to restore Index named Index in network masterNet"
69
## saving node Index ##
70
from Vision.StandardNodes import Index
71
Index_3 = Index(constrkw = {}, name='Index', library=stdlib)
72
masterNet.addNode(Index_3,173,151)
73
apply(Index_3.inputPortByName['index'].widget.configure, (), {'max': 3})
74
Index_3.inputPortByName['index'].widget.set(3, run=False)
75
apply(Index_3.configure, (), {'expanded': True})
77
print "WARNING: failed to restore Index named Index in network masterNet"
82
## saving node Plot ##
83
from Vision.matplotlibNodes import PlotNE
84
Plot_4 = PlotNE(constrkw = {}, name='Plot', library=matplotliblib)
85
masterNet.addNode(Plot_4,172,320)
86
Plot_4.inputPortByName['lineStyle'].widget.set("dashed", run=False)
87
apply(Plot_4.configure, (), {'expanded': True})
89
print "WARNING: failed to restore PlotNE named Plot in network masterNet"
95
from Vision.StandardNodes import Operator2
96
add_5 = Operator2(constrkw = {}, name='add', library=stdlib)
97
masterNet.addNode(add_5,338,221)
98
add_5.inputPortByName['operation'].widget.set("add", run=False)
99
add_5.inputPortByName['applyToElements'].widget.set(1, run=False)
101
print "WARNING: failed to restore Operator2 named add in network masterNet"
106
## saving node Legend ##
107
from Vision.matplotlibNodes import LegendNE
108
Legend_8 = LegendNE(constrkw = {}, name='Legend', library=matplotliblib)
109
masterNet.addNode(Legend_8,497,482)
110
Legend_8.inputPortByName['label'].widget.set("Model length,Data length,Total message length", run=False)
111
Legend_8.inputPortByName['location'].widget.set("upper center", run=False)
112
apply(Legend_8.configure, (), {'expanded': True})
114
print "WARNING: failed to restore LegendNE named Legend in network masterNet"
119
## saving node Set Matplotlib options ##
120
from Vision.matplotlibNodes import MatPlotLibOptions
121
Set_Matplotlib_options_9 = MatPlotLibOptions(constrkw = {}, name='Set Matplotlib options', library=matplotliblib)
122
masterNet.addNode(Set_Matplotlib_options_9,256,530)
123
Set_Matplotlib_options_9.inputPortByName['matplotlibOptions'].widget.set({'legend.shadow': 1}, run=False)
125
print "WARNING: failed to restore MatPlotLibOptions named Set Matplotlib options in network masterNet"
127
Set_Matplotlib_options_9=None
130
## saving node MultiPlot ##
131
from Vision.matplotlibNodes import MultiPlotNE
132
MultiPlot_10 = MultiPlotNE(constrkw = {}, name='MultiPlot', library=matplotliblib)
133
masterNet.addNode(MultiPlot_10,52,548)
135
print "WARNING: failed to restore MultiPlotNE named MultiPlot in network masterNet"
140
## saving node Draw Area ##
141
from Vision.matplotlibNodes import MPLDrawAreaNE
142
Draw_Area_11 = MPLDrawAreaNE(constrkw = {}, name='Draw Area', library=matplotliblib)
143
masterNet.addNode(Draw_Area_11,410,526)
144
Draw_Area_11.inputPortByName['title'].widget.set("Minimum Message Length", run=False)
145
Draw_Area_11.inputPortByName['xlabel'].widget.set("Model complexity -->", run=False)
146
Draw_Area_11.inputPortByName['ylabel'].widget.set("Message Length -->", run=False)
148
print "WARNING: failed to restore MPLDrawAreaNE named Draw Area in network masterNet"
153
## saving node Plot ##
154
from Vision.matplotlibNodes import PlotNE
155
Plot_12 = PlotNE(constrkw = {}, name='Plot', library=matplotliblib)
156
masterNet.addNode(Plot_12,410,364)
158
print "WARNING: failed to restore PlotNE named Plot in network masterNet"
163
## saving node Draw Area ##
164
from Vision.matplotlibNodes import MPLDrawAreaNE
165
Draw_Area_13 = MPLDrawAreaNE(constrkw = {}, name='Draw Area', library=matplotliblib)
166
masterNet.addNode(Draw_Area_13,564,274)
167
Draw_Area_13.inputPortByName['ylimit'].widget.set("[-1,20]", run=False)
169
print "WARNING: failed to restore MPLDrawAreaNE named Draw Area in network masterNet"
175
## saving connections for network Legend ##
176
if ReadTable_0 is not None and Index_2 is not None:
178
masterNet.connectNodes(
179
ReadTable_0, Index_2, "data", "data", blocking=True)
181
print "WARNING: failed to restore connection between ReadTable_0 and Index_2 in network masterNet"
182
if Index_2 is not None and Plot_1 is not None:
184
masterNet.connectNodes(
185
Index_2, Plot_1, "data", "y", blocking=True)
187
print "WARNING: failed to restore connection between Index_2 and Plot_1 in network masterNet"
188
if ReadTable_0 is not None and Index_3 is not None:
190
masterNet.connectNodes(
191
ReadTable_0, Index_3, "data", "data", blocking=True)
193
print "WARNING: failed to restore connection between ReadTable_0 and Index_3 in network masterNet"
194
if Index_3 is not None and Plot_4 is not None:
196
masterNet.connectNodes(
197
Index_3, Plot_4, "data", "y", blocking=True)
199
print "WARNING: failed to restore connection between Index_3 and Plot_4 in network masterNet"
200
if Index_2 is not None and add_5 is not None:
202
masterNet.connectNodes(
203
Index_2, add_5, "data", "data1", blocking=True)
205
print "WARNING: failed to restore connection between Index_2 and add_5 in network masterNet"
206
if Index_3 is not None and add_5 is not None:
208
masterNet.connectNodes(
209
Index_3, add_5, "data", "data2", blocking=True)
211
print "WARNING: failed to restore connection between Index_3 and add_5 in network masterNet"
212
if Plot_1 is not None and MultiPlot_10 is not None:
214
masterNet.connectNodes(
215
Plot_1, MultiPlot_10, "plot", "multiplot", blocking=True)
217
print "WARNING: failed to restore connection between Plot_1 and MultiPlot_10 in network masterNet"
218
if Plot_4 is not None and MultiPlot_10 is not None:
220
masterNet.connectNodes(
221
Plot_4, MultiPlot_10, "plot", "multiplot", blocking=True)
223
print "WARNING: failed to restore connection between Plot_4 and MultiPlot_10 in network masterNet"
224
if Legend_8 is not None and MultiPlot_10 is not None:
226
masterNet.connectNodes(
227
Legend_8, MultiPlot_10, "drawAreaDef", "drawAreaDef", blocking=True)
229
print "WARNING: failed to restore connection between Legend_8 and MultiPlot_10 in network masterNet"
230
if Set_Matplotlib_options_9 is not None and MultiPlot_10 is not None:
232
masterNet.connectNodes(
233
Set_Matplotlib_options_9, MultiPlot_10, "matplotlibOptions", "drawAreaDef", blocking=True)
235
print "WARNING: failed to restore connection between Set_Matplotlib_options_9 and MultiPlot_10 in network masterNet"
236
if Draw_Area_11 is not None and MultiPlot_10 is not None:
238
masterNet.connectNodes(
239
Draw_Area_11, MultiPlot_10, "drawAreaDef", "drawAreaDef", blocking=True)
241
print "WARNING: failed to restore connection between Draw_Area_11 and MultiPlot_10 in network masterNet"
242
if add_5 is not None and Plot_12 is not None:
244
masterNet.connectNodes(
245
add_5, Plot_12, "result", "y", blocking=True)
247
print "WARNING: failed to restore connection between add_5 and Plot_12 in network masterNet"
248
if Plot_12 is not None and MultiPlot_10 is not None:
250
masterNet.connectNodes(
251
Plot_12, MultiPlot_10, "plot", "drawAreaDef", blocking=True)
253
print "WARNING: failed to restore connection between Plot_12 and MultiPlot_10 in network masterNet"
254
if Draw_Area_13 is not None and Plot_12 is not None:
256
masterNet.connectNodes(
257
Draw_Area_13, Plot_12, "drawAreaDef", "drawAreaDef", blocking=True)
259
print "WARNING: failed to restore connection between Draw_Area_13 and Plot_12 in network masterNet"