Skip to content

Instantly share code, notes, and snippets.

@kperry2215
Last active July 4, 2019 22:43
Show Gist options
  • Save kperry2215/214340e628f18e6f16dd87bc92fd3df4 to your computer and use it in GitHub Desktop.
Save kperry2215/214340e628f18e6f16dd87bc92fd3df4 to your computer and use it in GitHub Desktop.
#Get the highest value of production in the first three months of production, to use as qi value
qi=get_max_initial_production(production_time_series, 3, desired_product_type, 'ReportDate')
#Exponential curve fit the data to get best fit equation
popt_exp, pcov_exp=curve_fit(exponential_equation, production_time_series['Days_Online'],
production_time_series[desired_product_type],
bounds=(0, [qi,20]))
print('Exponential Fit Curve-fitted Variables: qi='+str(popt_exp[0])+
', di='+str(popt_exp[1]))
#Hyperbolic curve fit the data to get best fit equation
popt_hyp, pcov_hyp=curve_fit(hyperbolic_equation, production_time_series['Days_Online'],
production_time_series[desired_product_type],
bounds=(0, [qi,2,20]))
print('Hyperbolic Fit Curve-fitted Variables: qi='+str(popt_hyp[0])+
', b='+str(popt_hyp[1])+', di='+str(popt_hyp[2]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment