def N14_testing_data2():
""" Test the N14 fit with data from file. """
# get the model of the three lorentzian peak, this gives you the
# ability to get the used parameter container for the fit.
mod, params = qudi_fitting.make_multiplelorentzian_model(no_of_functions=3)
# you can insert the whole path with the windows separator
# symbol \ just use the r in front of the string to indicated
# that this is a raw input. The os package will do the rest.
path = os.path.abspath(r'C:\Users\astark\Dropbox\Doctorwork\Software\QuDi-Git\qudi\pulsedODMRdata.csv')
data = np.genfromtxt(path,delimiter=',')
# data = np.loadtxt(path, delimiter=',')
# print(data)
# The data for the fit:
x_axis = data[:,0]*1e8
data_noisy = data[:,1]
result = qudi_fitting.make_N14_fit(x_axis, data_noisy)
print(result.fit_report())
plt.plot(x_axis, data_noisy,'-b', label='data')
plt.plot(x_axis,result.best_fit,'-r', label='best fit result')
plt.plot(x_axis,result.init_fit,'-g',label='initial fit')
# plt.plot(x_axis, data_test,'-k', label='test data')
plt.xlabel('Frequency (Hz)')
plt.ylabel('Counts (#)')
plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
ncol=2, mode="expand", borderaxespad=0.)
plt.show()
评论列表
文章目录