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

« back to all changes in this revision

Viewing changes to Vision/doc/Examples/matplotlib/Histogram_net.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
#    Monday 16 April 2007 13:44:49 
 
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/Histogram_net.py,v 1.3 2007/08/29 20:37:16 vareille Exp $
 
17
#
 
18
# $Id: Histogram_net.py,v 1.3 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 Histogram ##
 
31
    from Vision.matplotlibNodes import HistogramNE
 
32
    Histogram_8 = HistogramNE(constrkw = {}, name='Histogram', library=matplotliblib)
 
33
    masterNet.addNode(Histogram_8,33,377)
 
34
    Histogram_8.inputPortByName['bins'].widget.set(50, run=False)
 
35
    Histogram_8.inputPortByName['patch_facecolor'].widget.set("green", run=False)
 
36
    apply(Histogram_8.configure, (), {'expanded': True})
 
37
except:
 
38
    print "WARNING: failed to restore HistogramNE named Histogram in network masterNet"
 
39
    print_exc()
 
40
    Histogram_8=None
 
41
 
 
42
try:
 
43
    ## saving node Draw Area ##
 
44
    from Vision.matplotlibNodes import MPLDrawAreaNE
 
45
    Draw_Area_9 = MPLDrawAreaNE(constrkw = {}, name='Draw Area', library=matplotliblib)
 
46
    masterNet.addNode(Draw_Area_9,119,326)
 
47
except:
 
48
    print "WARNING: failed to restore MPLDrawAreaNE named Draw Area in network masterNet"
 
49
    print_exc()
 
50
    Draw_Area_9=None
 
51
 
 
52
try:
 
53
    ## saving node ReadTable ##
 
54
    from Vision.StandardNodes import ReadTable
 
55
    ReadTable_10 = ReadTable(constrkw = {}, name='ReadTable', library=stdlib)
 
56
    masterNet.addNode(ReadTable_10,73,7)
 
57
    ReadTable_10.inputPortByName['filename'].widget.set("Data/histogram_data_1.dat", run=False)
 
58
    ReadTable_10.inputPortByName['sep'].widget.set(",", run=False)
 
59
    ReadTable_10.inputPortByName['datatype'].widget.set("float", run=False)
 
60
    apply(ReadTable_10.configure, (), {'expanded': True})
 
61
except:
 
62
    print "WARNING: failed to restore ReadTable named ReadTable in network masterNet"
 
63
    print_exc()
 
64
    ReadTable_10=None
 
65
 
 
66
try:
 
67
    ## saving node Index ##
 
68
    from Vision.StandardNodes import Index
 
69
    Index_11 = Index(constrkw = {}, name='Index', library=stdlib)
 
70
    masterNet.addNode(Index_11,12,208)
 
71
    apply(Index_11.configure, (), {'expanded': True})
 
72
except:
 
73
    print "WARNING: failed to restore Index named Index in network masterNet"
 
74
    print_exc()
 
75
    Index_11=None
 
76
 
 
77
try:
 
78
    ## saving node Plot ##
 
79
    from Vision.matplotlibNodes import PlotNE
 
80
    Plot_12 = PlotNE(constrkw = {}, name='Plot', library=matplotliblib)
 
81
    masterNet.addNode(Plot_12,287,332)
 
82
    Plot_12.inputPortByName['lineStyle'].widget.set("dashed", run=False)
 
83
    Plot_12.inputPortByName['color'].widget.set("red", run=False)
 
84
    apply(Plot_12.configure, (), {'expanded': True})
 
85
except:
 
86
    print "WARNING: failed to restore PlotNE named Plot in network masterNet"
 
87
    print_exc()
 
88
    Plot_12=None
 
89
 
 
90
try:
 
91
    ## saving node Index ##
 
92
    from Vision.StandardNodes import Index
 
93
    Index_13 = Index(constrkw = {}, name='Index', library=stdlib)
 
94
    masterNet.addNode(Index_13,163,197)
 
95
    apply(Index_13.inputPortByName['index'].widget.configure, (), {'max': 2})
 
96
    Index_13.inputPortByName['index'].widget.set(1, run=False)
 
97
    apply(Index_13.configure, (), {'expanded': True})
 
98
except:
 
99
    print "WARNING: failed to restore Index named Index in network masterNet"
 
100
    print_exc()
 
101
    Index_13=None
 
102
 
 
103
try:
 
104
    ## saving node Index ##
 
