import pandas as pd from cycle import cycle import ray ray.init() filepath = "D:/python_project_data/1.csv" origin_data = pd.read_csv(filepath) row_len = origin_data.shape[0] cow_len = origin_data.shape[1] disturb_data = origin_data algorithm_step = cycle.remote() cow_name = "G1.TTXD1_3" contrast_data = pd.DataFrame() contrast_data[cow_name+'_origin'] = origin_data[cow_name] algorithm_step.set_config.remote('{"CYCLE_AMPLITUDE_BASE": 200 , "CYCLE_TIME_BASE": 5 ,"CYCLE_START_ANGLE_BASE": 3.14}') # algorithm_step.set_config('{"CYCLE_TIME_BASE": 5 }') for i in range(0,row_len): futures=algorithm_step.eval.remote(origin_data.loc[i,cow_name],i) disturb_data.loc[i,cow_name]=ray.get(futures) print(disturb_data.loc[:,cow_name]) contrast_data[cow_name+'_disturb'] = disturb_data[cow_name] disturb_data.to_csv("D:/python_project_data/1_disturb.csv", index=False) contrast_data.to_csv("D:/python_project_data/contrast_data.csv", index=False) # 以下均为测试性能用 # print(algorithm_step.config_)