I have a weighted histogram generated by
import numpy as np
import matplotlib.pyplot as plt
data = np.loadtxt('count_rate_data.txt')
hist_bin = [118,121,124,127,130,133,136,139,142,145,148,151,154,157,160,163,166,169,172,175,178,181,184,187,189]
weights=np.ones_like(data)/float(len(data))
plt.hist(data, hist_bin, weights=weights)
plt.grid()
plt.show()
I would like to fit a normal distribution that is weighted to the same extent. How do I do that? I know how to fit a normal distribution to an unweighted histogram. But I am unsure how to fit a normal histogram to a weighted histogram.