-
Notifications
You must be signed in to change notification settings - Fork 2
Remove old parameter #94
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
Conversation
First step to remove old parameter
…e to allow bounds to be undone in one step
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request does not contain a valid label. Please add one of the following labels: ['chore', 'fix', 'bugfix', 'bug', 'enhancement', 'feature', 'dependencies', 'documentation']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request does not contain a valid label. Please add one of the following labels: ['chore', 'fix', 'bugfix', 'bug', 'enhancement', 'feature', 'dependencies', 'documentation']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good, several very minor issues raised.
Once resolved, this can be merged.
@@ -44,8 +45,7 @@ def __init__( | |||
param url: URL of the descriptor | |||
param display_name: Display name of the descriptor | |||
param parent: Parent of the descriptor | |||
|
|||
.. note:: Undo/Redo functionality is implemented for the attributes `variance` and `value`. | |||
.. note:: Undo/Redo functionality is implemented for the attributes `variance`, `error`, `unit` and `value`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we have error
anymore - it's variance
now, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still use error
. We don't need it, since it's just the square root of variance
, but it's used in repr
.
@@ -76,12 +76,14 @@ def __init__( | |||
:param parent: The object which is the parent to this one | |||
|
|||
.. note:: | |||
Undo/Redo functionality is implemented for the attributes `value`, `error`, `min`, `max`, `fixed` | |||
""" | |||
Undo/Redo functionality is implemented for the attributes `value`, `variance`, `error`, `min`, `max`, `bounds`, `fixed`, `unit` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likewise - error
became variance
so we don't need to include it
@@ -92,6 +94,7 @@ def __init__( | |||
if not isinstance(fixed, bool): | |||
raise TypeError('`fixed` must be either True or False') | |||
|
|||
self._fixed = fixed # For fitting, but must be initialized before super().__init__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is nothing about ._fixed
in DescriptorNumber
, which is the base class. Why does self._fixed
need to be initialized here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's complicated. descriptor_number
calls convert_unit
in __init__
(*). This pushes a change to the undo/redo stack, which in its __init__
makes an f string, which calls __repr__
. __repr__
of parameter checks if the parameter is fixed, and returns self._fixed
. If it doesn't exist, we get an error.
(*) This is a bit of a hack, to make sure the units are what they're supposed to be. In earlier discussions, we had issues with units having numbers in them, such as a unit being 10 cm
or similar. The conversion fixes this issue.
Removing the old parameter completely, renaming the
new_variable
tovariable
. Added undo/redo functionality for converting units.