Pulse Python Support

On behalf of the Pulse Physiology Community, we are pleased to announce that Pulse now supports the Python programming language. Python developers can now create and control Pulse engines from any Python application.

Binder Notebooks

We have created a Binder based Jupyter notebook that creates a remote development environment in your browser to experiment with the Pulse API. This Binder notebook provides a full Jupyter development environment for the user to view, run, and create new notebooks using the Pulse Python API. Use of the remote environment means there is no need to download, build or install anything to experiment with our Python API. You are also able to  upload and download customized notebooks and files created in your session. 

How To Use A Pulse Engine

After navigating to the Binder notebook, the file structure in Figure 1 will appear. Note that binder does take several minutes to load our docker based development notebook.

Figure 1. Root of the web hosted web notebook with provided notebooks

The ‘HowTo_Engine Use’ notebook is provided to walk you through key concepts of the Pulse API.

Figure 2. The  HowTo_EngineUse notebook is provided to quickly  introduce the Pulse Python API to get you coding right away!

Once the notebook has been started, click the ‘Run’ button to move to the next section. Run each section in sequence to step through each Pulse use case.. Each code block will execute on the remote server and will print any requested Pulse data after the code block.

Figure 3. A print out of requested Pulse results will display as the code block executes.

Multiplex Ventilation

We have provided a more complex use case of the Pulse Physiology Engine in the “Multiplex_Ventilation” notebook. We recently investigated the effects of placing multiple patients on a single ventilator in the case of compromised physiology due to COVID-19. The Pulse engine was executed with two patients connected to a single ventilator with varying respiratory impairment severities, leading to thousands of simulations. The purpose was to determine the most “ideal” patient coupling on a single ventilator during when resources are rationed or unavailable. By using Pulse to simulate these events, we can inform treatment protocols  without exposing the patients to the additional risks inherent in experimentation. We have provided an example of coupling two patients to one ventilator with a python generated UI to change patient and ventilator parameters, and plot the results all in real-time.

Figure 4. Click Run on the provided code block to start the GUI. Set the patient properties and click simulate. You can apply different ventilator settings and choose to view various real-time output plots.

Customization

To create your own notebooks within the Binder environment, simply click the New button on the notebook homepage. You can view and copy code from any of our python ‘How-To’ examples in our repository or create your own use case for Pulse. To contribute your notebook to the Pulse community you can create a Merge Request for your notebook on our jupyter repository.

Moving Forward

If you would like to use Pulse Python on your local system,  you will need to manually install Pulse Python on your local system with the instructions on our wiki page. We are working towards pip install capability for Pulse Python. To be the first to know when this is released, please join our community.  Please visit our forums with any questions or issues you have getting Pulse to work on your system.  

For more information on our efforts and our users, visit our website or sign up for our newsletter. If you would like to feature your Pulse use case on our website or blog, please email us at kitware@kitware.com.

Questions or comments are always welcome!

X