예제 #1
0
    ebars_list_lower.append(cbounds[I][0])
    ebars_list_upper.append(cbounds[I][2])
ebars = np.array([ebars_list_lower, ebars_list_upper])
plot_data = np.column_stack((I_plot, cvf_plot))
outfile = path.join(args.outputdir, 'cvfplot_combined.png')
print(I_plot)
print(ebars)
dmplots.plot_cvf_function_ebars(plot_data, ebars, 'combined', outfile)

#and politely output simulations
for direction in ('forward', 'reverse'):
    for I in cresults.keys():
        for idx, edge in ((0, 'lower'), (1, 'best'), (2, 'upper')):
            outfile = path.join(args.outputdir, str.format('Comparison_I{}_{}_{}bound.png', I, direction, edge))
            cvf = cbounds[I][1]
            if idx == 0:
                cvf -= cbounds[I][idx]
            elif idx == 2:
                cvf += cbounds[I][idx]
            print('using cvf = ' + str(cvf))
            edict = dstore.edict_for_direction(direction)
            exper = dstore.interpolated_experiment_dict(x, edict)[I]
            simd, lsq = quicksim(zaverage_rounded, cvf, I, exper, direction)
            simd = np.column_stack((x, simd))
            exper = np.column_stack((x, exper))
            f = dmplots.plot_sim_fit(simd, exper, I, zaverage_rounded, cvf, direction)
            c = FigureCanvasAgg(f)
            c.print_figure(outfile)


예제 #2
0
#!/bin/bash

from datastore import InputDatastore
from calcsim import CalcSimWrapper 
from numpy import *
from scipy.optimize import *
from expercomparison import ComparisonEngine
from itertools import product

ds = InputDatastore('../InputData', 'NiCu')
x = linspace(0, 25, num=100)
fedict = ds.edict_for_direction('forward')
redict = ds.edict_for_direction('reverse')
fexpr = ds.interpolated_experiment_dict(x, fedict)
rexpr = ds.interpolated_experiment_dict(x, redict)
diffusivity = ds.interpolated_diffusivity(1001, 973)
resistivity = ds.interpolated_resistivity(1001, 973)

cs = CalcSimWrapper()
ce = ComparisonEngine(cs)
initcond = ones(100)
initcond[50:] = 0


dt = 0.05
ndt = int(2 * 60 * 60 / 0.05)
dx = 25e-6 / 100

def make_objective(I, direction):
    if direction == 'forward':
        exprd = fexpr[I]
예제 #3
0
    if condition[0]:
        # If the start of condition is True prepend a 0
        idx = np.r_[0, idx]

    if condition[-1]:
        # If the end of condition is True, append the length of the array
        idx = np.r_[idx, condition.size] # Edit

    # Reshape the result into two columns
    idx.shape = (-1, 2)
    return idx

results = {}

for direct in ('forward', 'reverse'):
    edict = ds.edict_for_direction(direct)
    results[direct] = {}
    for I in edict.keys():
        #sres = psearch.search(zrange, cvfrange, I, T, update_pbar, direct)
        #savetxt(get_fname('{}_I{}.csv'.format(direct, I)), sres, delimiter=',')
        sres = genfromtxt(get_fname('{}_I{}.csv'.format(direct, I)), delimiter=',')

        results[direct][I] = sres
        plot_search_map(sres, (zrange[0], zrange[-1]), (cvfrange[0], cvfrange[-1]), I, direct,
                        get_fname('{}_I{}.png'.format(direct, I)))

results['combined'] = {}
zs = []
for I in results['forward'].keys():
    results['combined'][I] = results['forward'][I] * results['reverse'][I]
    savetxt(get_fname('{}_I{}.csv'.format('combined', I)), results['combined'][I], delimiter=',')