NeuroKit icon indicating copy to clipboard operation
NeuroKit copied to clipboard

Breathmetrics breath simulation is for flow not for belt/RIP signal and make function accessible

Open shanelindsay opened this issue 2 years ago • 1 comments

Two issues (first more of a feature suggestion, second more a problem)

1.

Currently this function:

https://neurokit2.readthedocs.io/en/latest/_modules/neurokit2/rsp/rsp_simulate.html#rsp_simulate

Has a method called "breathmetrics" which calls a function with particular parameters.

These parameters are pretty arbitrary, and can be used to simulate the other method "sinusoidal" (with tweaking of parameters).

The nice thing about this technique is the ability to tweak these parameters but currently Neurokit hides these from the user.

Since the trouble has been taken to convert the matlab code to python then it might be better to allow calling this function directly.

i.e. I should be able to call this function directly and it could replace rsp_simulate

rsp_simulate_breathmetrics_original( nCycles=100, sampling_rate=1000, breathing_rate=0.25, average_amplitude=0.5, amplitude_variance=0.1, phase_variance=0.1, inhale_pause_percent=0.3, inhale_pause_avgLength=0.2, inhale_pauseLength_variance=0.5, exhale_pause_percent=0.3, exhale_pause_avgLength=0.2, exhale_pauseLength_variance=0.5, pause_amplitude=0.1, pause_amplitude_variance=0.2, signal_noise=0.1, )

2.

This function has been designed to simulate spirometry type data (i.e. respiratory flow).

See example here where exhale pauses (which I increased value of) occur at zero crossing.

image

However neurokit (currently) assumes belt/RIP data so the function gives the wrong output to work with default neurokit pipelines, where exhales pauses should follow troughs.

Ideally then, the function could be modified with measure = "flow" or "belt" to indicate the output and then the code modified to make it more like output from belt/RIP recordings when measure = "belt".

shanelindsay avatar Sep 09 '21 10:09 shanelindsay

As an interim quick fix for issue 2), can I suggest a minor change to the wording of the function to alert users of the mismatch. E.g. Something like:

"Generate an artificial (synthetic) respiratory signal of a given duration and rate. These signals are respiratory flow signals (e.g., those generated through spirometry). Note other functions in Neurokit currently assume volumetric-associated signals (e.g. those generated from a belt/respiratory inductive plethysmography).

https://neuropsychology.github.io/NeuroKit/_modules/neurokit2/rsp/rsp_simulate.html#rsp_simulate

shanelindsay avatar Sep 22 '22 10:09 shanelindsay

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Nov 25 '22 04:11 stale[bot]