PGomes92 / pyhrv

Python toolbox for Heart Rate Variability
BSD 3-Clause "New" or "Revised" License
271 stars 77 forks source link

Nonlinear dfa function always plots. #22

Closed NarayanSchuetz closed 2 years ago

NarayanSchuetz commented 3 years ago

As the title says, the nonlinear.dfa function does always show plots, irrespective of the argument given to show. This is at least true in an ipyhton environment. I fixed it locally, but I'm not sure whether the current behavior is desired or not. If it is not, I can submit a fix.

PGomes92 commented 2 years ago

Hi @NarayanSchuetz,

thanks for using pyHRV!

I believe that this might be linked to the way the ipython environment handles plots. I am linking you to another issue that experienced a similar behaviour:

https://github.com/PGomes92/pyhrv/issues/31

The parameter show=False does not prevent pyhrv.nonlinear.dfa() from generating a plot figure, but only hides the plot figure itself. Your current project or setup might be calling matplotlib to show all the available plot figures at another point hence the reasons why your plots may appear.

Other functions of pyHRV (e.g. pyhrv.frequency_domain.welch_psd()) also have a 'dev' mode which does not generate any plots at all but only provides the output data. I will consider adding the same functionality to the the DFA function.