Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. def calc_exponential_decline(p0, exp, time):
  2. return p0 * np.exp(-exp * time)
  3.  
  4. def calc_two_stage_decline(p0, exp_stage_zero, exp_stage_one, time_max, time_next_stage, time_min=0.,
  5. production_jumpfactor=4., num=50, noise=0.1, noise_mean=1.):
  6. time = np.linspace(time_min, time_max, num)
  7. stage_one = np.where(time > time_next_stage)
  8. production = calc_exponential_decline(p0, exp_stage_zero, time) * np.random.normal(noise_mean, noise, time.shape)
  9. time_stage_one_relative = np.linspace(time_min, time_max-time_next_stage, len(time[stage_one]))
  10. production[stage_one] = calc_exponential_decline(production[stage_one][0] + p0/production_jumpfactor, exp_stage_one,
  11. time_stage_one_relative) * np.random.normal(noise_mean, noise*2., time_stage_one_relative.shape)
  12. stage = np.zeros_like(time)
  13. stage[stage_one] = 1.
  14. production[production < 0.] = 0.
  15. return time, production, stage
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement