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},
}
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
Hashes for cheetah-accelerator-0.5.16.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6def260270622c9d9d7b4e3f3d28285072589ab3342334d1a81e0a28dc9d9a1 |
|
MD5 | c1658ec90c7d4e4e185742bb83c18989 |
|
BLAKE2b-256 | 785874a835bc5e6c4cb1cee5ca576d888ef08b4b9dd22c599ccde961c816b60a |
Hashes for cheetah_accelerator-0.5.16-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a56762cea8ef263bb10a9e5e483e024aff272deba4e9c93f20fd7348dd510ba |
|
MD5 | d84aea824b510a999d3f6e10baf47555 |
|
BLAKE2b-256 | c48569f5aa337dc37dcedc5c747c22df8b03149fa9f8f31d23bf4016b3a598f7 |