Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BF/OA: Refactoring of instance handling in data stream processing(2) #992

Merged
merged 17 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
a266b87
Refact: StreamTask, OATask - order of processing/adaption on new/obso…
detlefarend May 22, 2024
8ae269c
Refact: StreamTask, OATask - order of processing/adaption on new/obso…
detlefarend May 23, 2024
aeb257f
Refact: StreamTask, OATask - order of processing/adaption on new/obso…
detlefarend May 23, 2024
384d6ba
Refact: StreamTask, OATask - order of processing/adaption on new/obso…
detlefarend May 23, 2024
f710e48
Refact: StreamTask, OATask - order of processing/adaption on new/obso…
detlefarend May 24, 2024
5487808
Refact: StreamTask, OATask - order of processing/adaption on new/obso…
detlefarend May 24, 2024
d09c7de
Refact: StreamTask, OATask - order of processing/adaption on new/obso…
detlefarend May 24, 2024
fdcd4d2
Refact: StreamTask, OATask - order of processing/adaption on new/obso…
detlefarend May 24, 2024
b5700de
Z-trensform fix
laxmikantbaheti May 24, 2024
a6448e3
Merge remote-tracking branch 'origin/bf/oa/streams/refact' into bf/oa…
laxmikantbaheti May 24, 2024
78dc738
Bug: Normalizer Z-Trans needs to be reviewed #993
detlefarend May 24, 2024
56f4d52
Refact: StreamTask, OATask - order of processing/adaption on new/obso…
detlefarend May 24, 2024
fcb9a22
OA: Addition of further cluster properties #994
syamrajsatheesh May 24, 2024
f5cb752
Merge branch 'bf/oa/streams/refact' of https://github.com/fhswf/MLPro…
syamrajsatheesh May 24, 2024
060ee3c
OA: Addition of further cluster properties #994
syamrajsatheesh May 24, 2024
d8aeb94
Refact: StreamTask, OATask - order of processing/adaption on new/obso…
syamrajsatheesh May 24, 2024
96a16c2
Refact: StreamTask, OATask - order of processing/adaption on new/obso…
detlefarend May 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
.. _Howto BF STREAMS 111:
Howto BF-STREAMS-111: Rearranger (2D)
=====================================
.. _Howto BF STREAMS 110:
Howto BF-STREAMS-111: Window (2D)
===============================================

**Prerequisites**

Please install the following packages to run this example properly:

- `Numpy <https://www.numpy.org>`_
- `Matplotlib <https://pypi.org/project/matplotlib/>`_
- `Tkinter <https://pypi.org/project/tk/>`_



**Executable code**

.. literalinclude:: ../../../../../../../../../test/howtos/bf/howto_bf_streams_111_stream_task_rearranger_2d.py
.. literalinclude:: ../../../../../../../../../test/howtos/bf/howto_bf_streams_111_stream_task_window_2d.py
:language: python



**Results**

.. image::
images/streams_rearranger.gif
images/streams_window_2d.gif



Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
.. _Howto BF STREAMS 112:
Howto BF-STREAMS-112: Rearranger (3D)
.. _Howto BF STREAMS 110:
Howto BF-STREAMS-112: Window (3D)
===============================================

**Prerequisites**

Please install the following packages to run this example properly:

- `Numpy <https://www.numpy.org>`_
- `Matplotlib <https://pypi.org/project/matplotlib/>`_
- `Tkinter <https://pypi.org/project/tk/>`_



**Executable code**

.. literalinclude:: ../../../../../../../../../test/howtos/bf/howto_bf_streams_112_stream_task_rearranger_3d.py
.. literalinclude:: ../../../../../../../../../test/howtos/bf/howto_bf_streams_112_stream_task_window_3d.py
:language: python



**Results**

.. image::
images/streams_rearranger_3d.gif
images/streams_window_3d.gif



Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
.. _Howto BF STREAMS 113:
Howto BF-STREAMS-113: Rearranger (nD)
.. _Howto BF STREAMS 110:
Howto BF-STREAMS-111: Window (nD)
===============================================

**Prerequisites**

Please install the following packages to run this example properly:

