visualization_utils/Iulian_plots/plot_validations.py [11:39]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def get_df_as_avg_for_each_x_coord(reformatted_df, x_coord_name, y_coord_name = "Simulation Time"):
   avg_df_lst = []
   for x_coord in set(reformatted_df[x_coord_name]):
      #print("hola")
      #print(reformatted_df.loc[(reformatted_df[x_coord_name] == x_coord) & (reformatted_df["FARSI or PA"] == "FARSI")])
      simtimes_farsi = list(reformatted_df.loc[(reformatted_df[x_coord_name] == x_coord) & (reformatted_df["FARSI or PA"] == "FARSI")][y_coord_name])
      simtimes_pa = list(reformatted_df.loc[(reformatted_df[x_coord_name] == x_coord) & (reformatted_df["FARSI or PA"] == "PA")][y_coord_name])
      print("simtimes_farsi")
      print(simtimes_farsi)
      print(np.average(simtimes_farsi))
      print("simtimes_pa")
      print(simtimes_pa)
      print(np.average(simtimes_pa))
      avg_df_lst.append([np.average(simtimes_farsi), "FARSI", x_coord])
      avg_df_lst.append([np.average(simtimes_pa), "PA", x_coord])
   return pd.DataFrame(avg_df_lst, columns = ["Simulation Time", "FARSI or PA", x_coord_name])

#not used yet in this script
def get_df_as_avg_for_each_x_coord(reformatted_df, x_coord_name, y_coord_name = "Simulation Time", hue_col = "FARSI or PA"):
   hues = set(list(reformatted_df[hue_col]))
   avg_df_lst = []
   for x_coord in set(reformatted_df[x_coord_name]):
      #print("hola")
      #print(reformatted_df.loc[(reformatted_df[x_coord_name] == x_coord) & (reformatted_df["FARSI or PA"] == "FARSI")])
      for hue in hues:
         selectedy_hue = list(reformatted_df.loc[(reformatted_df[x_coord_name] == x_coord) & (reformatted_df[hue_col] == hue)][y_coord_name])
         avg_df_lst.append([np.average(selectedy_hue), hue, x_coord])
      #simtimes_pa = list(reformatted_df.loc[(reformatted_df[x_coord_name] == x_coord) & (reformatted_df["FARSI or PA"] == "PA")][y_coord_name])
   return pd.DataFrame(avg_df_lst, columns = [y_coord_name, hue_col, x_coord_name])
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



visualization_utils/plotting_Iulian.py [18:46]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def get_df_as_avg_for_each_x_coord(reformatted_df, x_coord_name, y_coord_name = "Simulation Time"):
   avg_df_lst = []
   for x_coord in set(reformatted_df[x_coord_name]):
      #print("hola")
      #print(reformatted_df.loc[(reformatted_df[x_coord_name] == x_coord) & (reformatted_df["FARSI or PA"] == "FARSI")])
      simtimes_farsi = list(reformatted_df.loc[(reformatted_df[x_coord_name] == x_coord) & (reformatted_df["FARSI or PA"] == "FARSI")][y_coord_name])
      simtimes_pa = list(reformatted_df.loc[(reformatted_df[x_coord_name] == x_coord) & (reformatted_df["FARSI or PA"] == "PA")][y_coord_name])
      print("simtimes_farsi")
      print(simtimes_farsi)
      print(np.average(simtimes_farsi))
      print("simtimes_pa")
      print(simtimes_pa)
      print(np.average(simtimes_pa))
      avg_df_lst.append([np.average(simtimes_farsi), "FARSI", x_coord])
      avg_df_lst.append([np.average(simtimes_pa), "PA", x_coord])
   return pd.DataFrame(avg_df_lst, columns = ["Simulation Time", "FARSI or PA", x_coord_name])

#not used yet in this script
def get_df_as_avg_for_each_x_coord(reformatted_df, x_coord_name, y_coord_name = "Simulation Time", hue_col = "FARSI or PA"):
   hues = set(list(reformatted_df[hue_col]))
   avg_df_lst = []
   for x_coord in set(reformatted_df[x_coord_name]):
      #print("hola")
      #print(reformatted_df.loc[(reformatted_df[x_coord_name] == x_coord) & (reformatted_df["FARSI or PA"] == "FARSI")])
      for hue in hues:
         selectedy_hue = list(reformatted_df.loc[(reformatted_df[x_coord_name] == x_coord) & (reformatted_df[hue_col] == hue)][y_coord_name])
         avg_df_lst.append([np.average(selectedy_hue), hue, x_coord])
      #simtimes_pa = list(reformatted_df.loc[(reformatted_df[x_coord_name] == x_coord) & (reformatted_df["FARSI or PA"] == "PA")][y_coord_name])
   return pd.DataFrame(avg_df_lst, columns = [y_coord_name, hue_col, x_coord_name])
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



