Data from experiments with Handheld Tactile Device 04/11/2016 ________________________________________________________________________________ Type of Data: The data collected includes Active Thermal data, Passive Thermal Data, Data from the LM35 sensor, Force data, Contact Mic data, Accelerometer data, and the Estimated Average Velocity. ________________________________________________________________________________ Data File Format The data is formated in a Pickle file. The data comes in eight columns. Column 1: Time Data Column 2: Active Thermal Data Column 3: Passive Thermal Data Column 4: LM35 Sensor Data Column 5: Force Data Column 6: Contact Mic Data Column 7: Accelerometer Data Column 8: Estimated Average Velocity Data Note 1: Time starts at t = 0 when the handheld device comes in contact with the object. The time before this will be represented as negative values Note 2: The LM35 Sensor was unplugged for this experiment so that data will be represented as zeros in column 4 Note 3: The Estimated Average Velocity was only recorded once when the device was pushed down on an object. There will only be one value in the first row while the rest will be "None" ________________________________________________________________________________ Accessing and Plotting the Data The code used here accesses the data from the pickle file using the pickle module. Follow this link to see the python documentation of pickle https://docs.python.org/3/library/pickle.html#what-can-be-pickled-and-unpickled We used Python 2.7.12 on Ubuntu 12.04 to create the pickle file. You can look at the documentation that corresponds to the version of Python that you are using. We also used the Plotly api to generate the graphs you see on the website. To use the api, create an account on https://plot.ly/ . Once you set up your account, follow the setup instructions to use the Plotly api with python. The setup instructions can be found here: https://plot.ly/python/getting-started/ ________________________________________________________________________________ Sample Code The code below uses Python 2.7.12 on Ubuntu 14.04 to access the data and generate graphs using the plotly api. #!/usr/bin/python # -*- coding: utf-8 -*- import pickle as pk import plotly.plotly as py import plotly.graph_objs as go ## Retrieves data from the Pickle File def load_pickle(filename): try: p = open(filename, 'r') except IOError: print("The file cannot be opened") return None try: pickle_obj = pk.load(p) except ValueError: print("Loading Pickle File failed. Trying Again.") p.close() p = open(filename, 'r') pickle_obj = pk.load(p) p.close() return pickle_obj ## Plots the data using the plotly api def plot_atherm_ply(data): t = [] atherm = [] for item in data: t.append(item[0]) atherm.append(item[1]) trace0 = go.Scatter( x = t, y = atherm, mode = 'line', line = dict( color = ('rgb(205, 12, 24)'), width = 2 ) ) plot_data = [trace0] plot_layout = dict( title = 'Active Thermal Temperature over Time', xaxis = dict(title = 'Time (seconds)'), yaxis = dict(title = 'Temperature (°C)'), ) figure = dict(data = plot_data, layout = plot_layout) py.plot(figure) def plot_ptherm_ply(data): t = [] ptherm = [] for item in data: t.append(item[0]) ptherm.append(item[2]) trace0 = go.Scatter( x = t, y = ptherm, mode = 'line', line = dict( width = 2 ) ) plot_data = [trace0] plot_layout = dict( title = 'Passive Thermal Temperature over Time', xaxis = dict(title = 'Time (seconds)'), yaxis = dict(title = 'Temperature (°C)'), ) figure = dict(data = plot_data, layout = plot_layout) py.plot(figure) data = load_pickle('trial_5_processed.pkl') plot_ptherm_ply(data) plot_atherm_ply(data)