- `Numpy <https://www.numpy.org>`_
- `Matplotlib <https://pypi.org/project/matplotlib/>`_
- `Tkinter <https://pypi.org/project/tk/>`_



**Executable code**

.. literalinclude:: ../../../../../../../../../test/howtos/bf/howto_bf_streams_113_stream_task_rearranger_nd.py
.. literalinclude:: ../../../../../../../../../test/howtos/bf/howto_bf_streams_113_stream_task_window_nd.py
:language: python



**Results**

.. image::
images/streams_rearranger_nd.gif
images/streams_window_nd.gif



Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.. _Howto BF STREAMS 121:
Howto BF-STREAMS-121: Rearranger (2D)
=====================================

**Prerequisites**

Please install the following packages to run this example properly:

- `Matplotlib <https://pypi.org/project/matplotlib/>`_
- `Tkinter <https://pypi.org/project/tk/>`_


**Executable code**

.. literalinclude:: ../../../../../../../../../test/howtos/bf/howto_bf_streams_121_stream_task_rearranger_2d.py
:language: python



**Results**

.. image::
images/streams_rearranger.gif



**Cross Reference**

- :ref:`API Reference: Streams <target_ap_bf_streams>`
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
.. _Howto BF STREAMS 110:
Howto BF-STREAMS-110: Window
.. _Howto BF STREAMS 122:
Howto BF-STREAMS-122: Rearranger (3D)
===============================================

**Prerequisites**

Please install the following packages to run this example properly:

- `Numpy <https://www.numpy.org>`_
- `Matplotlib <https://pypi.org/project/matplotlib/>`_
- `Tkinter <https://pypi.org/project/tk/>`_



**Executable code**

.. literalinclude:: ../../../../../../../../../test/howtos/bf/howto_bf_streams_110_stream_task_window.py
.. literalinclude:: ../../../../../../../../../test/howtos/bf/howto_bf_streams_122_stream_task_rearranger_3d.py
:language: python



**Results**

.. image::
images/streams_window.gif
images/streams_rearranger_3d.gif



Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.. _Howto BF STREAMS 123:
Howto BF-STREAMS-123: Rearranger (nD)
===============================================

**Prerequisites**

Please install the following packages to run this example properly:

- `Matplotlib <https://pypi.org/project/matplotlib/>`_
- `Tkinter <https://pypi.org/project/tk/>`_



**Executable code**

.. literalinclude:: ../../../../../../../../../test/howtos/bf/howto_bf_streams_123_stream_task_rearranger_nd.py
:language: python



**Results**

.. image::
images/streams_rearranger_nd.gif



**Cross Reference**

- :ref:`API Reference: Streams <target_ap_bf_streams>`
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.. _Howto BF STREAMS 114:
Howto BF-STREAMS-114: Deriver
.. _Howto BF STREAMS 131:
Howto BF-STREAMS-131: Deriver
=============================

**Prerequisites**
Expand All @@ -13,7 +13,7 @@ Please install the following packages to run this example properly:

**Executable code**

.. literalinclude:: ../../../../../../../../../test/howtos/bf/howto_bf_streams_114_stream_task_deriver.py
.. literalinclude:: ../../../../../../../../../test/howtos/bf/howto_bf_streams_131_stream_task_deriver.py
:language: python


Expand Down
7 changes: 4 additions & 3 deletions src/mlpro/bf/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
## -- 2023-03-25 1.1.1 DA Class EventManager: correction in constructor
## -- 2023-11-17 1.2.0 DA Class Event: new time stamp functionality
## -- 2023-11-18 1.2.1 DA Class Event: time stamp is set to now() if not provided
## -- 2024-05-23 1.3.0 DA Method EventManger._raise_event(): reduction to TypeError
## -------------------------------------------------------------------------------------------------

