|
carputils
Doxygen code documentation for the python framework controlling openCARP
|
Functions | |
| def | create_electrode_param_block (stim_indices, vtx_file) |
| Create electrode parameter block for given stimulation indices. More... | |
| def | create_stim_params (stim_configs) |
| Create stimulation parameters from configuration dictionaries. More... | |
| def | build_bipolar_stims (stimulus_strength) |
| def | build_bipolar_electrodes (lead_positions) |
| def | build_3lead_stims (stimulus_strength) |
| def | build_3lead_electrodes (lead_positions) |
| def | build_5lead_stims (stimulus_strength) |
| def | build_5lead_electrodes (lead_positions) |
| def | build_12lead_stims (stimulus_strength) |
| def | build_12lead_electrodes (lead_positions) |
| def | plot_ecg (input_dir, output_dir, noise_threshold=0.001) |
| Plot ECG traces from lead-field postprocessing output. More... | |
| def | leadfield_setup (lf_config, electrodes_dir, stimulus_strength=1.0, post_processing_opts=64, ecg_timedt=None, lf_dir=None, lf_vmfile=None) |
| Build stimulus, electrode, and run-option CLI parameter lists for a lead-field computation. More... | |
| def carputils.leadfield.build_12lead_electrodes | ( | lead_positions | ) |
| def carputils.leadfield.build_12lead_stims | ( | stimulus_strength | ) |
| def carputils.leadfield.build_3lead_electrodes | ( | lead_positions | ) |
| def carputils.leadfield.build_3lead_stims | ( | stimulus_strength | ) |
| def carputils.leadfield.build_5lead_electrodes | ( | lead_positions | ) |
| def carputils.leadfield.build_5lead_stims | ( | stimulus_strength | ) |
| def carputils.leadfield.build_bipolar_electrodes | ( | lead_positions | ) |
| def carputils.leadfield.build_bipolar_stims | ( | stimulus_strength | ) |
| def carputils.leadfield.create_electrode_param_block | ( | stim_indices, | |
| vtx_file | |||
| ) |
Create electrode parameter block for given stimulation indices.
This function generates a list of command-line parameters to assign a vertex file (vtx_file) for each stimulation electrode based on its index. For every index in the list, it produces a parameter entry in the format: -stim[<index>].elec.vtx_file <vtx_file>
| def carputils.leadfield.create_stim_params | ( | stim_configs | ) |
Create stimulation parameters from configuration dictionaries.
Each dict in stim_configs must contain index, name, and strength. crct_type is optional and falls back to _STIM_DEFAULTS when absent.
| def carputils.leadfield.leadfield_setup | ( | lf_config, | |
| electrodes_dir, | |||
stimulus_strength = 1.0, |
|||
post_processing_opts = 64, |
|||
ecg_timedt = None, |
|||
lf_dir = None, |
|||
lf_vmfile = None |
|||
| ) |
Build stimulus, electrode, and run-option CLI parameter lists for a lead-field computation.
lf_config int Lead configuration selector: 1 (bipolar), 3 (Einthoven I/II/III), 5 (limb + aVR/aVL/aVF + V1), or 12 (full clinical 12-lead). electrodes_dir str Directory containing one .vtx file per electrode (e.g. RA.vtx, LA.vtx). stimulus_strength float Total injected current in µA at each positive electrode. The default of 1 µA is the natural unit for lead-field reciprocity: ECG traces are later scaled by the transmembrane current distribution. post_processing_opts int openCARP -post_processing_opts bit-flag. Defaults to 64, the Lead Field bit (openCARP.prm post-processing menu entry 64 = "Leadfield"). Override to OR-in additional post-processing bits (e.g. 64 | 2); the Lead Field bit should always remain set. ecg_timedt float, optional openCARP -ecg_timedt — temporal resolution of the output ECG traces in ms. May be coarser than the simulation timestep. Omit to use the openCARP default (1 ms). lf_dir str, optional Path to a directory containing pre-computed LF_*.igb sensitivity maps. When provided, openCARP skips recomputing the Lead Fields. lf_vmfile str, optional Path to an existing transmembrane-voltage file (vm.igb). When provided, -experiment 4 (post-process only) is emitted automatically so the cardiac solver is skipped and the existing Vm is reprojected.
stim_cmds list Flat parameter list starting with ['-num_stim', N, ...]. elec_cmds list Flat parameter list of -stim[i].elec.vtx_file assignments. run_opts list Flat openCARP parameter list containing at minimum -experiment and -post_processing_opts. -experiment is 4 when lf_vmfile is given (post-process only), otherwise 0 (full pipeline). -ecg_timedt, -lf_dir, and -lf_vmfile are appended when their arguments are supplied.
ValueError If lf_config is not one of 1, 3, 5, 12. FileNotFoundError If any required .vtx file is missing from electrodes_dir.
| def carputils.leadfield.plot_ecg | ( | input_dir, | |
| output_dir, | |||
noise_threshold = 0.001 |
|||
| ) |
Plot ECG traces from lead-field postprocessing output.
input_dir str Directory containing ECG_*.dat files (two columns: time, voltage). output_dir str Directory where PNG images are saved (created if absent). noise_threshold float Leads with peak-to-peak amplitude below this fraction of the strongest lead are zeroed out before plotting.