Changeset 5168


Ignore:
Timestamp:
Mar 24, 2015 9:42:08 AM (5 years ago)
Author:
mmh
Message:

cleanup

Location:
branches/uq
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/uq/gui/scripts/analyzer.tcl

    r5166 r5168  
    398398# ----------------------------------------------------------------------
    399399itcl::body Rappture::Analyzer::simulate {args} {
    400     puts "simulate $args"
     400    puts "simulate args='$args'"
    401401    if {$args == "-ifneeded"} {
    402402        # check to see if simulation is really needed
     
    422422    }
    423423
    424     puts "args=$args"
    425424    lappend args -uq_type [$uq type]
    426425    lappend args -uq_args [$uq args]
  • branches/uq/gui/scripts/uq.tcl

    r5103 r5168  
    6363        set nr [num_runs]
    6464        label $fr.text
    65 
    6665
    6766        #     bind $_val <<Value>> [itcl::code $this _change_param_type $inner]
     
    120119itcl::body Rappture::UQ::num_runs {} {
    121120    set numvars  [llength $_varlist]
    122     puts "UQ num_runs $numvars $_type $_args"
     121    # puts "UQ num_runs $numvars $_type $_args"
    123122    if {![array exists _num_pts]} { _init_num_pts_array }
    124123    switch $_type {
  • branches/uq/lang/tcl/scripts/task.tcl

    r5147 r5168  
    3939    protected method _log {args}
    4040    protected method _build_submit_cmd {cmd tfile params_file}
     41    protected method _get_params {varlist uq_type uq_args}
    4142
    4243    private variable _xmlobj ""      ;# XML object with inputs/outputs
     
    6162    # default method for -jobstats control
    6263    public proc MiddlewareTime {args}
    63 
    64     public method get_params {varlist csvname uq_type args}
    6564}
    6665
     
    257256            }
    258257        } else {
    259             set params_file [get_params $file $uq_varlist $uq_type $uq_args]
     258            set params_file [_get_params $uq_varlist $uq_type $uq_args]
    260259            set cmd [_build_submit_cmd $cmd $tfile $params_file]
    261260            file delete -force puq
     
    649648# Send the list of parameters to a python program so it can call PUQ
    650649# and get a CSV file containing the parameter values to use for the runs.
    651 itcl::body Rappture::Task::get_params {dfile varlist uq_type args} {
    652 
    653     puts "tcl get_params $dfile $varlist uq_type=$uq_type args=$args"
     650itcl::body Rappture::Task::_get_params {varlist uq_type uq_args} {
     651    puts "tcl get_params $varlist uq_type=$uq_type args=$uq_args"
    654652    # convert tcl list of variables to json so python can read it
    655653    proc varlist2py {inlist} {
     
    682680    set varlist [varlist2py $varlist]
    683681    set pid [pid]
    684     puts "get_params.py $dfile $pid $varlist $uq_type $args"
    685     exec get_params.py $dfile $pid $varlist $uq_type $args
     682    puts "get_params.py $pid $varlist $uq_type $uq_args"
     683    exec get_params.py $pid $varlist $uq_type $uq_args
    686684    return params[pid].csv
    687685}
  • branches/uq/puq/get_params.py

    r5148 r5168  
    11#!/usr/bin/env python
     2"""
     3This script takes some uq parameters from the command line
     4and starts up a PUQ session using them.  The RapptureHost()
     5class will not actually execute any jobs.  Job parameters
     6are instead saved to a CSV file named params[pid].csv.
     7PUQ status is saved into an hdf5 file, as usual.
     8"""
     9
    210import sys
     11import os
    312from puq import NormalParameter, UniformParameter, Sweep, RapptureHost, Smolyak
    4 import csv, os
    513import numpy as np
    614from puq.jpickle import unpickle
    715
    8 sys.stdout = open("gp.out", 'w')
    9 sys.stderr = open("gp.err", 'w')
     16# Redirect stdout and stderr to files for debugging.
     17sys.stdout = open("uq_debug.out", 'w')
     18sys.stderr = open("uq_debug.err", 'w')
    1019
     20print sys.argv
     21pid, varlist, uq_type, args = sys.argv[1:]
    1122
    12 dfile, pid, varlist, uq_type, args = sys.argv[1:]
     23dfile = "driver%s.xml" % pid
    1324cvsname = "params%s.csv" % pid
    1425hname = "puq_%s.hdf5" % pid
    1526
    16 print sys.argv[1:]
    1727varlist = unpickle(varlist)
    1828print "varlist=", varlist
    19 
    2029
    2130v = {}
     
    3948    sys.exit(1)
    4049
     50# save parameter values to CSV file
    4151vals = np.column_stack([p.values for p in uq.params])
    4252names = ['@@'+str(p.name) for p in uq.params]
    4353np.savetxt(cvsname, vals, delimiter=',', header=','.join(names), comments='')
    4454
    45 sw = Sweep(uq, RapptureHost('puq', dfile), 'test/vel_add.py')
     55# This just saves PUQ state into HDF5 file, so later we can have PUQ analyze
     56# the results and it knows about the input parameters, UQ method, etc.
     57sw = Sweep(uq, RapptureHost('puq', dfile), None)
    4658sw.run(hname, overwrite=True)
     59
     60print "Finished with get_params.py\n"
  • branches/uq/puq/puq_analyze.py

    r5166 r5168  
    11#!/usr/bin/env python
     2"""
     3Once submit has finished with the jobs, this function is called to have PUQ
     4process the results.
     5"""
    26import sys
    37import os
     
    812import xml.etree.ElementTree as xml
    913
    10 sys.stdout = open("analyze.out", 'w')
    11 sys.stderr = open("analyze.err", 'w')
    12 
     14# Redirect stdout and stderr to files for debugging.
     15# Append to the files created in get_params.py
     16sys.stdout = open("uq_debug.out", 'a')
     17sys.stderr = open("uq_debug.err", 'a')
    1318
    1419# Restore the state of a PUQ session from a HDF5 file.
     
    6166        pts += "%s %s\n" % (xarr[0], yp[0])
    6267    xy.text = pts
     68
    6369
    6470def dist(x1,y1, x2,y2, x3,y3): # x3,y3 is the point
Note: See TracChangeset for help on using the changeset viewer.