diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/30_anomaly_detection/20_cluster_based.rst b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/30_anomaly_detection/20_cluster_based.rst.off similarity index 100% rename from doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/30_anomaly_detection/20_cluster_based.rst rename to doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/30_anomaly_detection/20_cluster_based.rst.off diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/instance_based/images/.$MLPro-OA-CB-Drift-Detectors_class_diagram.drawio.bkp b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/30_anomaly_detection/images/.$MLPro-OA-Anomaly-Detectors_class_diagram.drawio.bkp similarity index 55% rename from doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/instance_based/images/.$MLPro-OA-CB-Drift-Detectors_class_diagram.drawio.bkp rename to doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/30_anomaly_detection/images/.$MLPro-OA-Anomaly-Detectors_class_diagram.drawio.bkp index 3e94fcfa5..b5e6b091a 100644 --- a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/instance_based/images/.$MLPro-OA-CB-Drift-Detectors_class_diagram.drawio.bkp +++ b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/30_anomaly_detection/images/.$MLPro-OA-Anomaly-Detectors_class_diagram.drawio.bkp @@ -1,6 +1,6 @@ - + - + @@ -54,94 +54,83 @@ - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - - - - + + - - + + - - + + - - - - - - - - diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/30_anomaly_detection/images/MLPro-OA-Anomaly-Detectors_class_diagram.drawio b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/30_anomaly_detection/images/MLPro-OA-Anomaly-Detectors_class_diagram.drawio index b5e6b091a..b7999af44 100644 --- a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/30_anomaly_detection/images/MLPro-OA-Anomaly-Detectors_class_diagram.drawio +++ b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/30_anomaly_detection/images/MLPro-OA-Anomaly-Detectors_class_diagram.drawio @@ -5,7 +5,7 @@ - + @@ -55,7 +55,7 @@ - + @@ -71,41 +71,44 @@ + + + - + - + - - + + - + - + - + - - + + - + - + - + - + - + diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/30_anomaly_detection/images/MLPro-OA-Anomaly-Detectors_class_diagram.drawio.png b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/30_anomaly_detection/images/MLPro-OA-Anomaly-Detectors_class_diagram.drawio.png index 3a64bc22e..8e1b79e1b 100644 Binary files a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/30_anomaly_detection/images/MLPro-OA-Anomaly-Detectors_class_diagram.drawio.png and b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/30_anomaly_detection/images/MLPro-OA-Anomaly-Detectors_class_diagram.drawio.png differ diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection.rst b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection.rst index ace896105..a3ada2997 100644 --- a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection.rst +++ b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection.rst @@ -2,11 +2,11 @@ Drift detection =============== -.. image:: images/MLPro-OA-Drift-Detectors_class_diagram.drawio.png +.. image:: 40_drift_detection/images/MLPro-OA-Drift-Detectors_class_diagram.drawio.png :scale: 50% -.. automodule:: mlpro.oa.streams.tasks.driftydetectors.basics +.. automodule:: mlpro.oa.streams.tasks.driftdetectors.basics :members: :undoc-members: :private-members: diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_common_drifts.rst b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_common_drifts.rst deleted file mode 100644 index dcb3085f4..000000000 --- a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_common_drifts.rst +++ /dev/null @@ -1,10 +0,0 @@ -.. _target_api_oa_stream_tasks_ad_common_drifts: -Common drifts -============= - - -.. toctree:: - :maxdepth: 2 - :glob: - - common_drifts/* \ No newline at end of file diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_instance_based.rst b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_instance_based.rst new file mode 100644 index 000000000..7b3936d64 --- /dev/null +++ b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_instance_based.rst @@ -0,0 +1,28 @@ +.. _target_api_oa_stream_tasks_dd_ib: +Instance-based drifts and detectors +=================================== + + +.. image:: 10_instance_based/images/MLPro-OA-Drift-Detectors-IB_class_diagram.drawio.png + :scale: 50% + + +.. automodule:: mlpro.oa.streams.tasks.driftdetectors.instancebased.basics + :members: + :undoc-members: + :private-members: + :show-inheritance: + + +.. automodule:: mlpro.oa.streams.tasks.driftdetectors.drifts.instancebased.basics + :members: + :undoc-members: + :private-members: + :show-inheritance: + + +.. toctree:: + :maxdepth: 2 + :glob: + + 10_instance_based/* \ No newline at end of file diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_instance_based/10_common_drifts.rst b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_instance_based/10_common_drifts.rst new file mode 100644 index 000000000..52acb232f --- /dev/null +++ b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_instance_based/10_common_drifts.rst @@ -0,0 +1,9 @@ +.. _target_api_oa_stream_tasks_ad_common_drifts: +Common drifts +============= + +.. automodule:: mlpro.oa.streams.tasks.driftdetectors.drifts.instancebased.basics + :members: + :undoc-members: + :private-members: + :show-inheritance: diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_common_algorithms.rst b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_instance_based/20_common_algorithms.rst similarity index 58% rename from doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_common_algorithms.rst rename to doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_instance_based/20_common_algorithms.rst index ae5e1efb6..436df8fd4 100644 --- a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_common_algorithms.rst +++ b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_instance_based/20_common_algorithms.rst @@ -2,9 +2,3 @@ Common algorithms ================= - -.. toctree:: - :maxdepth: 2 - :glob: - - common_algorithms/* \ No newline at end of file diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/40_drift_detectors.rst b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_instance_based/40_drift_detectors.rst similarity index 100% rename from doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/40_drift_detectors.rst rename to doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_instance_based/40_drift_detectors.rst diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/cluster_based/images/MLPro-OA-CB-Drift-Detectors_class_diagram.drawio b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_instance_based/images/MLPro-OA-CB-Drift-Detectors_class_diagram.drawio similarity index 100% rename from doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/cluster_based/images/MLPro-OA-CB-Drift-Detectors_class_diagram.drawio rename to doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/10_instance_based/images/MLPro-OA-CB-Drift-Detectors_class_diagram.drawio diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_cluster_based.rst b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_cluster_based.rst new file mode 100644 index 000000000..a09ae88b9 --- /dev/null +++ b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_cluster_based.rst @@ -0,0 +1,28 @@ +.. _target_api_oa_stream_tasks_dd_cb: +Cluster-based drifts and detectors +=================================== + + +.. image:: 20_cluster_based/images/MLPro-OA-Drift-Detectors-CB_class_diagram.drawio.png + :scale: 50% + + +.. automodule:: mlpro.oa.streams.tasks.driftdetectors.clusterbased.basics + :members: + :undoc-members: + :private-members: + :show-inheritance: + + +.. automodule:: mlpro.oa.streams.tasks.driftdetectors.drifts.clusterbased.basics + :members: + :undoc-members: + :private-members: + :show-inheritance: + + +.. toctree:: + :maxdepth: 2 + :glob: + + 20_cluster_based/* \ No newline at end of file diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/cluster_based/30_cluster_based.rst b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_cluster_based/30_cluster_based.rst similarity index 100% rename from doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/cluster_based/30_cluster_based.rst rename to doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_cluster_based/30_cluster_based.rst diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/cluster_based/algorithms/.gitkeep b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_cluster_based/algorithms/.gitkeep similarity index 100% rename from doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/cluster_based/algorithms/.gitkeep rename to doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_cluster_based/algorithms/.gitkeep diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/cluster_based/anomalies/.gitkeep b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_cluster_based/anomalies/.gitkeep similarity index 100% rename from doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/cluster_based/anomalies/.gitkeep rename to doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_cluster_based/anomalies/.gitkeep diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/cluster_based/images/.$MLPro-OA-CB-Drift-Detectors_class_diagram.drawio.bkp b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_cluster_based/images/.$MLPro-OA-CB-Drift-Detectors_class_diagram.drawio.bkp similarity index 100% rename from doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/cluster_based/images/.$MLPro-OA-CB-Drift-Detectors_class_diagram.drawio.bkp rename to doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_cluster_based/images/.$MLPro-OA-CB-Drift-Detectors_class_diagram.drawio.bkp diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/instance_based/images/MLPro-OA-CB-Drift-Detectors_class_diagram.drawio b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_cluster_based/images/MLPro-OA-CB-Drift-Detectors_class_diagram.drawio similarity index 100% rename from doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/instance_based/images/MLPro-OA-CB-Drift-Detectors_class_diagram.drawio rename to doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/20_cluster_based/images/MLPro-OA-CB-Drift-Detectors_class_diagram.drawio diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/images/.$MLPro-OA-Drift-Detectors_class_diagram.drawio.bkp b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/images/.$MLPro-OA-Drift-Detectors_class_diagram.drawio.bkp deleted file mode 100644 index 3e94fcfa5..000000000 --- a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/images/.$MLPro-OA-Drift-Detectors_class_diagram.drawio.bkp +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/images/MLPro-OA-Drift-Detectors_class_diagram.drawio b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/images/MLPro-OA-Drift-Detectors_class_diagram.drawio index cec6402bb..08c9efd0d 100644 --- a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/images/MLPro-OA-Drift-Detectors_class_diagram.drawio +++ b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/images/MLPro-OA-Drift-Detectors_class_diagram.drawio @@ -1,11 +1,11 @@ - + - + - + @@ -54,8 +54,8 @@ - - + + @@ -68,44 +68,47 @@ - - - - + - - + + - - + + - - + + + + + - + - + - + - - + + - + - + - + + + + - - + + diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/images/MLPro-OA-Drift-Detectors_class_diagram.drawio.png b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/images/MLPro-OA-Drift-Detectors_class_diagram.drawio.png index ced368a20..eff45b727 100644 Binary files a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/images/MLPro-OA-Drift-Detectors_class_diagram.drawio.png and b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/images/MLPro-OA-Drift-Detectors_class_diagram.drawio.png differ diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/instance_based/algorithms/.gitkeep b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/instance_based/algorithms/.gitkeep deleted file mode 100644 index 8d1c8b69c..000000000 --- a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/instance_based/algorithms/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/instance_based/anomalies/.gitkeep b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/instance_based/anomalies/.gitkeep deleted file mode 100644 index 8d1c8b69c..000000000 --- a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/instance_based/anomalies/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/instance_based/anomalies/03_drift.rst b/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/instance_based/anomalies/03_drift.rst deleted file mode 100644 index 9ad3c0558..000000000 --- a/doc/rtd/content/99_appendices/appendix2/sub/mlpro_oa/streams/40_drift_detection/instance_based/anomalies/03_drift.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. _target_api_oa_stream_tasks_dd_common_anomalies_drift: -Drift -===== - -.. automodule:: mlpro.oa.streams.tasks.driftdetectors.anomalies.drift - :members: - :undoc-members: - :private-members: - :show-inheritance: \ No newline at end of file diff --git a/src/mlpro/oa/streams/tasks/anomalydetectors/basics.py b/src/mlpro/oa/streams/tasks/anomalydetectors/basics.py index a132a6f87..dd3253f42 100644 --- a/src/mlpro/oa/streams/tasks/anomalydetectors/basics.py +++ b/src/mlpro/oa/streams/tasks/anomalydetectors/basics.py @@ -16,10 +16,11 @@ ## -- 2024-08-12 1.4.1 DA Correction in AnomalyDetector.update_plot() ## -- 2024-12-11 1.4.2 DA Pseudo classes if matplotlib is not installed ## -- 2025-02-14 1.5.0 DA Review and refactoring +## -- 2025-03-03 1.5.1 DA Corrections ## ------------------------------------------------------------------------------------------------- """ -Ver. 1.5.0 (2025-02-12) +Ver. 1.5.1 (2025-03-03) This module provides templates for anomaly detection to be used in the context of online adaptivity. """ @@ -60,6 +61,8 @@ class AnomalyDetector (OAStreamTask): Boolean switch for visualisation. Default = False. p_logging Log level (see constants of class Log). Default: Log.C_LOG_ALL + p_anomaly_buffer_size : int = 100 + Size of the internal anomaly buffer self.anomalies. Default = 100. p_kwargs : dict Further optional named parameters. """ @@ -76,7 +79,7 @@ def __init__( self, p_duplicate_data : bool = False, p_visualize : bool = False, p_logging=Log.C_LOG_ALL, - p_anomaly_buffer_size : int = 10, + p_anomaly_buffer_size : int = 100, **p_kwargs ): super().__init__( p_name = p_name, diff --git a/src/mlpro/oa/streams/tasks/driftdetectors/basics.py b/src/mlpro/oa/streams/tasks/driftdetectors/basics.py index 3c36d0b1e..618b6528d 100644 --- a/src/mlpro/oa/streams/tasks/driftdetectors/basics.py +++ b/src/mlpro/oa/streams/tasks/driftdetectors/basics.py @@ -6,10 +6,11 @@ ## -- History : ## -- yyyy-mm-dd Ver. Auth. Description ## -- 2025-02-12 0.1.0 DA Creation +## -- 2025-03-03 0.2.0 DA Alignment with anomaly detection ## ------------------------------------------------------------------------------------------------- """ -Ver. 0.1.0 (2025-02-12) +Ver. 0.2.0 (2025-03-03) This module provides templates for drift detection to be used in the context of online adaptivity. """ @@ -49,6 +50,8 @@ class DriftDetector (OAStreamTask): Boolean switch for visualisation. Default = False. p_logging Log level (see constants of class Log). Default: Log.C_LOG_ALL + p_drift_buffer_size : int = 100 + Size of the internal drift buffer self.drifts. Default = 100. p_kwargs : dict Further optional named parameters. """ @@ -65,6 +68,7 @@ def __init__( self, p_duplicate_data : bool = False, p_visualize : bool = False, p_logging=Log.C_LOG_ALL, + p_drift_buffer_size : int = 100, **p_kwargs ): super().__init__( p_name = p_name, @@ -75,24 +79,11 @@ def __init__( self, p_logging = p_logging, **p_kwargs ) - self._drift_id = 0 - self._drifts = {} + self._drift_id = 0 + self.drifts = {} + self._drift_buffer_size : int = p_drift_buffer_size -## ------------------------------------------------------------------------------------------------- - def get_drifts(self): - """ - Method to return the current list of drifts. - - Returns - ------- - drifts : dict[Drift] - Current dictionary of drifts. - """ - - return self._drifts - - ## ------------------------------------------------------------------------------------------------- def _get_next_drift_id(self): """ @@ -118,8 +109,19 @@ def _buffer_drift(self, p_drift:Drift): Drift object to be added. """ + # 1 Buffering turned on? + if self._drift_buffer_size <= 0: return + + # 2 Buffer full? + if len( self.drifts ) >= self._drift_buffer_size: + # 2.1 Remove oldest entry + oldest_key = next(iter(self.drifts)) + oldest_drift = self.drifts.pop(oldest_key) + oldest_drift.remove_plot() + + # 3 Buffer new anomaly p_drift.id = self._get_next_drift_id() - self._drifts[p_drift.id] = p_drift + self.drifts[p_drift.id] = p_drift ## ------------------------------------------------------------------------------------------------- @@ -134,11 +136,11 @@ def _remove_drift(self, p_drift:Drift): """ p_drift.remove_plot(p_refresh=True) - del self._drifts[p_drift.id] + del self.drifts[p_drift.id] ## ------------------------------------------------------------------------------------------------- - def _raise_drift_event( self, p_drift : Drift ): + def _raise_drift_event( self, p_drift : Drift, p_buffer: bool = True ): """ Specialized method to raise drift events. @@ -148,12 +150,14 @@ def _raise_drift_event( self, p_drift : Drift ): Drift event object to be raised. """ - self._buffer_drift( p_drift = p_drift ) + if p_buffer: self._buffer_drift( p_drift = p_drift ) if self.get_visualization(): - p_drift.init_plot( p_figure=self._figure, p_plot_settings=self.get_plot_settings() ) + p_drift.init_plot( p_figure=self._figure, + p_plot_settings=self.get_plot_settings() ) - return super()._raise_event( p_event_id = p_drift.event_id, p_event_object = p_drift ) + return super()._raise_event( p_event_id = p_drift.event_id, + p_event_object = p_drift ) ## ------------------------------------------------------------------------------------------------- @@ -167,7 +171,7 @@ def init_plot(self, p_figure: Figure = None, p_plot_settings: PlotSettings = Non super().init_plot( p_figure=p_figure, p_plot_settings=p_plot_settings) - for drift in self._drifts.values(): + for drift in self.drifts.values(): drift.init_plot(p_figure=p_figure, p_plot_settings = p_plot_settings) @@ -198,7 +202,7 @@ def update_plot(self, p_inst : InstDict = None, **p_kwargs): self._plot_ax_ylim = ax_ylim_new self._plot_ax_zlim = ax_zlim_new - for drift in self._drifts.values(): + for drift in self.drifts.values(): drift.update_plot( p_axlimits_changed = axlimits_changed, p_xlim = ax_xlim_new, p_ylim = ax_ylim_new, @@ -213,5 +217,21 @@ def remove_plot(self, p_refresh: bool = True): # super().remove_plot( p_refresh = p_refresh ) - for drift in self._drifts.values(): - drift.remove_plot(p_refresh=p_refresh) \ No newline at end of file + for drift in self.drifts.values(): + drift.remove_plot(p_refresh=p_refresh) + + +## ------------------------------------------------------------------------------------------------- + def _renormalize(self, p_normalizer): + """ + Internal renormalization of all buffered drifts. See method OATask.renormalize_on_event() + for further information. + + Parameters + ---------- + p_normalizer : Normalizer + Normalizer object to be applied on task-specific + """ + + for drift in self.drifts.values(): + drift.renormalize( p_normalizer=p_normalizer ) \ No newline at end of file