Commit 3af54351 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

Repaired fit55

parent b59d542d
......@@ -93,7 +93,7 @@ def get_simulation(q_axis, parameters, polarization, analyzer):
scan.setAbsoluteQResolution(distr, parameters["q_res"])
simulation.beam().setPolarization(polarization)
simulation.setAnalyzerProperties(analyzer, 1, 0.5)
simulation.detector().setAnalyzerProperties(analyzer, 1, 0.5)
simulation.setScan(scan)
return simulation
......
......@@ -34,6 +34,7 @@ from matplotlib import pyplot as plt
import numpy as np
from os import path
import bornagain as ba
import ba_plot
from scipy.optimize import differential_evolution
......@@ -151,7 +152,7 @@ def chi_2(real_data, sim_data, weights):
Computes chi_2 metrics and returns its value
"""
sim_data_upsc = np.multiply(weights, sim_data)
sim_data_upsc[sim_data_upsc is 0] = 1e-30
sim_data_upsc[sim_data_upsc==0] = 1e-30
real_data_upsc = np.multiply(weights, real_data)
diff = real_data_upsc - sim_data_upsc
return np.sum(np.divide(np.multiply(diff, diff), sim_data_upsc))
......@@ -270,7 +271,7 @@ def plot_result(sim_result, ref_result, bin_start=0, bin_end=-1):
get_real_data_values(bin_start, bin_end), sim_result.axis(),
sim_data, ref_result.axis(), ref_data)
xlabel = ba.get_axes_labels(sim_result, ba.Axes.DEFAULT)[0]
xlabel = ba_plot.get_axes_labels(sim_result, ba.Axes.DEFAULT)[0]
ylabel = "Intensity"
plt.xlabel(xlabel, fontsize=16)
plt.ylabel(ylabel, fontsize=16)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment