visualizeutils¶
Functions that help visualize results
-
heartpy.visualizeutils.
plotter
(working_data, measures, show=True, title='Heart Rate Signal Peak Detection', moving_average=False)[source]¶ plots the analysis results.
Function that uses calculated measures and data stored in the working_data{} and measures{} dict objects to visualise the fitted peak detection solution.
Parameters: - working_data (dict) – dictionary object that contains all heartpy’s working data (temp) objects. will be created if not passed to function
- measures (dict) – dictionary object used by heartpy to store computed measures. Will be created if not passed to function
- show (bool) – when False, function will return a plot object rather than display the results. default : True
- title (string) – title for the plot. default : “Heart Rate Signal Peak Detection”
- moving_average (bool) – whether to display the moving average on the plot. The moving average is used for peak fitting. default: False
Returns: out – only returned if show == False.
Return type: matplotlib plot object
Examples
First let’s load and analyse some data to visualise
>>> import heartpy as hp >>> data, _ = hp.load_exampledata(0) >>> wd, m = hp.process(data, 100.0)
Then we can visualise
>>> plot_object = plotter(wd, m, show=False, title='some awesome title')
This returns a plot object which can be visualized or saved or appended. See matplotlib API for more information on how to do this.
A matplotlib plotting object is returned. This can be further processed and saved to a file.
-
heartpy.visualizeutils.
segment_plotter
(working_data, measures, title='Heart Rate Signal Peak Detection', figsize=(6, 6), path='', start=0, end=None, step=1)[source]¶ plots analysis results
Function that plots the results of segmentwise processing of heart rate signal and writes all results to separate files at the path provided.
Parameters: - working_data (dict) – dictionary object that contains all heartpy’s working data (temp) objects. will be created if not passed to function
- measures (dict) – dictionary object used by heartpy to store computed measures. Will be created if not passed to function
- title (str) – the title used in the plot
- figsize (tuple) – figsize tuple to be passed to matplotlib
- path (str) – the path where the files will be stored, folder must exist.
- start (int) – what segment to start plotting with default : 0
- end (int) – last segment to plot. Must be smaller than total number of segments default : None, will plot until end
- step (int) – stepsize used when iterating over plots every step’th segment will be plotted default : 1
Returns: Return type: None
Examples
This function has no examples. See documentation of heartpy for more info.
-
heartpy.visualizeutils.
plot_poincare
(working_data, measures, show=True, title='Poincare plot')[source]¶ visualize poincare plot
function that visualises poincare plot.
Parameters: - working_data (dict) – dictionary object that contains all heartpy’s working data (temp) objects. will be created if not passed to function
- measures (dict) – dictionary object used by heartpy to store computed measures. Will be created if not passed to function
- show (bool) – whether to show the plot right away, or return a matplotlib object for further manipulation
- title (str) – the title used in the plot
Returns: out – only returned if show == False.
Return type: matplotlib plot object
Examples
This function has no examples. See documentation of heartpy for more info.
-
heartpy.visualizeutils.
plot_breathing
(working_data, measures, show=True)[source]¶ plots extracted breathing signal and spectrogram
Function that plots the breathing signal extracted from RR-intervals alongside its computed spectrogram representation.
Parameters: - working_data (dict) – dictionary object that contains all heartpy’s working data (temp) objects. will be created if not passed to function
- measures (dict) – dictionary object used by heartpy to store computed measures. Will be created if not passed to function
- show (bool) – whether to show the plot right away, or return a matplotlib object for further manipulation
Returns: out – only returned if show == False.
Return type: matplotlib plot object
Examples
This function has no examples. See documentation of heartpy for more info.