- Author:
- Leyla <lnor300>
- Date:
- 2022-11-02 15:31:28+13:00
- Desc:
- ..
- Permanent Source URI:
- https://models.fieldml.org/workspace/763/rawfile/4624ea7e4bf53d57d1f03fbbc2791d8e953ace0b/Simulation/Figure2/Fig2_plot.py
# Author : Leyla Noroozbabaee
# Bioengineering Institute
# The University of Auckland
# Date: 2/10/2021
# Plot the result produced from Fig2_sim.py
import pandas as pd
from sklearn import preprocessing
import numpy as np
import matplotlib.pyplot as plt
# To include the extracted data from the original paper
Fig2_Extracted_data = 1
# Read data from the files
prefilename = 'Fig2_A'
filename = '%s.csv' % prefilename
data = pd.read_csv(filename)
time = data['time']
vm = data['Vm']
ca_y = data['y']
p_ip3 = data['ip3']
ca_z = data['z']
# Normalize the data
vm_norm = preprocessing.normalize(np.array(vm).reshape(1, -1))
ca_z_norm = preprocessing.normalize(np.array(ca_z).reshape(1, -1))
p_ip3_norm = preprocessing.normalize(np.array(p_ip3).reshape(1, -1))
ca_y_norm = preprocessing.normalize(np.array(ca_y).reshape(1, -1))
vm_norm = 0.1223 + 3*vm_norm
# set Subplot
fig, axs = plt.subplots()
labelfontsize = 12
axs.plot(time, vm_norm[0], 'k')
axs.plot(time, p_ip3_norm[0], '#8f8f8f')
axs.plot(time, ca_z_norm[0], '--k')
axs.set_ylabel ('Normalized Parameters', fontsize=labelfontsize)
axs.set_xlabel ('Time [min]', fontsize=labelfontsize)
axs.legend(["Vm", "IP3", "Ca-c"], loc="upper right")
axs.set_title('Phase Plot')
# To plot the extracted data from the original paper
if Fig2_Extracted_data == 1:
prefilename = 'Figure2_origin'
for i in range(3):
filename = '%s_%d.csv' % (prefilename, i)
data = pd.read_csv(filename)
y_d = data['Curve1']
x_d = data['x']
axs.plot(x_d, y_d, '.')
axs.set_xlim([0, 8])
plt.show()
plt.savefig('Figure_2')