Skip to content

Bugfix for Stage.get_driver_source()#179

Merged
ben-c-2013 merged 30 commits intomainfrom
bugfix_Stage_get_driver_source
Feb 17, 2026
Merged

Bugfix for Stage.get_driver_source()#179
ben-c-2013 merged 30 commits intomainfrom
bugfix_Stage_get_driver_source

Conversation

@ben-c-2013
Copy link
Collaborator

Added some scenarios to Stage.get_driver_source() that the method needs to take into consideration.

@ben-c-2013 ben-c-2013 added the bug Something isn't working label Dec 15, 2025
Copy link
Collaborator

@kyrsjo kyrsjo left a 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?

@ben-c-2013
Copy link
Collaborator Author

TODO: also rename Stage.get_driver_source() to distinguish it from the Stage.driver_source getter.

…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.
…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.
Copy link
Collaborator

@kyrsjo kyrsjo left a 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?

@ben-c-2013
Copy link
Collaborator Author

abel/classes/stage/impl/stage_basic.py

The driver source setters are overloaded in the implementations to always set driver_source.align_beam_axis = True, so that whenever a driver source is set to these sub classes, the sub classes' driver source setter will ensure this behaviour.

@kyrsjo
Copy link
Collaborator

kyrsjo commented Feb 10, 2026

Two more questions.

Copy link
Collaborator

@kyrsjo kyrsjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! LGTM.

@ben-c-2013 ben-c-2013 merged commit ecc4281 into main Feb 17, 2026
1 check passed
@ben-c-2013 ben-c-2013 deleted the bugfix_Stage_get_driver_source branch February 17, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants