PIA-Group / BioSPPy

Biosignal Processing in Python
Other
569 stars 273 forks source link

Addition of an interactive display option for the plots #92

Closed afonsof3rreira closed 2 years ago

afonsof3rreira commented 2 years ago

It would be a nice addition if the plotting functions could handle interactive items, so an interactive option was created for the ECG signal plotting function, which includes 2 toolbars located at the bottom, controlling the left and the right plots independently.

afonsocraposo commented 2 years ago

Thank you very much for your PR @afonsof3rreira ! I'd like to ask you a few things:

  1. Update BioSPPy/biosppy/__init__.py to lazy load the inter_plotting module;

  2. Update BioSPPy/biosppy/inter_plotting/__init__.py to lazy load its components;

  3. Maybe try to make the plot_ecg method easier to use, i.e., requiring less arguments. Perhaps this could be accomplished by applying signals.ecg methods during inter_plotting.ecg.plot_ecg. Ideally, the required parameters should be similar to the signals.ecg.ecg, requiring only the following:

    ecg(signal, sampling_rate, path, show)
  4. Provide an example on how to use the inter_plotting.ecg.plot_ecg method.

afonsof3rreira commented 2 years ago

Lazy loading was updated. A 'example.py' was added similarly to the code on the readme file. The new method is called by signals.ecg, when the new arg interactive is True. Otherwise, previous code is run. When the path is provided, in this mode, two images are saved seperately, one for each block.

Edit: Added an interactive mode for ACC signals