Last change
on this file since 3075 was
711,
checked in by mmc, 17 years ago
|
Fixed the older MoleculeViewer? to work properly with the add/delete
calls needed for the new PyMol?-based viewer.
Disabled the syncCutBuffer stuff in mainwin that used to be used for
copy/paste with desktop. This never worked very well, and we have
the newer upload/download stuff in place now.
A few small tweaks to the graph example and the loader example.
|
File size:
1.2 KB
|
Line | |
---|
1 | # ---------------------------------------------------------------------- |
---|
2 | # GRAPH |
---|
3 | # |
---|
4 | # This simple example shows how you can use the Rappture toolkit |
---|
5 | # to handle I/O for a simple simulator--in this case, one that |
---|
6 | # evaluates an x/y graph |
---|
7 | # |
---|
8 | # ====================================================================== |
---|
9 | # AUTHOR: Michael McLennan, Purdue University |
---|
10 | # Copyright (c) 2004-2005 Purdue Research Foundation |
---|
11 | # |
---|
12 | # See the file "license.terms" for information on usage and |
---|
13 | # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
14 | # ====================================================================== |
---|
15 | |
---|
16 | import Rappture |
---|
17 | import sys |
---|
18 | from math import * |
---|
19 | |
---|
20 | io = Rappture.library(sys.argv[1]) |
---|
21 | |
---|
22 | xmin = float(io.get('input.number(min).current')) |
---|
23 | xmax = float(io.get('input.number(max).current')) |
---|
24 | formula = io.get('input.string(formula).current') |
---|
25 | print 'formula = %s' % formula |
---|
26 | npts = 100 |
---|
27 | |
---|
28 | io.put('output.curve(result).about.label','Formula: Y vs X',append=0) |
---|
29 | io.put('output.curve(result).yaxis.label','Y') |
---|
30 | io.put('output.curve(result).xaxis.label','X') |
---|
31 | |
---|
32 | for i in range(npts): |
---|
33 | x = (xmax-xmin)/npts * i + xmin; |
---|
34 | y = eval(formula) |
---|
35 | io.put('output.curve(result).component.xy', '%g %g\n' % (x,y), append=1) |
---|
36 | |
---|
37 | Rappture.result(io) |
---|
Note: See
TracBrowser
for help on using the repository browser.