"""Independent continuous one-zone calculation. No App/Engine import or VICE execution.""" import math import numpy as np from scipy.integrate import quad,solve_ivp from scipy.optimize import brentq def histories(t,p): tau=p['tau'];mass=p['formedMass'];burst=p['burstFraction'] return mass*(1-burst)*math.exp(-t/tau)/(tau*(-math.expm1(-8/tau)))+mass*burst*math.exp(-.5*((t-3.7)/.2)**2)/(.2*math.sqrt(2*math.pi)),p['inflowPeak']*math.exp(-.5*((t-3)/.3)**2) def formed(t,p):return p['formedMass']*(1-p['burstFraction'])*(-math.expm1(-t/p['tau']))/(-math.expm1(-8/p['tau']))+p['formedMass']*p['burstFraction']*.5*(math.erf((t-3.7)/(.2*math.sqrt(2)))-math.erf(-3.7/(.2*math.sqrt(2)))) def incoming(t,p):return p['inflowPeak']*.3*math.sqrt(math.pi/2)*(math.erf((t-3)/(.3*math.sqrt(2)))-math.erf(-3/(.3*math.sqrt(2)))) def delay_cdf(t): if t<=.15:return 0. if t>=15:return 1. return (.15**-.1-t**-.1)/(.15**-.1-15**-.1) def response(t,p,tight=False): if t<=.15:return 0. A=.1/(.15**-.1-15**-.1);points=[u for u in [t-4.1,t-3.7,t-3.3]if .15