ADR Suggestion, Dependent Parameters #10
Replies: 2 comments 1 reply
-
Note that in order to update the part of the GUI that displays the changed parameter, you must decorate the setter and getter of the parameter and emit the parameter changed signal, as shown in the example below: from PySide6.QtCore import QObject, Signal, Slot, Property
class Model(QObject):
definedChanged = Signal()
def __init__(self):
self._defined = False
@Property(bool, notify=definedChanged)
def defined(self):
return self._defined
@defined.setter
def defined(self, newValue):
if self._defined == newValue:
return
self._defined = newValue
self.definedChanged.emit() Now every time you assign a new value to the property |
Beta Was this translation helpful? Give feedback.
-
To my understanding we would also need functionality to inform the independent parameter when a new dependent parameter is made dependent. |
Beta Was this translation helpful? Give feedback.
-
General
It can be beneficial in a model to have Parameters which are defined through a relation to other parameters/descriptors. These dependent parameters are defined by their relation and thus should not be fitted during minimization. Their value should be updated when the values of the independent parameters which they depend on are changed. It should be possible to easily convert a dependent parameter to a dependent parameter and vice versa.
Current Implementation
Currently, this is handled by the "constraints" objects which are created separately and then assigned to the parameter, such as:
Requirements
Implementation
Beta Was this translation helpful? Give feedback.
All reactions