carputils
Doxygen code documentation for the python framework controlling openCARP
Functions
carputils.model.protocols.PEERP_subroutines Namespace Reference

Functions

def stimulate_to_find_if_persistent (args, cmd_ref, job, mesh_name, simid, start_S2, stim)
 Stimulates starting at the start_S2 +300 timepoint until +1500 to see if the arrythmia is persistent. More...
 
def get_last_act_index (vm)
 Gets the time index of the last ACT. More...
 
def pacing_s1_sinus_s2_stim_point (args, cmd, job, mesh_name, simid, sinus, start_S2, start_state_file, stim_point, tsav_state)
 Pace at first from the sinus node and then from the stimulation point after start_S2 ms. More...
 
def get_element_from_dat (dat_file, index_node)
 Gets float value for a single point in a dat file. More...
 
def get_ring_around_stim_point (args, stim_point_index, mesh_name, stim_point, tag_str)
 Generates a ring of size 2*stim_size < x < 3*stim_size around the stimulation point. More...
 
def update_refactory_window_bounds (M2, OptimizationTimePoints time_pts, simid, tsav_state)
 
def update_lower_bound_when_refractory (simid, float start_S2, new_offset=60)
 Updates the lower bound which happens when the simulation is refactory (Low M2). More...
 
def update_upper_bound_non_refractory (simid, float start_S2, new_offset=60)
 Updates the upper bound of the search window if the previous S2 stimuli did create a depolarizing wave (non-refractory) More...
 
def compute_apd (apd_file_name, args, job, steady_state_dir)
 
def store_init_arrhythmia_to_file (index_node, job, n_beat, simid, start_S2)
 Saves the current arrhythmia at the index_node to saved.txt and also stores the corresponding .igb file. More...
 
def get_closest_tsav_to_act (last_ACT_i, tsav_states)
 Get the closest openCARP save state to the last ACT. More...
 
def write_convergence_data (str simid, OptimizationTimePoints time_pts, int iterations, time_taken, M2, M2_mean)
 
def create_debug_csv ()
 
def define_save_states_for_stim (stim_start, times_array)
 
def store_reentry (index_node, job, n_beat, start_S2)
 
def store_non_reentry (index_node, job, n_beat, start_S2)
 
def get_id_of_stimulation_point (mesh_name, simid, stim_point)
 

Function Documentation

◆ compute_apd()

def carputils.model.protocols.PEERP_subroutines.compute_apd (   apd_file_name,
  args,
  job,
  steady_state_dir 
)

◆ create_debug_csv()

def carputils.model.protocols.PEERP_subroutines.create_debug_csv ( )

◆ define_save_states_for_stim()

def carputils.model.protocols.PEERP_subroutines.define_save_states_for_stim (   stim_start,
  times_array 
)

◆ get_closest_tsav_to_act()

def carputils.model.protocols.PEERP_subroutines.get_closest_tsav_to_act (   last_ACT_i,
  tsav_states 
)

Get the closest openCARP save state to the last ACT.

Parameters
last_ACT_i
tsav_statesArray of tsav times :return:

◆ get_element_from_dat()

def carputils.model.protocols.PEERP_subroutines.get_element_from_dat (   dat_file,
  index_node 
)

Gets float value for a single point in a dat file.

Parameters
dat_fileCorresponding .dat file
index_nodeThe index of the node in the dat file :return:

◆ get_id_of_stimulation_point()

def carputils.model.protocols.PEERP_subroutines.get_id_of_stimulation_point (   mesh_name,
  simid,
  stim_point 
)

◆ get_last_act_index()

def carputils.model.protocols.PEERP_subroutines.get_last_act_index (   vm)

Gets the time index of the last ACT.

Parameters
vm:return:

◆ get_ring_around_stim_point()

def carputils.model.protocols.PEERP_subroutines.get_ring_around_stim_point (   args,
  stim_point_index,
  mesh_name,
  stim_point,
  tag_str 
)

Generates a ring of size 2*stim_size < x < 3*stim_size around the stimulation point.

