Skip to content
Snippets Groups Projects
Commit 7e3088eb authored by Andrey Aristov's avatar Andrey Aristov
Browse files

change index to ng

parent 26439f86
No related branches found
No related tags found
1 merge request!5fix testing and stuff
......@@ -268,14 +268,16 @@ def hill(x, n, K):
def erf_fun(x, a, b):
return ((1 + erf(a * (x - b))) / 2)
def fit_sigmoid(probs, ax, fun=sigmoid, fit_name='sigmoid', p0=(2., -2.)):
def fit_sigmoid(probs, ax=None, fun=sigmoid, fit_name='sigmoid', p0=(2., -2.)):
probs = probs.copy()
vector = probs.index
vector = probs.ng
# print(vector)
# probs.loc[:, 'negative'] = 1 - probs.positive
popt, pcov = curve_fit(fun, vector, probs.q, p0=p0)
a, b = popt
da, db = np.sqrt(np.diag(pcov))
if ax is None:
fig, ax = plt.subplots()
ax.plot(vector, probs.q, '.', label='data')
ax.plot((x := sorted(vector)), fun(x, *popt), lw=10, alpha=.5, label=f'{fit_name} fit')
plt.legend()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment