From 8d0d15665154408abb6a3a5a54ad67d637149517 Mon Sep 17 00:00:00 2001 From: jvdd Date: Thu, 12 Oct 2023 16:26:00 +0200 Subject: [PATCH] :broom: check logging file handlers in advance --- tsflex/features/feature_collection.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tsflex/features/feature_collection.py b/tsflex/features/feature_collection.py index 8aed4b2f..37e2bc96 100644 --- a/tsflex/features/feature_collection.py +++ b/tsflex/features/feature_collection.py @@ -978,6 +978,12 @@ def calculate( + " already a grouped DataFrame!" ) + # Delete other logging handlers + delete_logging_handlers(logger) + # Add logging handler (if path provided) + if logging_file_path: + f_handler = add_logging_handler(logger, logging_file_path) + if ( group_by_all or group_by_consecutive @@ -1001,6 +1007,7 @@ def calculate( ) if group_by_consecutive: + # Strided rollling feature extraction will take place return self._calculate_group_by_consecutive( data, group_by_consecutive, @@ -1012,6 +1019,7 @@ def calculate( n_jobs=n_jobs, ) else: + # Grouped feature extraction will take place if not isinstance(data, pd.core.groupby.generic.DataFrameGroupBy): # group_by_all should not be None (checked by asserts above) assert ( @@ -1028,16 +1036,9 @@ def calculate( data, return_df, show_progress=show_progress, - # logging_file_path=logging_file_path, # TODO n_jobs=n_jobs, ) - # Delete other logging handlers - delete_logging_handlers(logger) - # Add logging handler (if path provided) - if logging_file_path: - f_handler = add_logging_handler(logger, logging_file_path) - # Convert to numpy array (if necessary) if segment_start_idxs is not None: segment_start_idxs = FeatureCollection._process_segment_idxs(