コード例 #1
0
    def do_stage2(self):
        """
        Our stage 2 is to do the required plotting
        """

        if self.args.resume:
            self.fulldata = self.ostore.retrieve_matrix('.csv')

        simdata = self.fulldata[:, 0:2]
        experdata = np.column_stack((self.fulldata[:, 0], self.fulldata[:, 2]))
        fig = dmplots.plot_sim_fit(simdata, experdata, self.args.current, self.args.z,
                                   self.args.cvf, self.args.direction)
        self.ostore.add_plot(fig, '.png')
コード例 #2
0
ファイル: dmerranalysis.py プロジェクト: KJTsanaktsidis/FYP
    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)


コード例 #3
0
ファイル: compare.py プロジェクト: KJTsanaktsidis/FYP
aparser.add_argument('--cvf', type=float, required=True,
                     help='Vacancy concentration factor')
aparser.add_argument('--direction', type=str, default='forward',
                     help='Direction of application of current')

args = aparser.parse_args()

accelcs = CalcSimWrapper()
dstore = InputDatastore(args.inputdata, args.dataprefix, 973, args.direction)
ce = ComparisonEngine(accelcs)

x = np.linspace(0, 25, num=100)
exper_data = dstore.interpolated_experiment_dict(x)[args.current]
diffusivity = dstore.interpolated_diffusivity(10001)
resistivity = dstore.interpolated_resistivity(10001)
init_cond = np.ones(100)
init_cond[50:] = 0

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

r = accelcs.emigration_factor(args.z, args.current * 100 * 100, emigration_T)
simd = accelcs.calc_simulation(diffusivity, resistivity, init_cond, ndt, dt, dx, r, args.cvf)
lsq, shift = ce.calibrate(simd, exper_data)
shifted_simd = ce.shift_data(simd)
full_simd = np.column_stack((x, shifted_simd))
full_exper = np.column_stack((x, exper_data))
dmplots.plot_sim_fit(full_simd, full_exper, args.current, args.z, args.cvf, args.direction, args.output)
print('lsq = ' + str(lsq))
コード例 #4
0
ファイル: dmsearch.py プロジェクト: KJTsanaktsidis/FYP
        x = np.linspace(0, 25, num=100)
        dstore = InputDatastore(args.inputdata, args.dataprefix)
        edict = dstore.edict_for_direction(direction)
        accelcs = CalcSimWrapper()
        ce = ComparisonEngine(accelcs)
        diffusivity = dstore.interpolated_diffusivity(10001, args.temperature, precise=True)
        resistivity = dstore.interpolated_resistivity(10001, args.temperature)
        init_cond = np.ones(100)
        init_cond[50:] = 0
        emigration_T = args.temperature
        dt = 0.05
        ndt = int(2 * 60 * 60 / 0.05)
        dx = 25e-6 / 100
        for I in result_stash.keys():
            cvf_best = cvfrange[result_stash[I][zaverage_index, :].argmin()]
            if direction == "forward":
                exper_data = dstore.interpolated_experiment_dict(x, edict)[I]
                r = accelcs.emigration_factor(zaverage_rounded, I * 100 * 100, emigration_T)
            else:
                exper_data = dstore.interpolated_experiment_dict(x, edict)[I]
                r = accelcs.emigration_factor(zaverage_rounded, -I * 100 * 100, emigration_T)
            simd = accelcs.calc_simulation(diffusivity, resistivity, init_cond, ndt, dt, dx, r, cvf_best)
            lsq, shift = ce.calibrate(simd, exper_data)
            shifted_simd = ce.shift_data(simd)
            full_simd = np.column_stack((x, shifted_simd))
            full_exper = np.column_stack((x, exper_data))
            outfname = os.path.join(args.outputdir, str.format("SimExperComp_I{}_{}.png", I, direction))
            f = dmplots.plot_sim_fit(full_simd, full_exper, I, zaverage_rounded, cvf_best, direction)
            c = FigureCanvasAgg(f)
            c.print_figure(outfname)