Whole connecting tissue is stored in {mesh_name}_tag_{stim_point_index}.surf.vtx. Ring around the stim point is stored in {mesh_name}_node_{stim_point_index}.vtx

Parameters
argsHas to contain args.stim_size
stim_point_indexThe index of the stimulation point
mesh_nameThe name of the main mesh
stim_pointThe coordinates of the stimulation point
tag_strElement tags of the atrial surface :return:

◆ pacing_s1_sinus_s2_stim_point()

def carputils.model.protocols.PEERP_subroutines.pacing_s1_sinus_s2_stim_point (   args,
  cmd,
  job,
  mesh_name,
  simid,
  sinus,
  start_S2,
  start_state_file,
  stim_point,
  tsav_state 
)

Pace at first from the sinus node and then from the stimulation point after start_S2 ms.

Parameters
args
cmd
job
mesh_name
simid
sinusThe sinus region defined as -stimulius[0].geometry, >sinus node id<
start_S2Start time of the S2 stimulus
start_state_file
stim_pointThe stimulation point for the S2 stimulus
tsav_stateFirst save point. Also start_S2-1 and start_S2+60 are saved :return:

◆ stimulate_to_find_if_persistent()

def carputils.model.protocols.PEERP_subroutines.stimulate_to_find_if_persistent (   args,
  cmd_ref,
  job,
  mesh_name,
  simid,
  start_S2,
  stim 
)

Stimulates starting at the start_S2 +300 timepoint until +1500 to see if the arrythmia is persistent.

Parameters
argsHas to include args.M_lump for mass lumping option
cmd_ref
jobJob object for executing on cmd
mesh_name
simidSimulation ID for openCARP
start_S2
stimStimulation parameters. Should be a stimulus without a current, to just see the result of the previous S2 stimuli :return:

◆ store_init_arrhythmia_to_file()

def carputils.model.protocols.PEERP_subroutines.store_init_arrhythmia_to_file (   index_node,
  job,
  n_beat,
  simid,
  start_S2 
)

Saves the current arrhythmia at the index_node to saved.txt and also stores the corresponding .igb file.

Parameters
index_node
job
n_beat
simid
start_S2:return:

◆ store_non_reentry()

def carputils.model.protocols.PEERP_subroutines.store_non_reentry (   index_node,
  job,
  n_beat,
  start_S2 
)

◆ store_reentry()

def carputils.model.protocols.PEERP_subroutines.store_reentry (   index_node,
  job,
  n_beat,
  start_S2 
)

◆ update_lower_bound_when_refractory()

def carputils.model.protocols.PEERP_subroutines.update_lower_bound_when_refractory (   simid,
float  start_S2,
  new_offset = 60 
)

Updates the lower bound which happens when the simulation is refactory (Low M2).

Parameters
simidMain working directoryold_file = os.path.join(str(simid), 'vm.igb')
start_S2Start of the S2 stimulus in ms
new_offsetOffset of the S2 stimulus in ms which will be stored in state_upper_bound.roe :return:

◆ update_refactory_window_bounds()

def carputils.model.protocols.PEERP_subroutines.update_refactory_window_bounds (   M2,
OptimizationTimePoints  time_pts,
  simid,
  tsav_state 
)

◆ update_upper_bound_non_refractory()

def carputils.model.protocols.PEERP_subroutines.update_upper_bound_non_refractory (   simid,
float  start_S2,
  new_offset = 60 
)

Updates the upper bound of the search window if the previous S2 stimuli did create a depolarizing wave (non-refractory)

Parameters
simidMain working directoryold_file = os.path.join(str(simid), 'vm.igb')
start_S2Start of the S2 stimulus in ms
new_offsetOffset of the S2 stimulus in ms which will be stored in state_upper_bound.roe :return:

◆ write_convergence_data()

def carputils.model.protocols.PEERP_subroutines.write_convergence_data ( str  simid,
OptimizationTimePoints  time_pts,
int  iterations,
  time_taken,
  M2,
  M2_mean 
)