You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature: Add clear and remove_device to ElementHolder #408
Description, motivation and use case
Add a clear() and remove_device method to ElementHolder to allow to remove elements that have been added using fill_device.
I would like to close this issue. I've tried to look into the implementation and I do not like so much dynamically removing elements. This raises several issues:
You need to rebuilt arrays containing removed element, tuning tools using said arrays, etc.
Removing childs of a combined function magnet
You can have a reference to an element already created somewhere.
bpm = sr.design.diagnostic.bpm['BPM_001']
sr.remove('BPM_001')
# What happens with bpm?
# What happens with orbit correction using said BPM?
# What is we are sending some command to a bpm and remove it "accidentally"
I propose to close this issue as not planned. @TeresiaOlsson what do you think? Either way I personally will not be implementing this.
Why is it not planned? Without this the procedure to create an Accelerator by building the Python objects directly is not nice. It fails if you try to create an Accelerator by giving it a Simulator or ControlSystem which already have Elements attached. Without any form of clear or remove element you either need to call private methods or make a new Simulator or ControlSystem object for it to work.
The tutorials currently include an ugly workaround to make it less obvious to the users that it's not working well.
Activity
gubaidulinvadim commentedon Oct 15, 2026
I would like to close this issue. I've tried to look into the implementation and I do not like so much dynamically removing elements. This raises several issues:
I propose to close this issue as not planned. @TeresiaOlsson what do you think? Either way I personally will not be implementing this.
TeresiaOlsson commentedon Oct 15, 2026
Why is it not planned? Without this the procedure to create an Accelerator by building the Python objects directly is not nice. It fails if you try to create an Accelerator by giving it a Simulator or ControlSystem which already have Elements attached. Without any form of clear or remove element you either need to call private methods or make a new Simulator or ControlSystem object for it to work.
The tutorials currently include an ugly workaround to make it less obvious to the users that it's not working well.