CONTACT

[contact-form-7 404 "Not Found"]

2. Fetch view data

Do your development for this section in the coding cell under Lab 4 – Visualize data in Python notebook > Step 2a – Fetch view data. Do not copy and paste your application from previous steps into this cell; this will be a separate code segment.

Create a data_collector­ function that iterates through the view and appends each value to the list.def data_collecter(view):
for d in iter(view.get, None):
plotQueue.append(float(d))

Create an instance of the BackgroundJobManager class. Name it jobs.jobs = bg.BackgroundJobManager()

Start a new background job and pass in both data_collecter and view.jobs.new(data_collecter, view)

Run the cell.You won’t observe any output because it is merely saving your streams data in the background.

Run the third cell under Lab 4 – Visualize data in Python notebook> Step 2b – Visualize view data using Matplotlib.This cell contains everything you need to create a plot for your data view.A data plot should appear under this last cell and update in real time with the average heart rate data from your streaming application. With data visualization tools like this, you don’t even need to go into the Streams Console to see the outputs of your program.

You have now learned not only to create a life-like Streams application in the Python language, but also to generate visuals for your data.