neqstim mode for irregularly timed stimuli in carp (already exists in bench)
Problem to solve with the new feature
bench has a nice interface for delivering irregular-timed stimuli:
Mode: neqstim irregularly timed stimuli --stim-times=STRING comma separated list of stim times (default=`') --DIA interpret stim times as distolic intervals (default=off)
This is nice for applying pacing protocols with a gradually decreasing coupling interval, which is a common process in simulations where a clinical pacing protocol for inducing reentry/fibrillation is mimicked.
The behavior of the feature is well defined. I attached an image showing two examples: /Software/cme/openCARP/bin/bench.opt --fout=TT2_NotDIA --imp=TT2 --duration=2000 --stim-times=50,550,950,1250,1450,1550 /Software/cme/openCARP/bin/bench.opt --fout=TT2_DIA --imp=TT2 --duration=2000 --stim-times=75,500,400,300,200,100 --DIA
In the image: ... the red line is for the first command (non-DIA) and the second line is for the second (DIA).
Intended users
End users running simulations, especially those working on simulations in which virtual pacing is used to attempt reentry induction.
Further details
I think most of this is self-explanatory. Notably, it is nice to have a consistent interface across bench and carp, which are to my mind the two "marquee" binaries in the openCARP suite.
Proposal
I implemented a version of this (without DIA support) previously in an old forked version of the source code. The hooks were already there in the Timer.c/Timer.h files and a rudimentary template exists in the code for bench (I think it was directly in bench.c but it might be elsewhere).
I don't necessarily want to implement it myself, especially since I don't fully understand the new stim[] structure compared to the old stimulus[] motif. I can certainly help debug if things go off the rails.
Testing
This should be really straightforward and I will volunteer to set up comprehensive testing to make sure edge cases are covered. Generally speaking, the biggest concerns here are related to making sure the program fails elegantly if the user inputs an argument for this parameter that doesn't make sense (i.e., timing of pulses outside bounds of the simulation determined by start and end times).