Beispiel #1
0
    d2 = int(sys.argv[3])
    o = int(sys.argv[4])

    if os.path.exists('pnames.txt'):
        with open('pnames.txt') as f:
            pnames = f.read().splitlines()
    else:
        pnames = ['Param # ' + str(d) for d in [d1, d2]]

    if os.path.exists('outnames.txt'):
        with open('outnames.txt') as f:
            outnames = f.read().splitlines()
            outname = outnames[o]
    else:
        outname = 'Output # ' + str(o)

    print("Plotting %s,%s vs %s" % (pnames[0], pnames[1], outname))

    inputfile = sys.argv[5]
    outputfile = sys.argv[6]

    input = np.loadtxt(inputfile, ndmin=2)
    output = np.loadtxt(outputfile, ndmin=2)

    io.plot_xxy(input[:, d1], input[:, d2], output[:, o],
                [pnames[d1], pnames[d2]], outname)

else:
    print("plot_type not recognized. Exiting.")
    sys.exit()
Beispiel #2
0
    if trval not in results.keys():
        print(trval, " points are not present in results. Exiting.")
        sys.exit()

    for i in range(len(outrange)):

        iout=outrange[i]
        pcf=results['pcmi'][0][iout]
        mindex=results['pcmi'][1][iout]
        #axes_labels=['Model ('+outnames[iout]+')','Polynomial Surrogate']
        print('======== Output # '+str(iout+1) +' (QoI ' +outnames[iout]+') =========')
        print("Plotting model-vs-surrogate at "+trval+" points")
        output=results[trval][2][:,iout]
        input=results[trval][0]
        fig=io.plot_xxy(input[:,d1],input[:,d2],output,pnames, outnames[iout],label=trval+' points',savefig='xxy_'+pnames[d1]+'_'+pnames[d2]+'_'+outnames[iout]+'.eps')


        ngr=100
        #prange=np.loadtxt('prange.dat',ndmin=2)
        #input1_grid_phys=np.linspace(prange[d1,0],prange[d1,1],ngr)
        #input2_grid_phys=np.linspace(prange[d2,0],prange[d2,1],ngr)
        input_grid=np.linspace(-1,1,ngr).reshape(-1,1)
        x,y=np.meshgrid(input_grid,input_grid)
        #xp,yp=np.meshgrid(input1_grid_phys,input2_grid_phys)

        xy=np.vstack([x.ravel(), y.ravel()]).T
        pc_grid=uf.func(xy,'PCmi',[mindex,pcf,pctype]).reshape(ngr,ngr)
        gca().plot_wireframe(x, y, pc_grid, rstride=5,cstride=5,linewidth=0.3)
        #gca().view_init(38,-169)
        fig.savefig('fit_'+pnames[d1]+'_'+pnames[d2]+'_'+outnames[iout]+'_'+trval+'.eps')
Beispiel #3
0
        with open('pnames.txt') as f:
            pnames = f.read().splitlines()
    else:
        pnames = ['Param # ' + str(d) for d in [d1, d2]]

    if os.path.exists('outnames.txt'):
        with open('outnames.txt') as f:
            outnames = f.read().splitlines()
            outname = outnames[o]
    else:
        outname = 'Output # ' + str(o)

    print "Plotting %s,%s vs %s" % (pnames[0], pnames[1], outname)

    inputfile = sys.argv[5]
    outputfile = sys.argv[6]

    input = np.loadtxt(inputfile, ndmin=2)
    output = np.loadtxt(outputfile, ndmin=2)

    io.plot_xxy(input[:, d1],
                input[:, d2],
                output[:, o], [pnames[d1], pnames[d2]],
                outname,
                savefig='xxy_' + pnames[0] + '_' + pnames[1] + '_' + outname +
                '.eps')

else:
    print "plotid not recognized. Exiting."
    sys.exit()