Changeset 5103
- Timestamp:
- Mar 8, 2015, 9:34:59 PM (9 years ago)
- Location:
- branches/uq
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/uq/gui/scripts/probdisteditor.tcl
r5102 r5103 326 326 uniform { 327 327 if {![info exists _value(min)] || ![info exists _value(max)]} { 328 puts "UNIFORM min=$min max$max"328 # puts "UNIFORM min=$min max=$max" 329 329 if {$min != "" && $max != ""} { 330 330 set _value(min) $min … … 342 342 } 343 343 gaussian { 344 # puts "GAUSSIAN min=$min max=$max" 344 345 if {![info exists _value(central)]} { 345 346 if {[info exists _value(min)] && [info exists _value(max)]} { … … 349 350 } 350 351 } 352 # puts "central=$_value(central)" 351 353 if {![info exists _value(stddev)]} { 352 354 if {[info exists _value(min)] && [info exists _value(max)]} { … … 355 357 set _value(stddev) [expr {0.3*($max - $min)}] 356 358 } else { 357 set _value(stddev) [expr _value(central) * 0.10] 358 } 359 } 360 359 set _value(stddev) [expr $_value(central) * 0.10] 360 } 361 } 362 if {$_value(stddev) <= 0} { 363 set _value(stddev) 1.0 364 } 365 # puts "stddev=$_value(stddev)" 361 366 # lower bound is -3 deviations or tool min 362 367 set trunc [expr {$_value(central) - 3*$_value(stddev)}] -
branches/uq/gui/scripts/uq.tcl
r5102 r5103 53 53 54 54 label $inner.type.labeltext -text "Level" -font "Arial 9" 55 Rappture::Spinint $inner.type.level -min 2-max 2055 Rappture::Spinint $inner.type.level -min 1 -max 20 56 56 $inner.type.level value $_args 57 57 bind $inner.type.level <<Value>> [itcl::code $this _adjust_level $inner] -
branches/uq/puq/puq_analyze.py
r5029 r5103 1 1 #!/usr/bin/env python 2 from puq import * 2 import sys 3 sys.stdout = open("analyze.out", 'w') 4 sys.stderr = open("analyze.err", 'w') 5 6 import puq 3 7 import csv 4 8 import numpy as np 5 import sys, os, h5py 9 import os, h5py 10 from puq.jpickle import unpickle 11 import xml.etree.ElementTree as xml 6 12 7 13 … … 20 26 sw = load_from_hdf5(sys.argv[1]) 21 27 sw.analyze() 28 29 h5 = h5py.File(sys.argv[1], 'r+') 30 31 32 dtree = xml.parse('run_uq.xml') 33 droot = dtree.getroot() 34 dout = droot.find('output') 35 36 uqtype = h5.attrs['UQtype'] 37 for v in h5[uqtype]: 38 print 'PDF', v 39 rs = unpickle(h5['/%s/%s/response' % (uqtype, v)].value) 40 pdf = rs.pdf(fit=False) 41 42 id = '%s PDF' % v 43 elem = xml.SubElement(dout, 'curve', {'id': id}) 44 about = xml.SubElement(elem, 'about') 45 label = xml.SubElement(about, 'label') 46 label.text = id 47 desc = xml.SubElement(about, 'description') 48 desc.text = "PDF for %s" % id 49 yaxis = xml.SubElement(elem, 'yaxis') 50 label = xml.SubElement(yaxis, 'label') 51 label.text = 'Probability' 52 53 component = xml.SubElement(elem, 'component') 54 xy = xml.SubElement(component, 'xy') 55 pts = "%s 0\n" % pdf.x[0] 56 for x, y in zip(pdf.x, pdf.y): 57 pts += "%s %s\n" % (x, y) 58 pts += "%s 0\n" % pdf.x[-1] 59 xy.text = pts 60 61 with open('run_uq.xml', 'w') as f: 62 f.write("<?xml version=\"1.0\"?>\n") 63 dtree.write(f) 64 65 66 h5.close()
Note: See TracChangeset
for help on using the changeset viewer.