araffin / robotics-rl-srl

S-RL Toolbox: Reinforcement Learning (RL) and State Representation Learning (SRL) for Robotics
https://s-rl-toolbox.readthedocs.io
MIT License
607 stars 91 forks source link

[bug report (loadCSV in visualize.py) #56

Open ngcngc1 opened 4 years ago

ngcngc1 commented 4 years ago

when using anaconda installed enviroment.yml in Window 10. I tried training a RL agent on a specific SRL model, error happened in function 'rl_baseline/visyalize.py/loadCSV()' error is cant load file '0.monitor.csv'

after the absolute path of CSV file was added into the function, the file could be found but the 'result' was still empty '[]'

whether this function need some changes in WIN10?

ngcngc1 commented 4 years ago

i have fixed this error and the code is ok using for input_file in monitor_files: t_time = pd.read_csv(input_file, skiprows=1, dtype=np.float64)["t"].values l_l = pd.read_csv(input_file, skiprows=1)["l"].values r_reward = pd.read_csv(input_file, skiprows=1, dtype=np.float64)["r"].values data = np.row_stack((t_time, l_l, r_reward)).transpose() instead of for input_file in monitor_files: data = [] with open(input_file, 'r') as f: f.readlines() f.readlines() for line in f: tmp = line.split(',') t_time = float(tmp[2]) tmp = [t_time, int(tmp[1]), float(tmp[0])] data.append(tmp)