Changeset 5937


Ignore:
Timestamp:
Nov 11, 2015 9:01:05 AM (7 years ago)
Author:
mmh
Message:

for 1d response show sample points

Location:
branches/1.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.4/gui/scripts/responseviewer.tcl

    r5833 r5937  
    167167
    168168    if {$var1 == $var2} {
     169        set path "output.curve(scatter)"
     170        set _dobj [Rappture::Curve ::#auto $xmlobj $path]
     171        Rappture::XyResult $w
     172        $w add $_dobj {-color red}
     173
    169174        set path "output.curve(response)"
    170175        set _dobj [Rappture::Curve ::#auto $xmlobj $path]
    171         Rappture::XyResult $w
     176
    172177    } else {
    173178        set path "output.field(f2d)"
  • branches/1.4/puq/get_response.py

    r5707 r5937  
    4040    resp = unpickle(resp)
    4141    var = None
     42
    4243    for index, p in enumerate(resp.params):
    4344        if p.name == name:
     
    5051
    5152    data = resp.data
    52     print ("vars=", resp.vars)
    53     print("data=", data)
    54     print("my data=", data.T[index])
    55     print("my data=", data[:, index])
     53    print('data=', repr(data))
     54    for ind, p in enumerate(resp.params):
     55        if ind == index:
     56            continue
     57        m = p.pdf.mean
     58        means = np.isclose(m, data[:, ind], rtol=1e-6, atol=1e-12)
     59        data = data[means]
     60
     61    print("vars=", resp.vars)
     62    print("data=", repr(data))
    5663
    5764    curve = xml.SubElement(dout, 'curve', {'id': 'response'})
     
    7481        else:
    7582            allpts[:, i] = np.mean(v.pdf.mean)
    76     print("allpts=", allpts)
     83
    7784    pts = resp.evala(allpts)
    78     print("pts=", pts)
    7985    xy = '\n'.join([' '.join(map(repr, a)) for a in zip(x, pts)])
    8086    comp = xml.SubElement(curve, 'component')
     
    8288
    8389    # scatter plot sampled data on response surface
    84     # curve = io['output.curve(response-%s-scatter)' % name]
    85     # curve['about.label'] = 'Data Points'
    86     # curve['about.group'] = title
    87     # curve['about.type'] = 'scatter'
    88     # curve['xaxis.label'] = varlist[0]
    89     # curve['yaxis.label'] = tname
    90     # curve['component.xy'] = (xdata, ydata)
     90    curve = xml.SubElement(dout, 'curve', {'id': 'scatter'})
     91    about = xml.SubElement(curve, 'about')
     92    xml.SubElement(about, 'label').text = 'Data Points'
     93    xml.SubElement(about, 'group').text = rlabel
     94    xml.SubElement(about, 'type').text = 'scatter'
     95    comp = xml.SubElement(curve, 'component')
     96    xy = '\n'.join([' '.join(map(repr, a)) for a in zip(data[:, index], data[:, -1])])
     97    xml.SubElement(comp, 'xy').text = xy
    9198
    9299
Note: See TracChangeset for help on using the changeset viewer.