classboston:K=0.22a1=0.02a2=0.022U0=1.@classmethoddefactivity(cls,t):#p(t) = K U0 (e−α1t − e−α2t).# where U0 is the subcutaneous-drug impulse dose in units (U), K is a constant, in dl−1, associated with the amplitude# of the impulse response of p(t), and α1 and α2 are positive constants in min−1 (or s−1, depending on t). The latter# three constants can all be identified from values of the peak absorption time, the peak absorption concentration, and# the overall time of action associated with the pharmacokinetics of insulin, which depends on the the type of insulin# used.returncls.K*cls.U0*(math.exp(-cls.a1*t)-math.exp(-cls.a2*t))@classmethoddefactivityRolling(cls,ts):now=len(ts)s=0fortinrange(0,len(ts)):s+=ts[t]*cls.activity(now-t)returns@classmethoddefiob(cls,t):return((cls.K*cls.U0)/(cls.a1*cls.a2))*(cls.a2*math.exp(-cls.a1*t)-cls.a1*math.exp(-cls.a2*t))defprintc(arr):forainarr:print'\t%s,'%a