-
Notifications
You must be signed in to change notification settings - Fork 1
Bugfix for Stage.get_driver_source()
#179
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
base: main
Are you sure you want to change the base?
Conversation
…ds to take into consideration.
kyrsjo
left a comment
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.
Overall driver_source logic is weird and inconsistent.
Why is the logic to test driver_source in get_driver_source and not in the property setter? Why is get_driver_source applying extra tests on top of what the property getter/setter is doing (and why is this even necessary, instead of just testing the object type when setting the object?
|
TODO: also rename |
…rce energy from Stage.get_driver_source() to Stage.driver_source setter.
… for valid driver source instances and energy.
… to test for valid driver source instances and energy.
… to test for valid driver source instances and energy.
… for valid driver source instances and energy.
…iver_source in abel/classes/stage/stage.py.
…on in the check for driver source energy if the driver source is a SourceCapsule.
…c.py to use the parent class driver source setter.
…istatic_2d.py to use the parent class driver source setter.
…ced_models.py to use the parent class driver source setter.
…_t.py to use the parent class driver source setter.
kyrsjo
left a comment
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.
Nice! One comment, why is the driver_source setters and getters duplicated in the implementations? Is it just to set the align_beam_axis to true?
Btw couldn't you use self.get_actual_driver_source().align_beam_axis for this?
The driver source setters are overloaded in the implementations to always set |
| if self.driver_source is None: | ||
| raise ValueError('The driver source of the stage is not set.') | ||
| elif isinstance(self.driver_source, DriverComplex): | ||
| driver_source = self.driver_source.source |
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.
Does this effectively return source_in.source.source where source_in is the argument to the driver_source setter?
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.
No, it looks at what is stored in self.driver_source and extracts a Source depending on what type self.driver_source is.
|
Two more questions. |
…l_driver_source().
…et_actual_driver_source().
…et_actual_driver_source().
…l_driver_source().
Added some scenarios to
Stage.get_driver_source()that the method needs to take into consideration.