Professional Documents
Culture Documents
Chato Solutions_ Decline curve fitting with python
Chato Solutions_ Decline curve fitting with python
AUTHOR
PUBLISHED CITATION
Non linear regression is a tool to find parameter from decline curves models, In this example we show you
how use curve_fit() function from scipy package in python. First loading the data and plot to analize its
behavior
import pandas as pd
data = pd.read_csv('REH_18.csv')
data
DAYS RATE
0 1 2.30000
1 2 3.00000
2 3 3.20000
3 4 3.00000
4 5 3.20000
.. ... ...
475 476 0.76237
476 477 0.66001
477 478 0.23185
478 479 0.26329
479 480 0.50926
plt.scatter(DAYS,RATE);
plt.xlabel('Days');
plt.ylabel('Qg');
plt.show();
Hyperbolic decline
qi
qt =
1/b
(1 + bDi t)
Fist, the equation to fit the data has to be defined as a python function. The parameter getting from fitting
are the equation coefficiente and the coefficiente with a confidence interval.
def hyperbolic(t,qi,b,Di):
return qi/((1+b*Di*t)**(1/b))
print(coef)
print(coef_ic)
https://www.chatosolutions.com/posts/2022-02-05-hyppy/ 2/4
7/29/23, 11:30 AM Chato Solutions: Decline curve fitting with python
Now, the predicted prodcution rate can be calculate using fitting parameters
plt.rcParams["figure.figsize"]=20,10;
plt.scatter(DAYS, RATE);
plt.plot(DAYS,hyp_pred, color = "red", linewidth = 4);
plt.xlabel("Days");
plt.ylabel("Qg");
plt.show("");
Buy me a coffee
0 Comments Share:
https://www.chatosolutions.com/posts/2022-02-05-hyppy/ 3/4
7/29/23, 11:30 AM Chato Solutions: Decline curve fitting with python
Citation
For attribution, please cite this work as
Vazquez (2022, Feb. 5). Chato Solutions: Decline curve fitting with python. Retrieved from
https://www.chatosolutions.com/posts/2022-02-05-hyppy/
BibTeX citation
@misc{vazquez2022decline,
author = {Vazquez, Rigoberto Chandomi},
title = {Chato Solutions: Decline curve fitting with python},
url = {https://www.chatosolutions.com/posts/2022-02-05-hyppy/},
year = {2022}
}
https://www.chatosolutions.com/posts/2022-02-05-hyppy/ 4/4