```# PC 204 Final Project
# Python 3.4
# Module 2

import math
class B(object):

L1=0    #coefficient 1 for two-compartment model
L2=0    #coefficient 2 for two-compartment model
La=0    #coefficient for oral absorption
lambda1=0   #exponent 1 for two-compartment model
lambda2=0   #exponent 2 for two-compartment model
ka=0    #rate of absorption
tau = 0 #dosing interval

Cp = []

result1 = []
result2 = []
result3 = []
t = []

def __init__(self, L1, L2, La, lambda1, lambda2, ka, tau):
self.L1 = float(L1)
self.L2 = float(L2)
self.La = float(La)
self.lambda1 = float(lambda1)
self.lambda2 = float(lambda2)
self.ka = float(ka)
self.tau = int(math.floor(float(tau)))

self.t = [x for x in range(0, self.tau)]
self.Cp = []
self.result1 = []
self.result2 = []
self.result3 = []

# calculations if the second button is pressed.
def calculate(self):
'''three different types of genotypes (normal, fast, ultra),
or genotype1, 2, and 3, respectively.'''

normal = 1
fast = 0.8
ultra = 0.5
for element in list(self.t):
self.result1.append(self.L1 * math.exp(element * -self.lambda1) +
self.L2 * math.exp(element * -self.lambda2) +
self.La * math.exp(element * -self.ka))

self.result2.append(fast*self.L1 * math.exp(element * -self.lambda1) +
fast*self.L2 * math.exp(element * -self.lambda2) +
self.La * math.exp(element * -self.ka))
self.result3.append(ultra*self.L1 * math.exp(element * -self.lambda1) +
ultra*self.L2 * math.exp(element * -self.lambda2) +
self.La * math.exp(element * -self.ka))

#save time and concentration as matrix of size 2xlength(time)
Matrix1 = [[0 for x in range(2)] for x in range(len(self.t))]
Matrix2 = [[0 for x in range(2)] for x in range(len(self.t))]
Matrix3 = [[0 for x in range(2)] for x in range(len(self.t))]
for index_row in range(len(self.t)):
Matrix1[index_row][0] = self.t[index_row]
Matrix1[index_row][1] = self.result1[index_row]
Matrix2[index_row][0] = self.t[index_row]
Matrix2[index_row][1] = self.result2[index_row]
Matrix3[index_row][0] = self.t[index_row]
Matrix3[index_row][1] = self.result3[index_row]
return Matrix1, Matrix2, Matrix3

```