Question: Overlapping Line Chart for Accelerometer Data. Code base - This is a sample Python script. # Press to search everywhere for classes, files, tool windows,

Overlapping Line Chart for Accelerometer Data. Code base- This is a sample Python script.
# Press to search everywhere for classes, files, tool windows,
actions, and settings.
def analyze_data():
# Use a breakpoint in the code line below to debug your
script.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# (Step 1) Selecting the one data for further data analysis.
Give the path & file name below.
affected_filename =...
affected_df = pd.read_csv(affected_filename, skiprows=10)
acc_x = np.array(affected_df['Accelerometer X'])
acc_y = np.array(affected_df['Accelerometer Y'])
acc_z = np.array(affected_df['Accelerometer Z'])
acc_mag = np.sqrt(acc_x * acc_x + acc_y * acc_y + acc_z *
acc_z)-1
plt.plot(range(len(acc_mag)), acc_mag)
plt.show()
# (Step 3) Identifying the data for sedentary behavior (i.e.,
sleeping).
# If you identify the beginning index of the sedentary
behavior, the ending index will be automatically done.
# If you select the beginning index too loosely, the
subsequent sedentary_data may include active behavior.
# So, be careful.
start_index =...
end_index = start_index + int(0.500e6)
sedentary_range = range(start_index, end_index)
sedentary_data = acc_mag[sedentary_range]
plt.plot(range(len(sedentary_data)), sedentary_data)
plt.show()
# (Step 5) Computing beta
# Computing mu
mu =...
# Computing std
sigma =...
# Then, computing beta, using mu and std
beta =...
# (Step 6) Computing M3 for the data
# You can apply beta to identify the data of active behavior.
active_data =...
M3= len(active_data)/len(acc_mag)
# Press the green button in the gutter to run the script.
if __name__=='__main__':
analyze_data(). The ... should be filled. Dataset is already chosen. Thank you. Also how to figure out starting index?
 Overlapping Line Chart for Accelerometer Data. Code base- This is a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!