Skip to content

Commit

Permalink
OA: Design updates on cluster analysis #1015
Browse files Browse the repository at this point in the history
  • Loading branch information
detlefarend committed Jun 30, 2024
1 parent 66b5e2d commit ab3cdd7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 14 deletions.
15 changes: 12 additions & 3 deletions src/mlpro/bf/math/geometry/hypercuboid.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
## -- 2024-06-03 1.0.0 DA First implementation
## -- 2024-06-05 1.0.1 DA Stabilization of Hypercuboid.set()
## -- 2024-06-26 1.1.0 DA Refactoring of attribute color
## -- 2024-06-30 1.2.0 DA Refactoring of method Hypercuboid.set()
## -------------------------------------------------------------------------------------------------

"""
Ver. 1.1.0 (2024-06-26)
Ver. 1.2.0 (2024-06-30)
This module provides a property class for the geometric shape 'hypercuboid'.
Expand Down Expand Up @@ -91,8 +92,16 @@ def _get(self):


## -------------------------------------------------------------------------------------------------
def set(self, p_value, p_time_stamp : Union[datetime, int, float] = None):
super().set( p_value = p_value, p_time_stamp = p_time_stamp )
def set( self,
p_value,
p_time_stamp : Union[datetime, int, float] = None,
p_upd_time_stamp : bool = True,
p_upd_derivatives : bool = True ):

super().set( p_value = p_value,
p_time_stamp = p_time_stamp,
p_upd_time_stamp = p_upd_time_stamp,
p_upd_derivatives = p_upd_derivatives )

if p_value is None:
self.center_geo.value = None
Expand Down
33 changes: 22 additions & 11 deletions src/mlpro/bf/math/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@
## -- 2024-06-06 1.2.0 DA New custom method Properties._update_property_links()
## -- 2024-06-16 1.3.0 DA New method Properties.get_property_definitions()
## -- 2024-06-26 1.4.0 DA New method Properties.set_plot_color()
## -- 2024-06-30 1.5.0 DA Method Property.set(): new parameters p_upd_time_stamp,
## -- p_upd_derivatives
## -------------------------------------------------------------------------------------------------

"""
Ver. 1.4.0 (2024-06-26)
Ver. 1.5.0 (2024-06-30)
This module provides a systematics for enriched managed properties. MLPro's enriched properties
store any data like class attributes and they can be used like class attributes. They extend the
Expand Down Expand Up @@ -142,7 +144,11 @@ def _get_prev(self):


## -------------------------------------------------------------------------------------------------
def set(self, p_value, p_time_stamp : Union[datetime, int, float] = None):
def set( self,
p_value,
p_time_stamp : Union[datetime, int, float] = None,
p_upd_time_stamp : bool = True,
p_upd_derivatives : bool = True ):
"""
Sets the value of a property at a given time point.
Expand All @@ -155,6 +161,10 @@ def set(self, p_value, p_time_stamp : Union[datetime, int, float] = None):
p_time_stamp : : Union[datetime, int, float]
Optional time stamp of type datetime, int or float. If not provided, an internal continuous
integer time stamp is generated.
p_upd_time_stamp : bool
Boolean switch to enable/disable updating the inner time stamps.
p_upd_derivatives : bool
Boolean swtich to enable/disable updating the derivatives.
"""

# 1 Set value
Expand All @@ -163,19 +173,20 @@ def set(self, p_value, p_time_stamp : Union[datetime, int, float] = None):


# 2 Preparation of time stamp
self._time_stamp_prev = self._time_stamp
if p_upd_time_stamp:
self._time_stamp_prev = self._time_stamp

if p_time_stamp is None:
try:
self._time_stamp = self._time_stamp_prev + 1
except:
self._time_stamp = 0
else:
self._time_stamp = p_time_stamp
if p_time_stamp is None:
try:
self._time_stamp = self._time_stamp_prev + 1
except:
self._time_stamp = 0
else:
self._time_stamp = p_time_stamp


# 3 Numeric derivation
if self._derivative_order_max > 0:
if p_upd_derivatives and ( self._derivative_order_max > 0 ):

# 3.1 Computation of time delta
if self._time_stamp_prev is not None:
Expand Down

0 comments on commit ab3cdd7

Please sign in to comment.