1 Star 0 Fork 240

叶子晴 / dsp2022labs_2

forked from Steven / dsp2022labs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
san2.py 1.18 KB
一键复制 编辑 原始数据 按行查看 历史
刘隽卓 提交于 2022-03-10 14:20 . 320200931101
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'))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/schweinye/dsp2022labs_2.git
git@gitee.com:schweinye/dsp2022labs_2.git
schweinye
dsp2022labs_2
dsp2022labs_2
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891