|
|
@@ -540,7 +540,7 @@ def final_table_to_clbrdb(df: pd.DataFrame, clbrdb: CalibrdbHandler, runs_df: pd
|
|
|
|
|
|
def save_csv(df: pd.DataFrame, filepath: str, update_current: bool = True):
|
|
|
"""Saves csv file. Updates current file in filepath if exists"""
|
|
|
-
|
|
|
+
|
|
|
logging.info(f'Saving csv file: len(df)={len(df)}, filepath={filepath}, update_current={update_current}')
|
|
|
if (os.path.isfile(filepath) and update_current):
|
|
|
df_current = pd.read_csv(filepath)
|
|
|
@@ -548,7 +548,12 @@ def save_csv(df: pd.DataFrame, filepath: str, update_current: bool = True):
|
|
|
df_current = pd.concat([df_current, df], ignore_index=True)
|
|
|
df_current = df_current.drop_duplicates(subset=['energy_point', 'first_run'], keep='last')
|
|
|
df = df_current
|
|
|
-
|
|
|
+
|
|
|
+ # Format columns
|
|
|
+ df['mean_energy'] = df['mean_energy'].map("{:.3f}".format)
|
|
|
+ for col in ['mean_energy_stat_err', 'mean_energy_sys_err', 'mean_spread', 'mean_spread_stat_err']:
|
|
|
+ df[col] = df[col].map("{:.4f}".format)
|
|
|
+
|
|
|
df.to_csv(filepath, index=False, float_format='%g')
|
|
|
return
|
|
|
|