Skip to content

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.

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

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?

Copy link
Collaborator Author

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.

@kyrsjo
Copy link
Collaborator

kyrsjo commented Feb 10, 2026

Two more questions.

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