~ubuntu-branches/ubuntu/natty/mgltools-vision/natty

« back to all changes in this revision

Viewing changes to Vision/doc/Examples/matplotlib/Legend_net_1.py

  • Committer: Bazaar Package Importer
  • Author(s): Steffen Moeller
  • Date: 2008-07-31 22:00:08 UTC
  • Revision ID: james.westby@ubuntu.com-20080731220008-broax3qn6pq9ygnb
Tags: upstream-1.5.2.cvs.20080731
ImportĀ upstreamĀ versionĀ 1.5.2.cvs.20080731

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
########################################################################
 
2
#
 
3
#    Vision Network - Python source code - file generated by vision
 
4
#    Thursday 12 April 2007 13:48:35 
 
5
#    
 
6
#       The Scripps Research Institute (TSRI)
 
7
#       Molecular Graphics Lab
 
8
#       La Jolla, CA 92037, USA
 
9
#
 
10
# Copyright: Daniel Stoffler, Michel Sanner and TSRI
 
11
#   
 
12
# revision: Guillaume Vareille
 
13
#  
 
14
#########################################################################
 
15
#
 
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 $
 
17
#
 
18
# $Id: Legend_net_1.py,v 1.2 2007/08/29 20:37:16 vareille Exp $
 
19
#
 
20
 
 
21
from traceback import print_exc
 
22
## loading libraries ##
 
23
from Vision.matplotlibNodes import matplotliblib
 
24
masterNet.getEditor().addLibraryInstance(matplotliblib,"Vision.matplotlibNodes", "matplotliblib")
 
25
 
 
26
from Vision.StandardNodes import stdlib
 
27
masterNet.getEditor().addLibraryInstance(stdlib,"Vision.StandardNodes", "stdlib")
 
28
 
 
29
try:
 
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})
 
38
except:
 
39
    print "WARNING: failed to restore ReadTable named ReadTable in network masterNet"
 
40
    print_exc()
 
41
    ReadTable_0=None
 
42
 
 
43
try:
 
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})
 
50
except:
 
51
    print "WARNING: failed to restore PlotNE named Plot in network masterNet"
 
52
    print_exc()
 
53
    Plot_1=None
 
54
 
 
55
try:
 
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})
 
63
except:
 
64
    print "WARNING: failed to restore Index named Index in network masterNet"
 
65
    print_exc()
 
66
    Index_2=None
 
67
 
 
68
try:
 
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})
 
76
except:
 
77
    print "WARNING: failed to restore Index named Index in network masterNet"
 
78
    print_exc()
 
79
    Index_3=None
 
80
 
 
81
try:
 
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})
 
88
except:
 
89
    print "WARNING: failed to restore PlotNE named Plot in network masterNet"
 
90
    print_exc()
 
91
    Plot_4=None
 
92
 
 
93
try:
 
94
    ## saving node add ##
 
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)
 
100
except:
 
101
    print "WARNING: failed to restore Operator2 named add in network masterNet"
 
102
    print_exc()
 
103
    add_5=None
 
104
 
 
105
try:
 
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})
 
113
except:
 
114
    print "WARNING: failed to restore LegendNE named Legend in network masterNet"
 
115
    print_exc()
 
116
    Legend_8=None
 
117
 
 
118
try:
 
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)
 
124
except:
 
125
    print "WARNING: failed to restore MatPlotLibOptions named Set Matplotlib options in network masterNet"
 
126
    print_exc()
 
127
    Set_Matplotlib_options_9=None
 
128
 
 
129
try:
 
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)
 
134
except:
 
135
    print "WARNING: failed to restore MultiPlotNE named MultiPlot in network masterNet"
 
136
    print_exc()
 
137
    MultiPlot_10=None
 
138
 
 
139
try:
 
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)
 
147
except:
 
148
    print "WARNING: failed to restore MPLDrawAreaNE named Draw Area in network masterNet"
 
149
    print_exc()
 
150
    Draw_Area_11=None
 
151
 
 
152
try:
 
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)
 
157
except:
 
158
    print "WARNING: failed to restore PlotNE named Plot in network masterNet"
 
159
    print_exc()
 
160
    Plot_12=None
 
161
 
 
162
try:
 
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)
 
168
except:
 
169
    print "WARNING: failed to restore MPLDrawAreaNE named Draw Area in network masterNet"
 
170
    print_exc()
 
171
    Draw_Area_13=None
 
172
 
 
173
masterNet.freeze()
 
174
 
 
175
## saving connections for network Legend ##
 
176
if ReadTable_0 is not None and Index_2 is not None:
 
177
    try:
 
178
        masterNet.connectNodes(
 
179
            ReadTable_0, Index_2, "data", "data", blocking=True)
 
180
    except:
 
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:
 
183
    try:
 
184
        masterNet.connectNodes(
 
185
            Index_2, Plot_1, "data", "y", blocking=True)
 
186
    except:
 
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:
 
189
    try:
 
190
        masterNet.connectNodes(
 
191
            ReadTable_0, Index_3, "data", "data", blocking=True)
 
192
    except:
 
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:
 
195
    try:
 
196
        masterNet.connectNodes(
 
197
            Index_3, Plot_4, "data", "y", blocking=True)
 
198
    except:
 
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:
 
201
    try:
 
202
        masterNet.connectNodes(
 
203
            Index_2, add_5, "data", "data1", blocking=True)
 
204
    except:
 
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:
 
207
    try:
 
208
        masterNet.connectNodes(
 
209
            Index_3, add_5, "data", "data2", blocking=True)
 
210
    except:
 
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:
 
213
    try:
 
214
        masterNet.connectNodes(
 
215
            Plot_1, MultiPlot_10, "plot", "multiplot", blocking=True)
 
216
    except:
 
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:
 
219
    try:
 
220
        masterNet.connectNodes(
 
221
            Plot_4, MultiPlot_10, "plot", "multiplot", blocking=True)
 
222
    except:
 
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:
 
225
    try:
 
226
        masterNet.connectNodes(
 
227
            Legend_8, MultiPlot_10, "drawAreaDef", "drawAreaDef", blocking=True)
 
228
    except:
 
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:
 
231
    try:
 
232
        masterNet.connectNodes(
 
233
            Set_Matplotlib_options_9, MultiPlot_10, "matplotlibOptions", "drawAreaDef", blocking=True)
 
234
    except:
 
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:
 
237
    try:
 
238
        masterNet.connectNodes(
 
239
            Draw_Area_11, MultiPlot_10, "drawAreaDef", "drawAreaDef", blocking=True)
 
240
    except:
 
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:
 
243
    try:
 
244
        masterNet.connectNodes(
 
245
            add_5, Plot_12, "result", "y", blocking=True)
 
246
    except:
 
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:
 
249
    try:
 
250
        masterNet.connectNodes(
 
251
            Plot_12, MultiPlot_10, "plot", "drawAreaDef", blocking=True)
 
252
    except:
 
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:
 
255
    try:
 
256
        masterNet.connectNodes(
 
257
            Draw_Area_13, Plot_12, "drawAreaDef", "drawAreaDef", blocking=True)
 
258
    except:
 
259
        print "WARNING: failed to restore connection between Draw_Area_13 and Plot_12 in network masterNet"
 
260
masterNet.unfreeze()
 
261
#masterNet.run()
 
262