data = np.loadtxt("Fe_alpha_spectrum.txt")
norm_data, factor = nx.data.Normalize(data,
method = "baseline", # "value", "max", "min", "sum", "mean"
# value = 0, # for value method
#left_point = 0, # left data index
#right_point = 0, # right data index
#poly_order = 0 # Polynominal order for fitting the baseline. Zero for flat baseline and 1 for tilted line correction.
)
fig, (ax1, ax2) = plt.subplots(2, sharex=True)
ax1.plot(data)
ax2.plot(norm_data)
ax1.set(ylabel = "counts")
ax2.set(ylabel = "norm intensity")
ax2.set(xlabel = "channel")
plt.savefig("fig_normalize.png")
plt.show()