0
0
Просмотр исходного кода

Fixed `comton_combiner.py`

В сезоне HIGH2023 после летнего перерыва стали набирать на той же точке по энергии, что и
в последней до перерыва (641 ГэВ) и при усреднении результаты сливались в одну.
Для решения проблемы добавил `MANUAL_RUNS_SPLIT: list[int]` - список ранов по которым
нужно делить точку на две.
compton 1 год назад
Родитель
Сommit
fc15bbdb0a
1 измененных файлов с 8 добавлено и 2 удалено
  1. 8 2
      compton_combiner.py

+ 8 - 2
compton_combiner.py

@@ -23,6 +23,7 @@ SEASONS = {
     'name': ['PHIOMEGA2012', 'RHO2013', 'BRK2013/16', 'HIGH2017', 'RHO2018', 'HIGH2019', 'LOW2020', 'HIGH2020', 'HIGH2021', 'NNBAR2022', 'HIGH2023'],
     'start_run': [17405, 18809, 32076, 36872, 48938, 70014, 85224, 89973, 98116, 107342, 131913, None],
 }
+MANUAL_RUNS_SPLIT = [0, 150159, np.inf] # list[runs] to manually split point with the same energy
 
 class RunsDBHandler():
     def __init__(self, host: str = 'cmddb', database: str = 'online', user: str = None, password: str = None):
@@ -450,8 +451,13 @@ def process_combined(combined_df: pd.DataFrame, runs_df: pd.DataFrame, compton_d
     
     combined_df = pd.merge(combined_df.drop(['elabel'], axis=1), runs_df[['run', 'elabel', 'luminosity_full']], how='outer')
     combined_df = combined_df.sort_values(by='run')
-        
-    combined_df['point_idx'] = np.cumsum(~np.isclose(combined_df.elabel, combined_df.elabel.shift(1), atol=1e-4))
+    
+    run_bin_split = np.digitize(combined_df.run, MANUAL_RUNS_SPLIT)    
+    is_same_elabel = np.isclose(combined_df.elabel, combined_df.elabel.shift(1), atol=1e-4)
+    is_same_manualbin = np.isclose(run_bin_split, np.roll(run_bin_split, 1))
+    combined_df['point_idx'] = np.cumsum(~(is_same_elabel & is_same_manualbin))
+    # combined_df['point_idx'] = np.cumsum(~np.isclose(combined_df.elabel, combined_df.elabel.shift(1), atol=1e-4))
+    
     combined_df = process_intersected_compton_meas(combined_df)
     combined_df['luminosity'] = combined_df['luminosity'].fillna(0)
     # combined_df.to_csv('file.csv')