First time here? Checkout the FAQ!
x
0 votes
by (250 points)

Hi team,

Is there any documentation or examples of using carputils.ecg? Documentation which I have linked is not enough for using the functions. It would be useful to know what format of inputs is required and some description of what they are doing (no, their names are not fully self-explainatory as some of them additionally plot and save things). I saw in the source code that some functions require input as dictionary with ECG electrodes' names as keys (i.e. I, II, III, RA, LL, V1, V2...).

If the function requires dictionary with ECG electrodes' names and their recordings, then how can I generate it from bidomain simulations? I am able to see phie from the simulations in meshalyzer as in the Tutorial 7, but what carputils functions should I use to access them in run.py and later pass them to carputils.ecg functions?

Thank you,

Jakub

by (160 points)
Hi Jakub,

there is currently no example in the openCARP taking advantage of it. In Graz, we use the features to quickly get an impression, of what the ecg would look like for a given simulation.

As Axel pointed out, the documentation happens mainly in the source code. The entry point would actually be carputils/bin/ecgplotter

usage: ecgplotter
...
positional arguments:
  input            openCARP phie recovery files (.igb),
                        ECG recorder files (.xls) or,
                        General 12-Lead ecg files [header: t, I, II, III, aVR, aVL, aVF, V1-V6] (.csv), or
                        Leadfield files (.dat) - just data without header, or
                        Studio files [header: time, I, II, III, aVR, aVL, aVF, V1-V6] (.dat).
...


Some hints to get started in your case:
Forget about the input file formats and develop your own pipeline. As you are running bidomain simulations, you already know the point IDs of your extracellular potentials in the phie file associated with  RA, LA, LL and V1-V6. Query for those potential traces after your simulation and collect them in an datadict = OrderedDict():

datadict['RA']   = data[?, :]
datadict['LA']   = data[?, :]
datadict['LL'] = data[?, :]
datadict['V1'] = data[?, :]
datadict['V2'] = data[?, :]
datadict['V3'] = data[?, :]
datadict['V4'] = data[?, :]
datadict['V5'] = data[?, :]
datadict['V6'] = data[?, :]

The time vector would need to be setup separately.
t = numpy.linspace(0, 1000, 1000) # this depends on your simulation parameters!

Subsequent processing using the functions of ecg.py can be freely assembled similarly to what is shown in the ecgplotter.

Cheers,
Toni
by (250 points)
Thank you Toni

1 Answer

+1 vote
by (19.1k points)
selected by
 
Best answer

Hi,

the documentation of this module is largely in the code and unfortunately not in a format that's understood by doxygen. It's main function is postprocessing of simulated ECG signals.

For now, I think you'll get the best overview by going through the code:

https://git.opencarp.org/openCARP/carputils/-/blob/master/carputils/ecg.py?ref_type=heads

Cheers,

Axel

by (250 points)
Alright, thank you.
Welcome to openCARP Q&A. Ask questions and receive answers from other members of the community. For best support, please use appropriate TAGS!
architecture, carputils, documentation, experiments, installation-containers-packages, limpet, slimfem, website, governance
MathJax.Hub.Config({ tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ], config: ["MMLorHTML.js"], jax: ["input/TeX"], processEscapes: true } }); MathJax.Hub.Config({ "HTML-CSS": { linebreaks: { automatic: true } } });
...