diff --git a/saqc/funcs/modelling.py b/saqc/funcs/modelling.py index 3c48457f8c2463c891f854579233e4fe0650e4cb..38d2dbc95fecf7bb5c82de5b161654a71f8ccea7 100644 --- a/saqc/funcs/modelling.py +++ b/saqc/funcs/modelling.py @@ -432,7 +432,7 @@ def _reduceCPCluster(stat_arr, thresh_arr, start, end, obj_func, num_val): @register(masking='field') def modelling_clusterByChangePoints(data, field, flagger, stat_func, thresh_func, bwd_window, min_periods_bwd, fwd_window=None, min_periods_fwd=None, closed='both', try_to_jit=True, - reduce_window=None, reduce_func=lambda x, y: x.argmax(), **kwargs): + reduce_window=None, reduce_func=lambda x, y: x.argmax(), flag_changepoints=False, **kwargs): """ Assigns label to the data, aiming to reflect continous regimes of the processes the data is assumed to be generated by. @@ -536,4 +536,6 @@ def modelling_clusterByChangePoints(data, field, flagger, stat_func, thresh_func cluster = cluster.cumsum() data[field] = cluster flagger = flagger.setFlags(field, flag=flagger.UNFLAGGED, force=True, **kwargs) + if flag_changepoints: + flagger.setFlags(field, loc=det_index) return data, flagger \ No newline at end of file