laura-accelerator 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- laura_accelerator-0.2.0/.github/workflows/python-publish.yml +44 -0
- laura_accelerator-0.2.0/.gitignore +172 -0
- laura_accelerator-0.2.0/PKG-INFO +199 -0
- laura_accelerator-0.2.0/README.md +170 -0
- laura_accelerator-0.2.0/Testing/.gitignore +21 -0
- laura_accelerator-0.2.0/Testing/FEBE_2_Bunches.def +42 -0
- laura_accelerator-0.2.0/Testing/GUI/__main__.py +85 -0
- laura_accelerator-0.2.0/Testing/Settings/250pC/1/FEBE_transverse_best_changes.yaml +34 -0
- laura_accelerator-0.2.0/Testing/Settings/250pC/1/S07_transverse_best_changes_Simple.yaml +20 -0
- laura_accelerator-0.2.0/Testing/Settings/250pC/1/nelder_mead_best_changes_Simple.yaml +25 -0
- laura_accelerator-0.2.0/Testing/Settings/250pC/1/transverse_best_changes_upto_S07_Simple.yaml +36 -0
- laura_accelerator-0.2.0/Testing/__init__.py +0 -0
- laura_accelerator-0.2.0/Testing/cameras.py +13 -0
- laura_accelerator-0.2.0/Testing/convert_SimFrame.py +62 -0
- laura_accelerator-0.2.0/Testing/convert_yaml.py +47 -0
- laura_accelerator-0.2.0/Testing/make_model_from_scratch.py +85 -0
- laura_accelerator-0.2.0/Testing/padantic.py +35 -0
- laura_accelerator-0.2.0/Testing/save_machine.py +57 -0
- laura_accelerator-0.2.0/Testing/test.yaml +67 -0
- laura_accelerator-0.2.0/Testing/test_currents.yaml +28 -0
- laura_accelerator-0.2.0/Testing/unit_tests/PAdantic/__init__.py +0 -0
- laura_accelerator-0.2.0/Testing/unit_tests/PAdantic/models/__init__.py +0 -0
- laura_accelerator-0.2.0/Testing/unit_tests/PAdantic/models/test_element.py +123 -0
- laura_accelerator-0.2.0/Testing/unit_tests/PAdantic/test_padantic.py +131 -0
- laura_accelerator-0.2.0/Testing/unit_tests/__init__.py +0 -0
- laura_accelerator-0.2.0/docs/Makefile +20 -0
- laura_accelerator-0.2.0/docs/make.bat +35 -0
- laura_accelerator-0.2.0/docs/rebuild.sh +4 -0
- laura_accelerator-0.2.0/docs/requirements.txt +7 -0
- laura_accelerator-0.2.0/docs/source/Architecture/Element.rst +489 -0
- laura_accelerator-0.2.0/docs/source/Architecture/Lattice.rst +208 -0
- laura_accelerator-0.2.0/docs/source/Architecture/assets/element-structure.png +0 -0
- laura_accelerator-0.2.0/docs/source/Architecture/assets/lattice-structure.png +0 -0
- laura_accelerator-0.2.0/docs/source/Architecture/index.rst +11 -0
- laura_accelerator-0.2.0/docs/source/Auxiliary.rst +81 -0
- laura_accelerator-0.2.0/docs/source/Element.rst +61 -0
- laura_accelerator-0.2.0/docs/source/Examples.rst +463 -0
- laura_accelerator-0.2.0/docs/source/Translator/Fields.rst +190 -0
- laura_accelerator-0.2.0/docs/source/Translator/index.rst +10 -0
- laura_accelerator-0.2.0/docs/source/Translator.rst +360 -0
- laura_accelerator-0.2.0/docs/source/conf.py +211 -0
- laura_accelerator-0.2.0/docs/source/index.rst +64 -0
- laura_accelerator-0.2.0/docs/source/laura.models.rst +167 -0
- laura_accelerator-0.2.0/docs/source/laura.rst +32 -0
- laura_accelerator-0.2.0/docs/source/modules.rst +7 -0
- laura_accelerator-0.2.0/docs/source/references.bib +131 -0
- laura_accelerator-0.2.0/laura/Exporters/CATAP.py +44 -0
- laura_accelerator-0.2.0/laura/Exporters/Export_CATAP_YAML.py +11 -0
- laura_accelerator-0.2.0/laura/Exporters/YAML.py +61 -0
- laura_accelerator-0.2.0/laura/Exporters/__init__.py +0 -0
- laura_accelerator-0.2.0/laura/Importers/CATAP_Loader.py +155 -0
- laura_accelerator-0.2.0/laura/Importers/CLARA Magnet Table v6.xlsx +0 -0
- laura_accelerator-0.2.0/laura/Importers/Magnet_Table.py +61 -0
- laura_accelerator-0.2.0/laura/Importers/MySafeConstructor.py +13 -0
- laura_accelerator-0.2.0/laura/Importers/MySafeLoader.py +17 -0
- laura_accelerator-0.2.0/laura/Importers/SimFrame_Loader.py +261 -0
- laura_accelerator-0.2.0/laura/Importers/YAML_Loader.py +88 -0
- laura_accelerator-0.2.0/laura/Importers/__init__.py +0 -0
- laura_accelerator-0.2.0/laura/Importers/camera_assignments.yaml +37 -0
- laura_accelerator-0.2.0/laura/PV_Values.yaml +331 -0
- laura_accelerator-0.2.0/laura/__init__.py +6 -0
- laura_accelerator-0.2.0/laura/debug_wrapper.py +22 -0
- laura_accelerator-0.2.0/laura/laura.py +900 -0
- laura_accelerator-0.2.0/laura/models/RF.py +317 -0
- laura_accelerator-0.2.0/laura/models/__init__.py +0 -0
- laura_accelerator-0.2.0/laura/models/_functions.py +48 -0
- laura_accelerator-0.2.0/laura/models/baseModels.py +187 -0
- laura_accelerator-0.2.0/laura/models/control.py +269 -0
- laura_accelerator-0.2.0/laura/models/degauss.py +29 -0
- laura_accelerator-0.2.0/laura/models/diagnostic.py +360 -0
- laura_accelerator-0.2.0/laura/models/electrical.py +18 -0
- laura_accelerator-0.2.0/laura/models/element.py +1467 -0
- laura_accelerator-0.2.0/laura/models/elementList.py +913 -0
- laura_accelerator-0.2.0/laura/models/exceptions.py +2 -0
- laura_accelerator-0.2.0/laura/models/laser.py +153 -0
- laura_accelerator-0.2.0/laura/models/lighting.py +5 -0
- laura_accelerator-0.2.0/laura/models/magnetic.py +805 -0
- laura_accelerator-0.2.0/laura/models/manufacturer.py +26 -0
- laura_accelerator-0.2.0/laura/models/physical.py +409 -0
- laura_accelerator-0.2.0/laura/models/plasma.py +44 -0
- laura_accelerator-0.2.0/laura/models/reference.py +18 -0
- laura_accelerator-0.2.0/laura/models/shutter.py +25 -0
- laura_accelerator-0.2.0/laura/models/simulation.py +397 -0
- laura_accelerator-0.2.0/laura/translator/__init__.py +0 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/codes/__init__.py +0 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/codes/cheetah_conversion.py +54 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/codes/ocelot_conversion.py +59 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/codes/wake_t_conversion.py +17 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/codes/xsuite_conversion.py +82 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/elements/element_keywords.yaml +546 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/elements/elements_cheetah.yaml +88 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/elements/elements_elegant.yaml +2392 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/elements/elements_genesis.yaml +38 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/elements/elements_ocelot.yaml +255 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/elements/elements_opal.yaml +575 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/keywords/keyword_conversion_rules_Xsuite.yaml +16 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/keywords/keyword_conversion_rules_cheetah.yaml +96 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/keywords/keyword_conversion_rules_elegant.yaml +125 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/keywords/keyword_conversion_rules_genesis.yaml +25 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/keywords/keyword_conversion_rules_ocelot.yaml +105 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/keywords/keyword_conversion_rules_opal.yaml +29 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/keywords/keyword_conversion_rules_wake_t.yaml +22 -0
- laura_accelerator-0.2.0/laura/translator/conversion_rules/types/type_conversion_rules.yaml +128 -0
- laura_accelerator-0.2.0/laura/translator/converters/__init__.py +105 -0
- laura_accelerator-0.2.0/laura/translator/converters/aperture.py +180 -0
- laura_accelerator-0.2.0/laura/translator/converters/base.py +1033 -0
- laura_accelerator-0.2.0/laura/translator/converters/cavity.py +604 -0
- laura_accelerator-0.2.0/laura/translator/converters/codes/__init__.py +8 -0
- laura_accelerator-0.2.0/laura/translator/converters/codes/astra.py +434 -0
- laura_accelerator-0.2.0/laura/translator/converters/codes/bmad.py +369 -0
- laura_accelerator-0.2.0/laura/translator/converters/codes/csrtrack.py +213 -0
- laura_accelerator-0.2.0/laura/translator/converters/codes/elegant.py +192 -0
- laura_accelerator-0.2.0/laura/translator/converters/codes/gpt.py +548 -0
- laura_accelerator-0.2.0/laura/translator/converters/codes/ocelot.py +311 -0
- laura_accelerator-0.2.0/laura/translator/converters/codes/opal.py +586 -0
- laura_accelerator-0.2.0/laura/translator/converters/codes/xsuite.py +316 -0
- laura_accelerator-0.2.0/laura/translator/converters/converter.py +100 -0
- laura_accelerator-0.2.0/laura/translator/converters/diagnostic.py +57 -0
- laura_accelerator-0.2.0/laura/translator/converters/drift.py +35 -0
- laura_accelerator-0.2.0/laura/translator/converters/laser.py +88 -0
- laura_accelerator-0.2.0/laura/translator/converters/layout.py +113 -0
- laura_accelerator-0.2.0/laura/translator/converters/magnet.py +1253 -0
- laura_accelerator-0.2.0/laura/translator/converters/model.py +114 -0
- laura_accelerator-0.2.0/laura/translator/converters/plasma.py +163 -0
- laura_accelerator-0.2.0/laura/translator/converters/section.py +601 -0
- laura_accelerator-0.2.0/laura/translator/converters/twiss.py +12 -0
- laura_accelerator-0.2.0/laura/translator/converters/wake.py +213 -0
- laura_accelerator-0.2.0/laura/translator/utils/SDDSFile.py +499 -0
- laura_accelerator-0.2.0/laura/translator/utils/__init__.py +0 -0
- laura_accelerator-0.2.0/laura/translator/utils/classes.py +49 -0
- laura_accelerator-0.2.0/laura/translator/utils/elegant/SDDSFile.py +499 -0
- laura_accelerator-0.2.0/laura/translator/utils/elegant/sdds_classes_APS.py +264 -0
- laura_accelerator-0.2.0/laura/translator/utils/fields/FieldParameter.py +21 -0
- laura_accelerator-0.2.0/laura/translator/utils/fields/__init__.py +486 -0
- laura_accelerator-0.2.0/laura/translator/utils/fields/astra.py +368 -0
- laura_accelerator-0.2.0/laura/translator/utils/fields/gdf.py +297 -0
- laura_accelerator-0.2.0/laura/translator/utils/fields/hdf5.py +171 -0
- laura_accelerator-0.2.0/laura/translator/utils/fields/opal.py +269 -0
- laura_accelerator-0.2.0/laura/translator/utils/fields/sdds.py +160 -0
- laura_accelerator-0.2.0/laura/translator/utils/functions.py +334 -0
- laura_accelerator-0.2.0/laura/translator/utils/pmd_units.py +522 -0
- laura_accelerator-0.2.0/laura/translator/utils/units.py +553 -0
- laura_accelerator-0.2.0/laura/unit_tests/__init__.py +0 -0
- laura_accelerator-0.2.0/laura/unit_tests/models/__init__.py +0 -0
- laura_accelerator-0.2.0/laura/unit_tests/models/test_controls.py +153 -0
- laura_accelerator-0.2.0/laura/unit_tests/models/test_element.py +59 -0
- laura_accelerator-0.2.0/laura/unit_tests/models/test_elementList.py +98 -0
- laura_accelerator-0.2.0/laura/unit_tests/models/test_machine_model.py +326 -0
- laura_accelerator-0.2.0/laura/unit_tests/models/test_magnetic.py +94 -0
- laura_accelerator-0.2.0/laura/unit_tests/models/test_physical.py +55 -0
- laura_accelerator-0.2.0/laura_accelerator.egg-info/PKG-INFO +199 -0
- laura_accelerator-0.2.0/laura_accelerator.egg-info/SOURCES.txt +159 -0
- laura_accelerator-0.2.0/laura_accelerator.egg-info/dependency_links.txt +1 -0
- laura_accelerator-0.2.0/laura_accelerator.egg-info/requires.txt +16 -0
- laura_accelerator-0.2.0/laura_accelerator.egg-info/top_level.txt +2 -0
- laura_accelerator-0.2.0/pyproject.toml +57 -0
- laura_accelerator-0.2.0/readthedocs.yml +16 -0
- laura_accelerator-0.2.0/requirements.txt +6 -0
- laura_accelerator-0.2.0/setup.cfg +14 -0
- laura_accelerator-0.2.0/setup.py +20 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Publish Python Package to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*" # triggers on tags like v0.1.0
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build-and-publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
|
|
12
|
+
steps:
|
|
13
|
+
# 1️⃣ Checkout full git history including tags
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
with:
|
|
16
|
+
fetch-depth: 0
|
|
17
|
+
tags: true
|
|
18
|
+
|
|
19
|
+
# 2️⃣ Set up Python
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.10"
|
|
23
|
+
|
|
24
|
+
# 3️⃣ Install build tools
|
|
25
|
+
- name: Install build tools
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install build twine setuptools_scm
|
|
29
|
+
|
|
30
|
+
# 4️⃣ Optional: print detected version
|
|
31
|
+
- name: Check detected version
|
|
32
|
+
run: python -c "import setuptools_scm; print(setuptools_scm.get_version())"
|
|
33
|
+
|
|
34
|
+
# 5️⃣ Build distributions
|
|
35
|
+
- name: Build distributions
|
|
36
|
+
run: python -m build
|
|
37
|
+
|
|
38
|
+
# 6️⃣ Publish to PyPI
|
|
39
|
+
- name: Publish to PyPI
|
|
40
|
+
env:
|
|
41
|
+
TWINE_USERNAME: __token__
|
|
42
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
43
|
+
run: python -m twine upload --non-interactive dist/*
|
|
44
|
+
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# PAdantic
|
|
2
|
+
# Machines/
|
|
3
|
+
Output/
|
|
4
|
+
testYAML/
|
|
5
|
+
YAML_OLD/
|
|
6
|
+
Basefiles/
|
|
7
|
+
to_CATAP/
|
|
8
|
+
|
|
9
|
+
# Byte-compiled / optimized / DLL files
|
|
10
|
+
__pycache__/
|
|
11
|
+
*.py[cod]
|
|
12
|
+
*$py.class
|
|
13
|
+
.vscode
|
|
14
|
+
# C extensions
|
|
15
|
+
*.so
|
|
16
|
+
|
|
17
|
+
# Distribution / packaging
|
|
18
|
+
.Python
|
|
19
|
+
build/
|
|
20
|
+
develop-eggs/
|
|
21
|
+
dist/
|
|
22
|
+
downloads/
|
|
23
|
+
eggs/
|
|
24
|
+
.eggs/
|
|
25
|
+
lib/
|
|
26
|
+
lib64/
|
|
27
|
+
parts/
|
|
28
|
+
sdist/
|
|
29
|
+
var/
|
|
30
|
+
wheels/
|
|
31
|
+
share/python-wheels/
|
|
32
|
+
*.egg-info/
|
|
33
|
+
.installed.cfg
|
|
34
|
+
*.egg
|
|
35
|
+
MANIFEST
|
|
36
|
+
|
|
37
|
+
# PyInstaller
|
|
38
|
+
# Usually these files are written by a python script from a template
|
|
39
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
40
|
+
*.manifest
|
|
41
|
+
*.spec
|
|
42
|
+
|
|
43
|
+
# Installer logs
|
|
44
|
+
pip-log.txt
|
|
45
|
+
pip-delete-this-directory.txt
|
|
46
|
+
|
|
47
|
+
# Unit test / coverage reports
|
|
48
|
+
htmlcov/
|
|
49
|
+
.tox/
|
|
50
|
+
.nox/
|
|
51
|
+
.coverage
|
|
52
|
+
.coverage.*
|
|
53
|
+
.cache
|
|
54
|
+
nosetests.xml
|
|
55
|
+
coverage.xml
|
|
56
|
+
*.cover
|
|
57
|
+
*.py,cover
|
|
58
|
+
.hypothesis/
|
|
59
|
+
.pytest_cache/
|
|
60
|
+
cover/
|
|
61
|
+
|
|
62
|
+
# Translations
|
|
63
|
+
*.mo
|
|
64
|
+
*.pot
|
|
65
|
+
|
|
66
|
+
# Django stuff:
|
|
67
|
+
*.log
|
|
68
|
+
local_settings.py
|
|
69
|
+
db.sqlite3
|
|
70
|
+
db.sqlite3-journal
|
|
71
|
+
|
|
72
|
+
# Flask stuff:
|
|
73
|
+
instance/
|
|
74
|
+
.webassets-cache
|
|
75
|
+
|
|
76
|
+
# Scrapy stuff:
|
|
77
|
+
.scrapy
|
|
78
|
+
|
|
79
|
+
# Sphinx documentation
|
|
80
|
+
docs/_build/
|
|
81
|
+
|
|
82
|
+
# PyBuilder
|
|
83
|
+
.pybuilder/
|
|
84
|
+
target/
|
|
85
|
+
|
|
86
|
+
# Jupyter Notebook
|
|
87
|
+
.ipynb_checkpoints
|
|
88
|
+
|
|
89
|
+
# IPython
|
|
90
|
+
profile_default/
|
|
91
|
+
ipython_config.py
|
|
92
|
+
|
|
93
|
+
# pyenv
|
|
94
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
95
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
96
|
+
# .python-version
|
|
97
|
+
|
|
98
|
+
# pipenv
|
|
99
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
100
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
101
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
102
|
+
# install all needed dependencies.
|
|
103
|
+
#Pipfile.lock
|
|
104
|
+
|
|
105
|
+
# poetry
|
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
107
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
108
|
+
# commonly ignored for libraries.
|
|
109
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
110
|
+
#poetry.lock
|
|
111
|
+
|
|
112
|
+
# pdm
|
|
113
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
114
|
+
#pdm.lock
|
|
115
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
116
|
+
# in version control.
|
|
117
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
118
|
+
.pdm.toml
|
|
119
|
+
|
|
120
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
121
|
+
__pypackages__/
|
|
122
|
+
|
|
123
|
+
# Celery stuff
|
|
124
|
+
celerybeat-schedule
|
|
125
|
+
celerybeat.pid
|
|
126
|
+
|
|
127
|
+
# SageMath parsed files
|
|
128
|
+
*.sage.py
|
|
129
|
+
|
|
130
|
+
# Environments
|
|
131
|
+
.env
|
|
132
|
+
.venv
|
|
133
|
+
env/
|
|
134
|
+
venv/
|
|
135
|
+
ENV/
|
|
136
|
+
env.bak/
|
|
137
|
+
venv.bak/
|
|
138
|
+
|
|
139
|
+
# Spyder project settings
|
|
140
|
+
.spyderproject
|
|
141
|
+
.spyproject
|
|
142
|
+
|
|
143
|
+
# Rope project settings
|
|
144
|
+
.ropeproject
|
|
145
|
+
|
|
146
|
+
# mkdocs documentation
|
|
147
|
+
/site
|
|
148
|
+
|
|
149
|
+
# mypy
|
|
150
|
+
.mypy_cache/
|
|
151
|
+
.dmypy.json
|
|
152
|
+
dmypy.json
|
|
153
|
+
|
|
154
|
+
# Pyre type checker
|
|
155
|
+
.pyre/
|
|
156
|
+
|
|
157
|
+
# pytype static type analyzer
|
|
158
|
+
.pytype/
|
|
159
|
+
|
|
160
|
+
# Cython debug symbols
|
|
161
|
+
cython_debug/
|
|
162
|
+
|
|
163
|
+
# PyCharm
|
|
164
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
165
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
166
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
167
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
168
|
+
.idea/
|
|
169
|
+
|
|
170
|
+
#vscode
|
|
171
|
+
./vscode
|
|
172
|
+
PAdantic/Importers/~$CLARA Magnet Table v6.xlsx
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: laura-accelerator
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A standardized lattice format for particle accelerators
|
|
5
|
+
Author-email: James Jones <james.jones@stfc.ac.uk>
|
|
6
|
+
Maintainer-email: James Jones <james.jones@stfc.ac.uk>, Alex Brynes <alexander.brynes@stfc.ac.uk>, Mark Johnson <mark.johnson@stfc.ac.uk>, Matt King <matthew.king@stfc.ac.uk>
|
|
7
|
+
Project-URL: Homepage, https://github.com/astec-stfc/laura
|
|
8
|
+
Project-URL: Repository, https://github.com/astec-stfc/laura.git
|
|
9
|
+
Project-URL: Issues, https://github.com/astec-stfc/laura/-/issues/
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
Requires-Dist: pydantic>=2
|
|
15
|
+
Requires-Dist: pyyaml>=6
|
|
16
|
+
Requires-Dist: numpy>=1.26
|
|
17
|
+
Requires-Dist: scipy>=1.15
|
|
18
|
+
Requires-Dist: munch>=4
|
|
19
|
+
Provides-Extra: test
|
|
20
|
+
Requires-Dist: pytest; extra == "test"
|
|
21
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
22
|
+
Provides-Extra: docs
|
|
23
|
+
Requires-Dist: sphinx>=8; extra == "docs"
|
|
24
|
+
Requires-Dist: sphinx-rtd-theme; extra == "docs"
|
|
25
|
+
Requires-Dist: myst-nb; extra == "docs"
|
|
26
|
+
Requires-Dist: sphinx_autodoc_typehints>=3; extra == "docs"
|
|
27
|
+
Requires-Dist: sphinxcontrib-bibtex; extra == "docs"
|
|
28
|
+
Dynamic: requires-python
|
|
29
|
+
|
|
30
|
+
# LAURA: Lattice Architecture for a Unified Representation of Accelerators
|
|
31
|
+
|
|
32
|
+
**LAURA** is a Python package for describing, simulating, and controlling particle accelerator lattices. It provides a standardized, extensible data model for elements, sections, layouts, and full machine models.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Architecture Overview
|
|
37
|
+
|
|
38
|
+
LAURA organizes accelerator elements using a hierarchical structure:
|
|
39
|
+
|
|
40
|
+
### Element Structure
|
|
41
|
+
|
|
42
|
+

|
|
43
|
+
|
|
44
|
+
- **baseElement**: Core identification (name, hardware_class, hardware_type, machine_area)
|
|
45
|
+
- **Element**: Extends with simulation, controls, electrical, manufacturer info
|
|
46
|
+
- **PhysicalBaseElement**: Adds position, rotation, length, error, survey
|
|
47
|
+
|
|
48
|
+
### Lattice Structure
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
- **ElementList**: Container for elements
|
|
53
|
+
- **SectionLattice**: Ordered list of elements (a section of the beamline)
|
|
54
|
+
- **MachineLayout**: Sequence of sections (a full beam path)
|
|
55
|
+
- **MachineModel**: All layouts, sections, and elements (the full accelerator)
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Quick Examples
|
|
60
|
+
|
|
61
|
+
### Create a Basic Element
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from laura.models.element import baseElement
|
|
65
|
+
|
|
66
|
+
element = baseElement(
|
|
67
|
+
name="QUAD-01",
|
|
68
|
+
hardware_class="Magnet",
|
|
69
|
+
hardware_type="Quadrupole",
|
|
70
|
+
machine_area="LINAC-1"
|
|
71
|
+
)
|
|
72
|
+
print(element.name) # "QUAD-01"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Element with Physical Properties
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from laura.models.element import PhysicalBaseElement
|
|
79
|
+
from laura.models.physical import PhysicalElement, Position
|
|
80
|
+
|
|
81
|
+
cavity = PhysicalBaseElement(
|
|
82
|
+
name="CAV-01",
|
|
83
|
+
hardware_class="RF",
|
|
84
|
+
hardware_type="Cavity",
|
|
85
|
+
machine_area="LINAC-1",
|
|
86
|
+
physical=PhysicalElement(
|
|
87
|
+
length=1.0,
|
|
88
|
+
middle=Position(x=0, y=0, z=5.0)
|
|
89
|
+
)
|
|
90
|
+
)
|
|
91
|
+
print(cavity.physical.length) # 1.0
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Create a Section Lattice
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from laura.models.elementList import SectionLattice, ElementList
|
|
98
|
+
|
|
99
|
+
section = SectionLattice(
|
|
100
|
+
name="INJECTOR",
|
|
101
|
+
order=["BPM-01", "QUAD-01"],
|
|
102
|
+
elements=ElementList(elements={
|
|
103
|
+
"BPM-01": element,
|
|
104
|
+
"QUAD-01": cavity
|
|
105
|
+
})
|
|
106
|
+
)
|
|
107
|
+
print(section.names) # ["BPM-01", "QUAD-01"]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Build a Machine Layout
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
from laura.models.elementList import MachineLayout
|
|
114
|
+
|
|
115
|
+
layout = MachineLayout(
|
|
116
|
+
name="MainBeamline",
|
|
117
|
+
sections={"INJECTOR": section}
|
|
118
|
+
)
|
|
119
|
+
print(layout.names) # ["INJECTOR"]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Full Machine Model
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from laura.models.elementList import MachineModel
|
|
126
|
+
|
|
127
|
+
model = MachineModel(
|
|
128
|
+
elements={"QUAD-01": element, "CAV-01": cavity}
|
|
129
|
+
)
|
|
130
|
+
print(list(model.sections.keys())) # ["LINAC-1"]
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Translator Module
|
|
136
|
+
|
|
137
|
+
LAURA includes a translator system for exporting accelerator models to various simulation codes,
|
|
138
|
+
such as ASTRA, GPT, Elegant, CSRTrack, Ocelot, Xsuite, Wake-T, and Genesis.
|
|
139
|
+
|
|
140
|
+
- Translate individual elements, sections, layouts, or full machine models.
|
|
141
|
+
- Export to code-specific formats and objects.
|
|
142
|
+
- Automatically manage drift spaces, field maps, and code-specific configuration.
|
|
143
|
+
|
|
144
|
+
**Example: Export a section to Elegant and Ocelot**
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
from laura.translator.converters.section import SectionLatticeTranslator
|
|
148
|
+
|
|
149
|
+
translator = SectionLatticeTranslator.from_section(section)
|
|
150
|
+
translator.directory = "./output"
|
|
151
|
+
|
|
152
|
+
elegant_string = translator.to_elegant(charge=1e-9)
|
|
153
|
+
ocelot_lattice = translator.to_ocelot(save=True)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
See the [Translator documentation](docs/source/Translator.rst) for details and more examples.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Features
|
|
161
|
+
|
|
162
|
+
- **Hierarchical lattice structure**: elements → sections → layouts → machine
|
|
163
|
+
- **Flexible element definition**: physical, simulation, controls, electrical, manufacturer
|
|
164
|
+
- **Extensible API**: add new element types and metadata
|
|
165
|
+
- **Simulation & controls integration**: store simulation parameters and control variables
|
|
166
|
+
- **Export to simulation codes** via the Translator module
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Installation
|
|
173
|
+
|
|
174
|
+
Install LAURA from PyPI:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
pip install laura-accelerator
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Or add to your `requirements.txt`:
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
laura-accelerator
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Documentation
|
|
187
|
+
|
|
188
|
+
- [Element Definition](docs/source/Architecture/Element.rst)
|
|
189
|
+
- [Lattice Structure](docs/source/Architecture/Lattice.rst)
|
|
190
|
+
- [Translator Module](docs/source/Translator.rst)
|
|
191
|
+
- [Examples](docs/source/Examples.rst)
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Contributing
|
|
196
|
+
|
|
197
|
+
Issues and pull requests are welcome! See [GitHub Issues](https://github.com/astec-stfc/laura/issues).
|
|
198
|
+
|
|
199
|
+
---
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# LAURA: Lattice Architecture for a Unified Representation of Accelerators
|
|
2
|
+
|
|
3
|
+
**LAURA** is a Python package for describing, simulating, and controlling particle accelerator lattices. It provides a standardized, extensible data model for elements, sections, layouts, and full machine models.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Architecture Overview
|
|
8
|
+
|
|
9
|
+
LAURA organizes accelerator elements using a hierarchical structure:
|
|
10
|
+
|
|
11
|
+
### Element Structure
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
- **baseElement**: Core identification (name, hardware_class, hardware_type, machine_area)
|
|
16
|
+
- **Element**: Extends with simulation, controls, electrical, manufacturer info
|
|
17
|
+
- **PhysicalBaseElement**: Adds position, rotation, length, error, survey
|
|
18
|
+
|
|
19
|
+
### Lattice Structure
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
- **ElementList**: Container for elements
|
|
24
|
+
- **SectionLattice**: Ordered list of elements (a section of the beamline)
|
|
25
|
+
- **MachineLayout**: Sequence of sections (a full beam path)
|
|
26
|
+
- **MachineModel**: All layouts, sections, and elements (the full accelerator)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Quick Examples
|
|
31
|
+
|
|
32
|
+
### Create a Basic Element
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from laura.models.element import baseElement
|
|
36
|
+
|
|
37
|
+
element = baseElement(
|
|
38
|
+
name="QUAD-01",
|
|
39
|
+
hardware_class="Magnet",
|
|
40
|
+
hardware_type="Quadrupole",
|
|
41
|
+
machine_area="LINAC-1"
|
|
42
|
+
)
|
|
43
|
+
print(element.name) # "QUAD-01"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Element with Physical Properties
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from laura.models.element import PhysicalBaseElement
|
|
50
|
+
from laura.models.physical import PhysicalElement, Position
|
|
51
|
+
|
|
52
|
+
cavity = PhysicalBaseElement(
|
|
53
|
+
name="CAV-01",
|
|
54
|
+
hardware_class="RF",
|
|
55
|
+
hardware_type="Cavity",
|
|
56
|
+
machine_area="LINAC-1",
|
|
57
|
+
physical=PhysicalElement(
|
|
58
|
+
length=1.0,
|
|
59
|
+
middle=Position(x=0, y=0, z=5.0)
|
|
60
|
+
)
|
|
61
|
+
)
|
|
62
|
+
print(cavity.physical.length) # 1.0
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Create a Section Lattice
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from laura.models.elementList import SectionLattice, ElementList
|
|
69
|
+
|
|
70
|
+
section = SectionLattice(
|
|
71
|
+
name="INJECTOR",
|
|
72
|
+
order=["BPM-01", "QUAD-01"],
|
|
73
|
+
elements=ElementList(elements={
|
|
74
|
+
"BPM-01": element,
|
|
75
|
+
"QUAD-01": cavity
|
|
76
|
+
})
|
|
77
|
+
)
|
|
78
|
+
print(section.names) # ["BPM-01", "QUAD-01"]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Build a Machine Layout
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from laura.models.elementList import MachineLayout
|
|
85
|
+
|
|
86
|
+
layout = MachineLayout(
|
|
87
|
+
name="MainBeamline",
|
|
88
|
+
sections={"INJECTOR": section}
|
|
89
|
+
)
|
|
90
|
+
print(layout.names) # ["INJECTOR"]
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Full Machine Model
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
from laura.models.elementList import MachineModel
|
|
97
|
+
|
|
98
|
+
model = MachineModel(
|
|
99
|
+
elements={"QUAD-01": element, "CAV-01": cavity}
|
|
100
|
+
)
|
|
101
|
+
print(list(model.sections.keys())) # ["LINAC-1"]
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Translator Module
|
|
107
|
+
|
|
108
|
+
LAURA includes a translator system for exporting accelerator models to various simulation codes,
|
|
109
|
+
such as ASTRA, GPT, Elegant, CSRTrack, Ocelot, Xsuite, Wake-T, and Genesis.
|
|
110
|
+
|
|
111
|
+
- Translate individual elements, sections, layouts, or full machine models.
|
|
112
|
+
- Export to code-specific formats and objects.
|
|
113
|
+
- Automatically manage drift spaces, field maps, and code-specific configuration.
|
|
114
|
+
|
|
115
|
+
**Example: Export a section to Elegant and Ocelot**
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
from laura.translator.converters.section import SectionLatticeTranslator
|
|
119
|
+
|
|
120
|
+
translator = SectionLatticeTranslator.from_section(section)
|
|
121
|
+
translator.directory = "./output"
|
|
122
|
+
|
|
123
|
+
elegant_string = translator.to_elegant(charge=1e-9)
|
|
124
|
+
ocelot_lattice = translator.to_ocelot(save=True)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
See the [Translator documentation](docs/source/Translator.rst) for details and more examples.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Features
|
|
132
|
+
|
|
133
|
+
- **Hierarchical lattice structure**: elements → sections → layouts → machine
|
|
134
|
+
- **Flexible element definition**: physical, simulation, controls, electrical, manufacturer
|
|
135
|
+
- **Extensible API**: add new element types and metadata
|
|
136
|
+
- **Simulation & controls integration**: store simulation parameters and control variables
|
|
137
|
+
- **Export to simulation codes** via the Translator module
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Installation
|
|
144
|
+
|
|
145
|
+
Install LAURA from PyPI:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
pip install laura-accelerator
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Or add to your `requirements.txt`:
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
laura-accelerator
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Documentation
|
|
158
|
+
|
|
159
|
+
- [Element Definition](docs/source/Architecture/Element.rst)
|
|
160
|
+
- [Lattice Structure](docs/source/Architecture/Lattice.rst)
|
|
161
|
+
- [Translator Module](docs/source/Translator.rst)
|
|
162
|
+
- [Examples](docs/source/Examples.rst)
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Contributing
|
|
167
|
+
|
|
168
|
+
Issues and pull requests are welcome! See [GitHub Issues](https://github.com/astec-stfc/laura/issues).
|
|
169
|
+
|
|
170
|
+
---
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
build/
|
|
2
|
+
dist/
|
|
3
|
+
*.egg*/
|
|
4
|
+
magnet-table/magnet-table.ini
|
|
5
|
+
*.pyc
|
|
6
|
+
*.pyc
|
|
7
|
+
MagnetApp/GUI_FileLoad.pyc
|
|
8
|
+
magnet-table/.idea/*.*
|
|
9
|
+
magnet-table/tmp/*.*
|
|
10
|
+
magnet-table/rf_sol_gui.py
|
|
11
|
+
magnet-table/src/pip-delete-this-directory.txt
|
|
12
|
+
.idea
|
|
13
|
+
SimulationFramework/Examples/S2EBunchPrePostCombined_v3.sdds
|
|
14
|
+
SimulationFramework/Examples/S2EBunchPrePostCombined_v2.sdds
|
|
15
|
+
SimulationFramework/Examples/S2EBunchPrePostCombined.astra
|
|
16
|
+
SAMM3.0/Examples
|
|
17
|
+
*checkpoint.ipynb
|
|
18
|
+
*.pyc*
|
|
19
|
+
*Untitled*
|
|
20
|
+
|
|
21
|
+
to_CATAP/
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
generator:
|
|
2
|
+
default: clara_400_3ps
|
|
3
|
+
files:
|
|
4
|
+
injector400:
|
|
5
|
+
code: ASTRA
|
|
6
|
+
charge:
|
|
7
|
+
cathode: True
|
|
8
|
+
space_charge_mode: 2D
|
|
9
|
+
mirror_charge: True
|
|
10
|
+
input:
|
|
11
|
+
particle_definition: 'initial_distribution'
|
|
12
|
+
output:
|
|
13
|
+
zstart: 0
|
|
14
|
+
end_element: CLA-S02-SIM-APER-01
|
|
15
|
+
FEBE:
|
|
16
|
+
code: elegant
|
|
17
|
+
charge:
|
|
18
|
+
cathode: False
|
|
19
|
+
space_charge_mode: 3D
|
|
20
|
+
output:
|
|
21
|
+
start_element: CLA-S02-SIM-APER-01
|
|
22
|
+
end_element: CLA-FED-SIM-DUMP-01-START
|
|
23
|
+
groups:
|
|
24
|
+
bunch_compressor:
|
|
25
|
+
type: chicane
|
|
26
|
+
elements: [CLA-VBC-MAG-DIP-01, CLA-VBC-MAG-DIP-02, CLA-VBC-MAG-DIP-03, CLA-VBC-MAG-DIP-04]
|
|
27
|
+
FODO_F:
|
|
28
|
+
type: element_group
|
|
29
|
+
elements: [CLA-FEA-MAG-QUAD-01, CLA-FEA-MAG-QUAD-03, CLA-FEA-MAG-QUAD-05, CLA-FEA-MAG-QUAD-07, CLA-FEA-MAG-QUAD-09, CLA-FEA-MAG-QUAD-11]
|
|
30
|
+
FODO_D:
|
|
31
|
+
type: element_group
|
|
32
|
+
elements: [CLA-FEA-MAG-QUAD-02, CLA-FEA-MAG-QUAD-04, CLA-FEA-MAG-QUAD-06, CLA-FEA-MAG-QUAD-08, CLA-FEA-MAG-QUAD-10, CLA-FEA-MAG-QUAD-12]
|
|
33
|
+
ARC_R56:
|
|
34
|
+
type: r56_group
|
|
35
|
+
elements: [FODO_F, FODO_D]
|
|
36
|
+
ratios: [1.5924900169720815 - 2.38 * (r56 - 0.007714832782173741), -1.1063900117914343 - 2.2 * (r56 - 0.007714832782173741)]
|
|
37
|
+
keys: [k1l, k1l]
|
|
38
|
+
elements:
|
|
39
|
+
layout_file: Machines/CLARA/layouts.yaml
|
|
40
|
+
section_file: Machines/CLARA/sections.yaml
|
|
41
|
+
yaml_dir: Machines/CLARA/YAML
|
|
42
|
+
lattice: CLARA
|