Changeset 55 for trunk


Ignore:
Timestamp:
Sep 9, 2005 10:03:21 AM (16 years ago)
Author:
dkearney
Message:

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
Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/app-fermi/fermi.py

    r10 r55  
    2626E = Emin; dE = 0.005*(Emax-Emin)
    2727
     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
    2833while E < Emax:
    2934    f = 1.0/(1.0 + exp((E - Ef)/kT))
    30     result.append( [E,f] )
     35    # result.append( [E,f] )
     36    value = "%s  %s\n" % (f,E)
     37    Rappture.driver.put(path,value,append=1)
    3138    E += dE
     39
  • trunk/examples/app-fermi/fermi_io.py

    r10 r55  
    1818#result = []
    1919
    20 T = Rappture.number('input.temperature', units='K', default=300)
    21 Ef = Rappture.number('input.Ef', units='eV', default=-5.5)
     20T = Rappture.number('input', id="temperature", units='K', default=300)
     21Ef = Rappture.number('input', id="Ef", units='eV', default=-5.5)
    2222
    2323#result = Rappture.table('output.result') \
    2424#           .column('Energy (eV)',units='eV') \
    2525#           .column('Fermi-Dirac Factor')
    26 result = []
     26#result = []
  • trunk/python/Rappture/interface.py

    r9 r55  
    4444            # and interrogating them for symbols.
    4545            #
    46             lib = Rappture.library('<?xml version="1.0"?><run></run>')
     46            lib = Rappture.library('<?xml version="1.0"?><run><tool>' +
     47                    '<about>Press Simulate to view results.</about>' +
     48                    '<command>' +argv[0]+ ' -d @driver</command></tool></run>')
    4749
    4850            for module in args:
     
    7678    representing the entire run.
    7779    """
    78     f = open("run.xml","w")
    79     f.write( Rappture.driver.xml() )
    80     f.close()
     80#    f = open("run.xml","w")
     81#    f.write( Rappture.driver.xml() )
     82#    f.close()
     83
     84    Rappture.result(Rappture.driver)
  • trunk/python/Rappture/number.py

    r9 r55  
    99
    1010class number:
    11     def __init__(self,path,**kwargs):
     11    def __init__(self,path,id,**kwargs):
    1212        """
    1313        Blah, blah...
    1414        """
    1515
    16         self.path = path
     16        self.basePath = path
     17        self.path = path + ".number(" + id + ")"
     18        self.id = id
    1719        self.attribs = kwargs
    1820
     
    2325
    2426    def __coerce__(self,other):
    25         s = Rappture.driver.get(self.path+'.current')
     27        attrList = Rappture.driver.children(self.path, "id")
     28        attrName = 'default'
     29        for attr in attrList:
     30            if attr == 'current':
     31                attrName = attr
     32        s = Rappture.driver.get(self.path+'.'+attrName)
    2633        return (float(s),other)
Note: See TracChangeset for help on using the changeset viewer.