-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_pred_list.py
31 lines (25 loc) · 929 Bytes
/
get_pred_list.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import pandas as pd
root_path = r'D:\dufeilong\datasets\normal'
log_path = os.path.join(root_path, 'log.csv')
pred_fps = [350, 450]
class PredDataLoader(object):
def __init__(self):
self.df = pd.read_csv(log_path)
self.index = None
def __len__(self):
return len(pred_fps) * len(self.df)
def __getitem__(self, item):
# self.index = item
folder_num = item // len(pred_fps)
fps_num = item % len(pred_fps)
folder = str(self.df.iloc[folder_num, 0])
fps = str(pred_fps[fps_num])
path = os.path.join(root_path, folder)
path = os.path.join(path, r'all_particles_' + fps + '.csv')
self.current_folder_index = folder_num
self.current_fps = fps
return path
def save_time(self, time):
self.df.loc[self.current_folder_index, self.current_fps] = time
self.df.to_csv(r'log.csv', index=False)