From 9468c9391ba7599a3609c1beab3fab16b867ef27 Mon Sep 17 00:00:00 2001 From: Kai B Date: Tue, 23 May 2017 11:19:52 +0200 Subject: [PATCH 1/4] rename keys to fit new naming scheme --- fact/analysis/core.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fact/analysis/core.py b/fact/analysis/core.py index ed528b4..0399cc6 100644 --- a/fact/analysis/core.py +++ b/fact/analysis/core.py @@ -4,21 +4,21 @@ from .statistics import li_ma_significance -default_theta_off_keys = tuple('Theta_Off_{}_deg'.format(i) for i in range(1, 6)) +default_theta_off_keys = tuple('theta_off_{}_deg'.format(i) for i in range(1, 6)) default_prediction_off_keys = tuple( - 'background_prediction_{}'.format(i) for i in range(1, 6) + 'gamma_off_prediction_{}'.format(i) for i in range(1, 6) ) -off_key_re = re.compile('([a-zA-z1-9]+)_Off_([0-9])(_deg)?') +off_key_re = re.compile('([a-zA-z1-9]+)_off_([0-9])(_deg)?') def calc_run_summary_source_independent( events, runs, prediction_threshold, theta2_cut, - prediction_key='signal_prediction', - theta_key='Theta_deg', + prediction_key='gamma_prediction', + theta_key='theta_deg', theta_off_keys=default_theta_off_keys, ): ''' @@ -82,7 +82,7 @@ def calc_run_summary_source_independent( def split_on_off_source_independent( events, theta2_cut, - theta_key='Theta_deg', + theta_key='theta_deg', theta_off_keys=default_theta_off_keys, ): ''' @@ -125,7 +125,7 @@ def split_on_off_source_independent( def calc_run_summary_source_dependent( events, runs, prediction_threshold, - on_prediction_key='signal_prediction', + on_prediction_key='gamma_prediction', off_prediction_keys=default_prediction_off_keys, ): ''' @@ -179,7 +179,7 @@ def calc_run_summary_source_dependent( def split_on_off_source_dependent( events, prediction_threshold, - on_prediction_key='signal_prediction', + on_prediction_key='gamma_prediction', off_prediction_keys=default_prediction_off_keys, ): ''' @@ -228,9 +228,9 @@ def drop_off_columns(df, off_region, inplace=False): ''' Replace the "On" column with the column of the respective off region. - For example for `off_region = 1`, `Theta` is replaced by - Theta_Off_1 and all Theta_Off_ columns are dropped. - Same for all other columns, containing the pattern `_Off_` + For example for `off_region = 1`, `theta` is replaced by + theta_off_1 and all theta_off_ columns are dropped. + Same for all other columns, containing the pattern `_off_` ''' if inplace is False: df = df.copy() From 4d0c08686f49fedac681e9e444c0dd6666867760 Mon Sep 17 00:00:00 2001 From: Kai B Date: Tue, 23 May 2017 12:43:54 +0200 Subject: [PATCH 2/4] change theta to theta_deg_off ... --- fact/analysis/core.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fact/analysis/core.py b/fact/analysis/core.py index 0399cc6..c2c7ccb 100644 --- a/fact/analysis/core.py +++ b/fact/analysis/core.py @@ -4,13 +4,13 @@ from .statistics import li_ma_significance -default_theta_off_keys = tuple('theta_off_{}_deg'.format(i) for i in range(1, 6)) +default_theta_off_keys = tuple('theta_deg_off_{}'.format(i) for i in range(1, 6)) default_prediction_off_keys = tuple( 'gamma_off_prediction_{}'.format(i) for i in range(1, 6) ) -off_key_re = re.compile('([a-zA-z1-9]+)_off_([0-9])(_deg)?') +off_key_re = re.compile('([a-zA-z1-9]+)_deg_off_([0-9])?') def calc_run_summary_source_independent( @@ -21,6 +21,7 @@ def calc_run_summary_source_independent( theta_key='theta_deg', theta_off_keys=default_theta_off_keys, ): + ''' Calculate run summaries for the given theta^2 and signal prediction cuts. This function requires, that no source dependent features, From b6702df6a4116661b478b763b34176feb48e3412 Mon Sep 17 00:00:00 2001 From: Kai B Date: Tue, 23 May 2017 16:39:18 +0200 Subject: [PATCH 3/4] change regex to capture source dependent features --- fact/analysis/core.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/fact/analysis/core.py b/fact/analysis/core.py index c2c7ccb..99aca29 100644 --- a/fact/analysis/core.py +++ b/fact/analysis/core.py @@ -6,11 +6,11 @@ default_theta_off_keys = tuple('theta_deg_off_{}'.format(i) for i in range(1, 6)) default_prediction_off_keys = tuple( - 'gamma_off_prediction_{}'.format(i) for i in range(1, 6) + 'gamma_prediction_off_{}'.format(i) for i in range(1, 6) ) -off_key_re = re.compile('([a-zA-z1-9]+)_deg_off_([0-9])?') +off_key_re = re.compile('([a-zA-z1-9]+_deg)_off_([0-9])?') def calc_run_summary_source_independent( @@ -21,7 +21,7 @@ def calc_run_summary_source_independent( theta_key='theta_deg', theta_off_keys=default_theta_off_keys, ): - + ''' Calculate run summaries for the given theta^2 and signal prediction cuts. This function requires, that no source dependent features, @@ -239,10 +239,7 @@ def drop_off_columns(df, off_region, inplace=False): for col in df.columns: m = off_key_re.match(col) if m: - on_key, key_region, deg = m.groups() - if deg: - on_key += deg - + on_key, key_region = m.groups() if int(key_region) == off_region: df.drop(on_key, axis=1, inplace=True) df[on_key] = df[col] From 186ed33b46cb425de8f9e14cc30272861c1e627a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Mon, 29 May 2017 10:50:38 +0200 Subject: [PATCH 4/4] Bump version --- fact/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fact/VERSION b/fact/VERSION index 9028ec6..d9df1bb 100644 --- a/fact/VERSION +++ b/fact/VERSION @@ -1 +1 @@ -0.10.5 +0.11.0