PA Designer Learn 3: Data Analysis
This is the second challenge within the Robotics with GoPiGo and Python Curriculum.
Your task is to program your robot to alert a person with a hearing impairment to visiting house guests.
Learn how to use the Loudness Sensor alongside Jupyter Notebooks.
2. Plotting Data
Let’s now plot the data you have collected in a couple of graphs:
- one to display raw data.
- one to display smoothed data.
In the Data Analysis cell, call the plot_values() function, passing it a string that describes what our data is and the values and times lists that we populated in the Main Code cell.
plot_values() is a template function written for you which generates a graph given two lists of data representing values on the graph’s X and Y axes. It uses the matplotlib module imported in the Robot Setup Code cell.
Do the same using smoothed_values as our Y axis data instead of values.
# generate a graph to visualize the raw loudness data
plot_values("loudness", times, values)
plot_values(“smoothed loudness", times, smoothed_values)