gigablochs.flow.half_sin

Contents

gigablochs.flow.half_sin#

gigablochs.flow.half_sin(start=0, stop=2, num=1000, interbeat_interval=0.75, systolic_velocity=0.4, diastolic_velocity=0.01, phase=0, **kwargs)[source]#

Generate a blood flow velocity waveform using a half sine wave, where negative values are set to zero, then shifted with the diastolic velocity offset.

A very approximate model of blood flow in the Aorta.

Parameters:
  • start (float, optional) – The starting time of the waveform in seconds. Default is 0.

  • stop (float, optional) – The stopping time of the waveform in seconds. Default is 2.

  • num (int, optional) – The number of time points to generate. Default is 1000.

  • interbeat_interval (float, optional) – The interval between heartbeats (the pulse period) in seconds. Default is 0.75.

  • systolic_velocity (float, optional) – Systolic velocity in m/s.

  • diastolic_velocity (float, optional) – Diastolic velocity in m/s.

  • phase (float, optional) – Phase shift in radians.

  • **kwargs (optional) – Additional keyword arguments to be passed to the integrate_trajectory function for calculating position.

Returns:

  • time_steps (ndarray) – Array of time steps in seconds.

  • velocity_waveform (ndarray) – Velocity waveform in m/s.

  • position (ndarray) – Position waveform in m.

Examples

import numpy as np
from bokeh.plotting import figure, show
from bokeh.io import output_notebook
output_notebook()

from gigablochs import flow

systolic_velocities = np.linspace(0.01, 1, 50)[:, np.newaxis]
time, velocity, position = flow.half_sin(systolic_velocity=systolic_velocities, phase=np.pi/8)

plot = figure(title='Approximate Aortic Bloodflow Model', x_axis_label='Time (s)', y_axis_label='Bloodflow',
              width=680, height=400)
plot.line(time, velocity[40] * 100, legend_label='Velocity (cm/s)', line_color='blue')
plot.line(time, position[40] * 100, legend_label='Position (cm)', line_color='purple')
plot.legend.click_policy = 'hide'
show(plot)