Location: Model of Human Jejunal Smooth Muscle Cell Electrophysiology @ ad6aa57de383 / Simulation / Fig3_sim.py

Author:
WeiweiAi <wai484@aucklanduni.ac.nz>
Date:
2021-06-08 16:57:08+12:00
Desc:
Modify tau_dCaT to 1.9508 and the parameter in phi_s (0.05956) to 0.005956 (Eq S-24) based on the C code; Add ICaL_channel_states_off and ICaL_off for Clamped_current_Xi to switch off the Cai dependency.
Permanent Source URI:
https://models.physiomeproject.org/workspace/692/rawfile/ad6aa57de38320e52058da97f9d140a57288d95e/Simulation/Fig3_sim.py

# To reproduce the data needed for Figure 7 in associated original paper,
# execute this script in the Python console in OpenCOR. This can be done
# with the following commands at the prompt in the OpenCOR Python console:
#
#     In [1]: cd path/to/folder_this_file_is_in
#     In [2]: Fig3_sim.py

import opencor as oc
import numpy as np
# The prefix of the saved output file name 
prefilename = 'simFig3'
# Load the simulation file
simfile='Patch_clampXi_experiment.sedml'
simulation = oc.open_simulation(simfile)
# The data object houses all the relevant information
# and pointers to the OpenCOR internal data representations
data = simulation.data()
# Set the experiments
Vholding, t_ss = -100, 1000
Vtest = range (-90, 50, 5)
duration = 400
# Define the interval of interest for this simulation experiment
start, end, pointInterval = 0, t_ss+duration, 0.1
data.set_starting_point(start)
data.set_ending_point(end)
data.set_point_interval(pointInterval)
# Data to save
varName = np.array(["V", "ICaT"])
vars = np.reshape(varName, (1, len(varName)))
row_start=int(t_ss/pointInterval-50) # to get the peak
r = np.zeros((len(Vtest),len(varName)))

for i, V in enumerate(Vtest): 
   # Reset states and parameters
   simulation.reset(True)
   # Set constant parameter values
   data.constants()['Clamp_parameters/V_actHolding'] = Vholding
   data.constants()['Clamp_parameters/V_actTest'] = V
   simulation.run()
   # Access simulation results
   results = simulation.results()
   # Grab a specific algebraic variable results
   r[i,0] = V
   temp = results.algebraic()['outputs/I_CaT'].values()[row_start:]
   r[i,1] = -max(abs(temp))
   # clear the results except the last run
   simulation.clear_results()

 # Save the simulation result of the last run
filename='%s.csv' % (prefilename)
np.savetxt(filename, vars, fmt='%s',delimiter=",")
with open(filename, "ab") as f:
    np.savetxt(f, r, delimiter=",")
f.close