Skip to content

CS refurbishment#97

Merged
JeanLucPons merged 1 commit intomainfrom
cs-multiple-prefix-2
Dec 12, 2025
Merged

CS refurbishment#97
JeanLucPons merged 1 commit intomainfrom
cs-multiple-prefix-2

Conversation

@JeanLucPons
Copy link
Copy Markdown
Contributor

@JeanLucPons JeanLucPons commented Dec 12, 2025

I redo the PR due to too much conflicts that I didn't manage to solve in the previous PR

The aim of this PR is:

  • Allow multiple control system to be used.
  • Remove the int_cs() call
  • ignore_external flag in Accelerator.load()
  • Provides a better symmetry between lattices and control systems.

It shows minimum modifications to handle the above and change the way to handle external magnet model and CS backend. This new branch is not compatible with the present Tango backend.
If this PR is accepted then I'll port the Tango backend.

If we decide to limit pyAML to a single control system per Accelerator then this PR is not mandatry and we can change the controls field to control and fix the name to live.

control:
    type: tango.pyaml.controlsystem
    tango_host: ebs-simu-3:10000

pyaml has been tagged to 0.1.1 and deploed on pyPI.
tango-pyaml has been tagged to 0.3.1 and deployed on pyPI. (pyaml dependencies has been set to accelerator-middle-layer<=0.1.1)

New compatible Tango backend is available in this PR

@JeanLucPons
Copy link
Copy Markdown
Contributor Author

JeanLucPons commented Dec 12, 2025

All should be OK to merge.

@JeanLucPons JeanLucPons merged commit 47f61df into main Dec 12, 2025
3 checks passed
@JeanLucPons JeanLucPons deleted the cs-multiple-prefix-2 branch December 12, 2025 09:45
Copy link
Copy Markdown
Contributor

@TeresiaOlsson TeresiaOlsson left a comment

Choose a reason for hiding this comment

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

Only comment I have is that I suggest to not move everything from load_accelerator into accelerator.load() but keep the parts that are file related in fileloader as preparation to later use accelerator.load() to also load from other sources like database etc.

Comment thread pyaml/accelerator.py
return load_accelerator(filename, use_fast_loader)
# Asume that all files are referenced from
# folder where main AML file is stored
if not os.path.exists(filename):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I like moving the call to the factory in here but I suggest to keep the parts about setting the root folder in the fileloader module since it's something connected to loading from file. That would already prepare for later extending the load function to be able to load from database, web server etc. My suggestion is to add a function load_from_file in fileloader that does the file related parts.

rootfolder = os.path.abspath(os.path.dirname(filename))
set_root_folder(rootfolder)
config_dict = load(os.path.basename(filename), None, use_fast_loader)
aml = Factory.depth_first_build(config_dict)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suggest to keep everything up to line 67 and rename the function to load_from_file. We can then later have load_from_database etc which is called from accelerator.load() and use the same factory to build the objects independently of how the config_dict was created.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK I do a PR

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Let's discuss it there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants