Fast particle accelerator optics simulation for reinforcement learning and optimisation applications.
Project description
Cheetah
Cheetah is a particle tracking accelerator we built specifically to speed up the training of reinforcement learning models.
Installation
Simply install Cheetah from PyPI by running the following command.
pip install cheetah-accelerator
How To Use
A sequence of accelerator elements (or a lattice) is called a Segment
in Cheetah. You can create a Segment
as follows
segment = Segment([
BPM(name="BPM1SMATCH"),
Drift(length=1.0),
BPM(name="BPM6SMATCH"),
Drift(length=1.0),
VerticalCorrector(length=0.3, name="V7SMATCH"),
Drift(length=0.2),
HorizontalCorrector(length=0.3, name="H10SMATCH"),
Drift(length=7.0),
HorizontalCorrector(length=0.3, name="H12SMATCH"),
Drift(length=0.05),
BPM(name="BPM13SMATCH"),
])
Alternatively you can create a segment from an Ocelot cell by running
segment = Segment.from_ocelot(cell)
All elements can be accesses as a property of the segment via their name. The strength of a quadrupole named AREAMQZM2 for example, may be set by running
segment.AREAMQZM2.k1 = 4.2
In order to track a beam through the segment, simply call the segment like so
outgoing_beam = segment(incoming_beam)
You can choose to track either a beam defined by its parameters (fast) or by its particles (precise). Cheetah defines two different beam classes for this purpose and beams may be created by
beam1 = ParameterBeam.from_parameters()
beam2 = ParticleBeam.from_parameters()
It is also possible to load beams from Ocelot ParticleArray
or Astra particle distribution files for both types of beam
ocelot_beam = ParticleBeam.from_ocelot(parray)
astra_beam = ParticleBeam.from_astra(filepath)
You may plot a segment with reference particle traces bay calling
segment.plot_overview(beam=beam)
where the optional keyword argument beam
is the incoming beam represented by the reference particles. Cheetah will use a default incoming beam, if no beam is passed.
Cite Cheetah
To cite Cheetah in publications:
@inproceedings{stein2022accelerating,
author = {Stein, Oliver and
Kaiser, Jan and
Eichler, Annika},
title = {Accelerating Linear Beam Dynamics Simulations for Machine Learning Applications},
booktitle = {Proceedings of the 13th International Particle Accelerator Conference},
year = {2022},
url = {https://github.com/desy-ml/cheetah},
}
For Developers
Activate your virtual envrionment. (Optional)
Install the cheetah package as editable
pip install -e .
We suggest to install pre-commit hooks to automatically conform with the code formatting in commits:
pip install pre-commit
pre-commit install
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cheetah-accelerator-0.5.19.tar.gz
.
File metadata
- Download URL: cheetah-accelerator-0.5.19.tar.gz
- Upload date:
- Size: 24.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d4eb6d13f651bb9a9fe4da8d60dedad7730e5fab5275de02a83750c00136c9a |
|
MD5 | 1a94adf9d46d5edcb78d71458c242baf |
|
BLAKE2b-256 | 18229c1c702253cc0d843311d8034a8843de4f84d1de33911087ddcc46e0e826 |
File details
Details for the file cheetah_accelerator-0.5.19-py3-none-any.whl
.
File metadata
- Download URL: cheetah_accelerator-0.5.19-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1eae3ba6fe4ce708db946f477091ce0b242fd43383649a0948204127617a7d0 |
|
MD5 | a9e4748681008646f7bff9039a1e9181 |
|
BLAKE2b-256 | fd8bbadced19d80b5f774ccb0d37d8e4a2edcfd41a49eefb42c7cabcfc89ef38 |