105
    from Vision.StandardNodes import Index
 
106
    Index_14 = Index(constrkw = {}, name='Index', library=stdlib)
 
107
    masterNet.addNode(Index_14,325,191)
 
108
    apply(Index_14.inputPortByName['index'].widget.configure, (), {'max': 2})
 
109
    Index_14.inputPortByName['index'].widget.set(2, run=False)
 
110
    apply(Index_14.configure, (), {'expanded': True})
 
111
except:
 
112
    print "WARNING: failed to restore Index named Index in network masterNet"
 
113
    print_exc()
 
114
    Index_14=None
 
115
 
 
116
try:
 
117
    ## saving node MultiPlot ##
 
118
    from Vision.matplotlibNodes import MultiPlotNE
 
119
    MultiPlot_15 = MultiPlotNE(constrkw = {}, name='MultiPlot', library=matplotliblib)
 
120
    masterNet.addNode(MultiPlot_15,185,515)
 
121
except:
 
122
    print "WARNING: failed to restore MultiPlotNE named MultiPlot in network masterNet"
 
123
    print_exc()
 
124
    MultiPlot_15=None
 
125
 
 
126
masterNet.freeze()
 
127
 
 
128
## saving connections for network Histogram ##
 
129
if Draw_Area_9 is not None and Histogram_8 is not None:
 
130
    try:
 
131
        masterNet.connectNodes(
 
132
            Draw_Area_9, Histogram_8, "drawAreaDef", "drawAreaDef", blocking=True)
 
133
    except:
 
134
        print "WARNING: failed to restore connection between Draw_Area_9 and Histogram_8 in network masterNet"
 
135
if ReadTable_10 is not None and Index_11 is not None:
 
136
    try:
 
137
        masterNet.connectNodes(
 
138
            ReadTable_10, Index_11, "data", "data", blocking=True)
 
139
    except:
 
140
        print "WARNING: failed to restore connection between ReadTable_10 and Index_11 in network masterNet"
 
141
if Index_11 is not None and Histogram_8 is not None:
 
142
    try:
 
143
        masterNet.connectNodes(
 
144
            Index_11, Histogram_8, "data", "values", blocking=True)
 
145
    except:
 
146
        print "WARNING: failed to restore connection between Index_11 and Histogram_8 in network masterNet"
 
147
if ReadTable_10 is not None and Index_13 is not None:
 
148
    try:
 
149
        masterNet.connectNodes(
 
150
            ReadTable_10, Index_13, "data", "data", blocking=True)
 
151
    except:
 
152
        print "WARNING: failed to restore connection between ReadTable_10 and Index_13 in network masterNet"
 
153
if ReadTable_10 is not None and Index_14 is not None:
 
154
    try:
 
155
        masterNet.connectNodes(
 
156
            ReadTable_10, Index_14, "data", "data", blocking=True)
 
157
    except:
 
158
        print "WARNING: failed to restore connection between ReadTable_10 and Index_14 in network masterNet"
 
159
if Index_14 is not None and Plot_12 is not None:
 
160
    try:
 
161
        masterNet.connectNodes(
 
162
            Index_14, Plot_12, "data", "x", blocking=True)
 
163
    except:
 
164
        print "WARNING: failed to restore connection between Index_14 and Plot_12 in network masterNet"
 
165
if Index_13 is not None and Plot_12 is not None:
 
166
    try:
 
167
        masterNet.connectNodes(
 
168
            Index_13, Plot_12, "data", "y", blocking=True)
 
169
    except:
 
170
        print "WARNING: failed to restore connection between Index_13 and Plot_12 in network masterNet"
 
171
if Histogram_8 is not None and MultiPlot_15 is not None:
 
172
    try:
 
173
        masterNet.connectNodes(
 
174
            Histogram_8, MultiPlot_15, "plot", "multiplot", blocking=True)
 
175
    except:
 
176
        print "WARNING: failed to restore connection between Histogram_8 and MultiPlot_15 in network masterNet"
 
177
if Plot_12 is not None and MultiPlot_15 is not None:
 
178
    try:
 
179
        masterNet.connectNodes(
 
180
            Plot_12, MultiPlot_15, "plot", "multiplot", blocking=True)
 
181
    except:
 
182
        print "WARNING: failed to restore connection between Plot_12 and MultiPlot_15 in network masterNet"
 
183
masterNet.unfreeze()
 
184
#masterNet.run()
 
185