"""
Ver. 1.2.1 (2023-11-18)
Ver. 1.3.0 (2024-05-23)

This module provides classes for event handling. To this regard, the property class Eventmanager is
provided to add event functionality to child classes by inheritence.
Expand Down Expand Up @@ -160,6 +161,6 @@ def _raise_event(self, p_event_id:str, p_event_object:Event):
try:
self.log(Log.C_LOG_TYPE_I, 'Calling handler', i)
handler( p_event_id=p_event_id, p_event_object=p_event_object )
except:
except TypeError:
self.log(Log.C_LOG_TYPE_E, 'Handler not compatible! Check your code!')
raise Error
raise TypeError
58 changes: 24 additions & 34 deletions src/mlpro/bf/math/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
## -- 2024-04-30 1.3.0 DA Class Point: re-normalization added
## -- 2024-05-06 1.4.0 DA Class Point: refactoring
## -- 2024-05-07 1.4.1 DA Bugfix in method Point.renormalize()
## -- 2024-05-24 1.4.2 DA Bugfix in method _update_plot_2d()
## -------------------------------------------------------------------------------------------------

"""
Ver. 1.4.1 (2024-05-07)
Ver. 1.4.2 (2024-05-24)

This module provides class for geometric objects like points, etc.

Expand Down Expand Up @@ -59,43 +60,32 @@ def _update_plot_2d(self, p_settings: PlotSettings, **p_kwargs):

point_pos = self.value

if self._plot_pos is None:
self._plot_pos, = p_settings.axes.plot( point_pos[0],
point_pos[1],
marker='+',
color='red',
linestyle='',
markersize=3 )
if self._plot_pos is not None:
self._plot_pos.remove()

self._plot_pos, = p_settings.axes.plot( point_pos[0],
point_pos[1],
marker='+',
color='red',
linestyle='',
markersize=3 )

else:
self._plot_pos.set_xdata( point_pos[0] )
self._plot_pos.set_ydata( point_pos[1] )
if self._plot_vel is not None:
self._plot_vel.remove()

if self._plot_vel is not None:
self._plot_vel.remove()
try:
point_vel = self.derivatives[1]
except:
return

try:
point_vel = self.derivatives[1]
except:
return

if point_vel is not None:
self._plot_vel = p_settings.axes.arrow( point_pos[0],
point_pos[1],
point_vel[0],
point_vel[1],
color='red' )
if point_vel is not None:
self._plot_vel = p_settings.axes.arrow( point_pos[0],
point_pos[1],
point_vel[0],
point_vel[1],
color='red' )

# self._plot_vel = p_settings.axes.quiver( np.array([point_pos[0]]),
# np.array([point_pos[1]]),
# np.array([point_vel[0]]),
# np.array([point_vel[1]]),
# #scale = 1,
# units = 'dots',
# width = 2,
# color='red' )



## -------------------------------------------------------------------------------------------------
def _update_plot_3d(self, p_settings: PlotSettings, **p_kwargs):

Expand Down
11 changes: 6 additions & 5 deletions src/mlpro/bf/math/normalizers/basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
## -- 2023-01-12 1.0.13 LSB Bug Fix
## -- 2023-02-13 1.0.14 LSB BugFix: Changed the direct reference to p_param to a copy object
## -- 2024-04-30 1.1.0 DA Refactoring and new class Renormalizable
## -- 2024-05-23 1.2.0 DA Method Normalizer._set_parameters(): little optimization
## -------------------------------------------------------------------------------------------------

"""
Ver. 1.1.0 (2024-04-30)
Ver. 1.2.0 (2024-05-23)

This module provides base class for Normalizers and normalizer objects including MinMax normalization and
normalization by Z transformation.
Expand All @@ -44,21 +45,21 @@
## -------------------------------------------------------------------------------------------------
class Normalizer:
"""
Base template class for normalizer objects.
Base class for normalizers.
"""

## -------------------------------------------------------------------------------------------------
def __init__(self):

self._param = None
self._param = None
self._param_old = None
self._param_new = None


## -------------------------------------------------------------------------------------------------
def _set_parameters(self, p_param):
"""
custom method to set the normalization parameters
Custom method to set the normalization parameters

Parameters
----------
Expand All @@ -70,7 +71,7 @@ def _set_parameters(self, p_param):
boolean:True
Returns true after setting the parameters
"""
self._param = p_param.copy()
self._param = p_param


## -------------------------------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion src/mlpro/bf/math/normalizers/minmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,3 @@ def update_parameters(self, p_set: Set = None, p_boundaries: Union[list, np.ndar
else:
self._param_old = self._param_new.copy()
self._param = self._param_new.copy()
pass
Loading
Loading