source: trunk/examples/app-fermi/fermi.py @ 55

Last change on this file since 55 was 55, checked in by dkearney, 16 years ago

python/Rappture/number.py

  • added ability for number to choose between default and current tags
  • changed structure of init so the basePath and the id are separate arguments to keep compatibility with how the driver program expects a number xml structure

python/Rappture/interface.py

  • included a more complete xml structure including tool and command i structures, for writing the xml to the file when the -g option is used
  • adjusted the finish() function to utilize the new Rappture.result() function

examples/app-fermi/fermi_io.py

  • adjusted the Rappture.number() fxn call to split the path and id.
  • commented out the result = [] because we now write the result to xml

examples/app-fermi/fermi.py

  • added output section with curve xml details for writing to xml
  • directly write the results to xml instead of to a result[] array

gui/apps/rerun

  • added script to re-visualize output from previously created run.xml file
File size: 1.2 KB
Line 
1# ----------------------------------------------------------------------
2#  FERMI STATISTICS
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#  computes Fermi-Dirac statistics.
7# ======================================================================
8#  AUTHOR:  Michael McLennan, Purdue University
9#  Copyright (c) 2005  Purdue Research Foundation, West Lafayette, IN
10# ======================================================================
11
12from math import *
13import sys
14import Rappture
15
16import fermi_io
17from fermi_io import *
18
19# do this right at the start, to handle command line args
20Rappture.interface(sys.argv, fermi_io)
21
22kT = 8.61734e-5 * T
23Emin = Ef - 10*kT
24Emax = Ef + 10*kT
25
26E = Emin; dE = 0.005*(Emax-Emin)
27
28Rappture.driver.put("output.curve(f12).about.label", "Fermi-Dirac Factor")
29Rappture.driver.put("output.curve(f12).xaxis.label", "Energy")
30Rappture.driver.put("output.curve(f12).xaxis.units", "eV")
31path = "output.curve(f12).component.xy"
32
33while E < Emax:
34    f = 1.0/(1.0 + exp((E - Ef)/kT))
35    # result.append( [E,f] )
36    value = "%s  %s\n" % (f,E)
37    Rappture.driver.put(path,value,append=1)
38    E += dE
39
Note: See TracBrowser for help on using the repository browser.