代码拉取完成,页面将自动刷新
同步操作将从 Steven/dsp2022labs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import pandas as pd
path = 'C:\\Users\dell\Downloads\gaze.csv'
with open(path) as file:
data = pd.read_csv(file)
#lab4
time = data['gaze_timestamp']
numbers = len(data) - 1
total = 0
for i in range(numbers):
a = time.iloc[i + 1]
b = time.iloc[i]
c = a - b
total = total + c
mean = total / numbers
hz = 1 / mean
print(hz,"hz")
#lab1
data = data[data['confidence'] >= 0.9]
print("1:",len(data))
#lab3
mean_x = 0.41023
mean_y = 0.43832
sigma_x = 0.209525812
sigma_y = 0.216087662
a = mean_x + 3*sigma_x
b = mean_x - 3*sigma_x
c = mean_y + 3*sigma_y
d = mean_y - 3*sigma_y
data = data[(data['norm_pos_x'] > b) & (data['norm_pos_x'] < a)]
data = data[(data['norm_pos_y'] > d) & (data['norm_pos_x'] < c)]
print("2:",len(data))
#lab5
time = 88150.78
while time < 88151.28:
e = []
stamp = data['gaze_timestamp']
for i in range(len(data)):
a = stamp.iloc[i]
b = a - time
e.append(b)
location = e.index(min(e))
print(data.iloc[location])
time = time + 0.02
#lab3
data['gaze_timestamp'] = pd.to_datetime(data['gaze_timestamp'],unit = 's', origin = pd.Timestamp('1970-01-02T17:44:30.225707'))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。