#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
% file NfkB_signaling.py
% model of Nf-kB signaling pathway
% from Krishna et al. (2006) PNAS 103, pp. 10840-10845
% problem 7.8.15

@author: bingalls
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint



#assign parameter values

A=0.007
B=954.5
C=0.035
delta=0.029
eps=2e-5


#set time_grid for simulation
times=np.linspace(0, 20, 1000) #generate time-grid list


#assign initial condition.  
Sinit=[0.0014, 0.0207, 0.0127]
 
#declare right-hand-side for original model
def dSdt_original(S,t):
    dS=np.zeros(3) #generate a list to store derivatives
    
    Nn=S[0]
    Im=S[1]
    I=S[2]
    
    dS[0]=A*(1-Nn)/(eps+I) - B*I*Nn/(delta+Nn)
    dS[1]=Nn**2-Im
    dS[2]=Im-C*(1-Nn)*I/(eps+I)
    

    return dS


S=odeint(dSdt_original, Sinit, times) #run simulation

#plot simulation
plt.figure() #generate figure 7.17A
plt.plot(times, S[:,0], label="Nn", linewidth=2)
plt.plot(times, S[:,1], label="Im", linewidth=2)
plt.plot(times, S[:,2], label="I", linewidth=2)
plt.xlabel("Time")
plt.ylabel("concentration")
plt.legend()




 
 


