- Timestamp:
- Mar 8, 2015 9:32:55 AM (6 years ago)
- Location:
- branches/uq
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/uq/gui/scripts/Makefile.in
r5029 r5102 123 123 $(srcdir)/units.tcl \ 124 124 $(srcdir)/utils.tcl \ 125 $(srcdir)/uq.tcl \ 125 126 $(srcdir)/valueresult.tcl \ 126 127 $(srcdir)/videochooser.tcl \ -
branches/uq/gui/scripts/analyzer.tcl
r5029 r5102 79 79 protected method _lammpsToSequence {xmlobj path id child data} 80 80 protected method _trajToSequence {xmlobj {path ""}} 81 protected method _pop_uq_dialog {win} 82 protected method _setWaitVariable {state} 83 protected method _adjust_level {win} 81 84 82 85 private variable _tool "" ;# belongs to this tool … … 92 95 private variable _lastPlot 93 96 private common job ;# array var used for blt::bgexec jobs 97 private variable _wait_uq 0 94 98 } 95 99 … … 324 328 } 325 329 pack $itk_component(resultpages) -expand yes -fill both 326 327 set f [$itk_component(results) insert end -fraction 0.1] 330 set f [$itk_component(results) insert end -fraction 0.1] 328 331 itk_component add resultselector { 329 332 Rappture::ResultSelector $f.rsel -resultset $_resultset \ … … 404 407 } 405 408 puts "simulation needed" 409 410 set uq [$_tool get_uq -uq_type smolyak -uq_args 2] 411 # pop up UQ window 412 if {[$uq num_runs] > 1} { 413 set status [$uq run_dialog $itk_component(simulate)] 414 if {$status == 0} { 415 # cancelled 416 return 417 } 418 } 419 420 puts "args=$args" 421 lappend args -uq_type [$uq type] 422 lappend args -uq_args [$uq args] 423 puts "args=$args" 424 406 425 # simulation is needed -- go to simulation page 407 426 $itk_component(notebook) current simulate … … 468 487 pack forget $itk_component(progress) 469 488 } 489 470 490 471 491 # ---------------------------------------------------------------------- -
branches/uq/gui/scripts/probdisteditor.tcl
r5029 r5102 300 300 set max $_umax 301 301 } else { 302 set min [Rappture::Units::convert $_umin -units off] 303 set max [Rappture::Units::convert $_umax -units off] 302 if {$_umin == ""} { 303 set min "" 304 } else { 305 set min [Rappture::Units::convert $_umin -units off] 306 } 307 if {$_umax == ""} { 308 set max "" 309 } else { 310 set max [Rappture::Units::convert $_umax -units off] 311 } 304 312 } 305 313 … … 318 326 uniform { 319 327 if {![info exists _value(min)] || ![info exists _value(max)]} { 328 puts "UNIFORM min=$min max$max" 320 329 if {$min != "" && $max != ""} { 321 330 set _value(min) $min 322 331 set _value(max) $max 323 } elseif {[info exists _value(central)]} { 324 if {$_value(central) == 0.0} { 325 set delta 0.5 326 } else { 327 set delta [expr {0.5*$_value(central)}] 328 } 329 set _value(min) [expr {$_value(central) - $delta}] 330 set _value(max) [expr {$_value(central) + $delta}] 331 } else { 332 set _value(min) 0.1 333 set _value(max) 0.9 332 } elseif {$min != ""} { 333 set _value(min) $min 334 set _value(max) [expr $min + 1] 335 } elseif {$max != ""} { 336 set _value(max) $max 337 set _value(min) [expr $max - 1] 334 338 } 335 339 set _uvalue(min) $_value(min)$_units … … 338 342 } 339 343 gaussian { 340 341 344 if {![info exists _value(central)]} { 342 345 if {[info exists _value(min)] && [info exists _value(max)]} { … … 349 352 if {[info exists _value(min)] && [info exists _value(max)]} { 350 353 set _value(stddev) [expr {0.3*($_value(max) - $_value(min))}] 354 } elseif {$min != "" && $max != ""} { 355 set _value(stddev) [expr {0.3*($max - $min)}] 351 356 } else { 352 set _value(stddev) [expr {0.3*($max - $min)}]357 set _value(stddev) [expr _value(central) * 0.10] 353 358 } 354 359 } … … 630 635 set newval [Rappture::Units::convert [$widget get] -context $_units] 631 636 } 632 if {[catch {Rappture::Units::mcheck_range $newval $_umin $_umax $_units} err]} { 637 puts "widget=$widget" 638 set itk $itk_component(gaussianvals).stddev 639 puts "itk=$itk" 640 if {$widget != $itk && [catch {Rappture::Units::mcheck_range $newval $_umin $_umax $_units} err]} { 633 641 # oops! value is bad -- edit again 634 642 bell -
branches/uq/gui/scripts/spectrum.tcl
r5029 r5102 176 176 # ---------------------------------------------------------------------- 177 177 itcl::body Rappture::Spectrum::get {args} { 178 puts "Spectrum::get $args"179 178 if {[llength $args] == 0} { 180 179 set rlist "" … … 201 200 set value [lindex $args 0] 202 201 203 puts "SPECTRUN GET value=$value units=$units"204 205 202 switch -- [lindex $value 0] { 206 203 gaussian { … … 229 226 } 230 227 } 231 puts "SPECTRUN GET NEW value=$value what=$what" 228 232 229 switch -- $what { 233 230 -color { -
branches/uq/gui/scripts/tool.tcl
r5029 r5102 29 29 return [$_task installdir] 30 30 } 31 public method get_uq {args} { 32 sync ;# sync all widget values to XML 33 puts "Tool::get_uq $args" 34 return [eval $_task get_uq $args] 35 } 31 36 public method run {args} { 32 37 sync ;# sync all widget values to XML … … 58 63 error "bad value \"$xmlobj\": should be Rappture::Library" 59 64 } 60 65 puts "Tool Init2" 61 66 set _task [Rappture::Task ::#auto $xmlobj $installdir \ 62 67 -logger ::Rappture::Logger::log] 63 68 69 puts "Tool Init3" 64 70 # save a reference to the tool XML in the ControlOwner 65 71 set _xmlobj $xmlobj 72 puts "Done with Tool Init" 66 73 } 67 74 -
branches/uq/gui/scripts/units.tcl
r5029 r5102 75 75 76 76 proc Rappture::Units::_check_range {value min max units} { 77 puts "_check_range $value min=$min max=$max units=$units" 77 78 # make sure the value has units 78 79 if {$units != ""} { 79 80 set value [Rappture::Units::convert $value -context $units] 80 81 # for comparisons, remove units 81 set nv [Rappture::Units::convert $value - units off]82 set nv [Rappture::Units::convert $value -context $units -units off] 82 83 # get the units for the value 83 84 set newunits [Rappture::Units::Search::for $value] … … 89 90 if {"" != $units} { 90 91 # compute the minimum in the new units 91 set minv [Rappture::Units::convert $min -to $newunits - units off]92 set minv [Rappture::Units::convert $min -to $newunits -context $units -units off] 92 93 # same, but include units for printing 93 set convMinVal [Rappture::Units::convert $min -to $newunits ]94 set convMinVal [Rappture::Units::convert $min -to $newunits -context $units] 94 95 } else { 95 96 set minv $min … … 103 104 if {"" != $units} { 104 105 # compute the maximum in the new units 105 set maxv [Rappture::Units::convert $max -to $newunits - units off]106 set maxv [Rappture::Units::convert $max -to $newunits -context $units -units off] 106 107 # same, but include units for printing 107 set convMaxVal [Rappture::Units::convert $max -to $newunits ]108 set convMaxVal [Rappture::Units::convert $max -to $newunits -context $units ] 108 109 } else { 109 110 set maxv $max -
branches/uq/lang/tcl/scripts/library.tcl
r5029 r5102 215 215 public method remove {{path ""}} 216 216 public method xml {{path ""}} 217 public method uq_ make_template {}217 public method uq_get_vars {{template 0}} 218 218 219 219 public method diff {libobj} … … 1040 1040 } 1041 1041 1042 1043 # FIXME: get units convert. change varlist to have no units 1044 itcl::body Rappture::LibraryObj::uq_make_template {} { 1042 itcl::body Rappture::LibraryObj::uq_get_vars {{template 0}} { 1045 1043 set varlist "" 1046 1044 set n [$_node selectNodes /run/input//number] … … 1056 1054 -context $units -to $units -units off] 1057 1055 } 1058 $x nodeValue @@[$_n getAttribute id] 1056 if {$template != 0} { 1057 $x nodeValue @@[$_n getAttribute id] 1058 } 1059 1059 lappend varlist [list [$_n getAttribute id] $val] 1060 1060 } -
branches/uq/lang/tcl/scripts/task.tcl
r5030 r5102 13 13 # Copyright (c) 2004-2014 HUBzero Foundation, LLC 14 14 # 15 # See the file "license.terms" for information on usage and 16 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 15 # See the file "license.terms" for information on usage and# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 17 16 # ====================================================================== 18 17 package require BLT … … 29 28 30 29 public method run {args} 30 public method get_uq {args} 31 31 public method abort {} 32 32 public method reset {} … … 115 115 } 116 116 return "" 117 } 118 119 itcl::body Rappture::Task::get_uq {args} { 120 puts "Task::get_uq $args" 121 foreach {path val} $args { 122 if {$path == "-uq_type"} { 123 set uq_type $val 124 } elseif {$path == "-uq_args"} { 125 set uq_args $val 126 } 127 } 128 set varlist [$_xmlobj uq_get_vars] 129 return [Rappture::UQ ::#auto $varlist $uq_type $uq_args] 117 130 } 118 131 … … 160 173 if {$path == "-output"} { 161 174 set _outputcb $val 175 } elseif {$path == "-uq_type"} { 176 set uq_type $val 177 } elseif {$path == "-uq_args"} { 178 set uq_args $val 162 179 } else { 163 180 $_xmlobj put $path.current $val … … 193 210 # This will turn the driver xml into a template 194 211 # and return a list of the UQ variables and their PDFs. 195 set uq_varlist [$_xmlobj uq_ make_template]212 set uq_varlist [$_xmlobj uq_get_vars 1] 196 213 197 214 if {$uq_varlist != ""} { … … 241 258 } else { 242 259 puts "uq_varlist=$uq_varlist" 243 # FIXME. Default to Smolyak level 2, but allow more later.244 260 file delete -force puq 245 set params_file [get_params $file $uq_varlist "smolyak" 2]261 set params_file [get_params $file $uq_varlist $uq_type $uq_args] 246 262 set cmd "submit --runName=puq -l -d $params_file uq.py $cmd @:$tfile" 247 263 } … … 391 407 puts "result=$result" 392 408 if {$uq_varlist != ""} { 393 file delete -force -- new.xml 409 # UQ. Collect data from all jobs and put it in one xml run file. 410 file delete -force -- run_uq.xml 394 411 exec puq_analyze.py puq_[pid].hdf5 395 append result "\n" "=RAPPTURE-RUN=> new.xml"412 append result "\n" "=RAPPTURE-RUN=>run_uq.xml" 396 413 } 397 414 if {[regexp {=RAPPTURE-RUN=>([^\n]+)} $result match file]} { … … 569 586 itcl::body Rappture::Task::get_params {dfile varlist uq_type args} { 570 587 588 puts "tcl get_params $dfile $varlist uq_type=$uq_type args=$args" 571 589 # convert tcl list of variables to json so python can read it 572 590 proc varlist2py {inlist} { … … 597 615 } 598 616 599 puts "varlist=$varlist"600 617 set varlist [varlist2py $varlist] 601 618 set pid [pid] -
branches/uq/lang/tcl/scripts/units.tcl
r5029 r5102 75 75 76 76 proc Rappture::Units::_check_range {value min max units} { 77 puts "_check_range $value min=$min max=$max units=$units" 77 78 # make sure the value has units 78 79 if {$units != ""} { 79 80 set value [Rappture::Units::convert $value -context $units] 80 81 # for comparisons, remove units 81 set nv [Rappture::Units::convert $value - units off]82 set nv [Rappture::Units::convert $value -context $units -units off] 82 83 # get the units for the value 83 84 set newunits [Rappture::Units::Search::for $value] … … 89 90 if {"" != $units} { 90 91 # compute the minimum in the new units 91 set minv [Rappture::Units::convert $min -to $newunits - units off]92 set minv [Rappture::Units::convert $min -to $newunits -context $units -units off] 92 93 # same, but include units for printing 93 set convMinVal [Rappture::Units::convert $min -to $newunits ]94 set convMinVal [Rappture::Units::convert $min -to $newunits -context $units] 94 95 } else { 95 96 set minv $min … … 103 104 if {"" != $units} { 104 105 # compute the maximum in the new units 105 set maxv [Rappture::Units::convert $max -to $newunits - units off]106 set maxv [Rappture::Units::convert $max -to $newunits -context $units -units off] 106 107 # same, but include units for printing 107 set convMaxVal [Rappture::Units::convert $max -to $newunits ]108 set convMaxVal [Rappture::Units::convert $max -to $newunits -context $units ] 108 109 } else { 109 110 set maxv $max
Note: See TracChangeset
for help on using the changeset viewer.