|
1 | 1 | # apace |
2 | | -Depends on Python 3.7 |
| 2 | +**apace** is yet **a**nother **p**article **a**ccelerator **c**od**e** designed for the optimization of beam optics. It is available as Python packages and aims to provide a convenient and straightforward API to make use Python's numeros scientific libaries. |
3 | 3 |
|
4 | | -## Usage |
5 | | -import apace |
6 | | -```python |
7 | | -import apace as ap |
| 4 | + |
| 5 | + |
| 6 | +## Installing |
| 7 | +Install and update using pip: |
| 8 | + |
| 9 | +```sh |
| 10 | +pip install -U apace |
8 | 11 | ``` |
9 | 12 |
|
10 | | -### Linear Beam Dynamics |
11 | | -Import the linear beam dynamics module: |
| 13 | +## Dependencies |
| 14 | +- Python 3.7 or higher |
| 15 | +- CFFI 1.0.0 or higher |
| 16 | +- NumPy/SciPy |
| 17 | +- Matplotlib |
| 18 | + |
| 19 | + |
| 20 | +### A Simple Example |
| 21 | +import apace |
12 | 22 | ```python |
13 | | -from apace.linbeamdyn import LinBeamDyn |
| 23 | +import apace as ap |
14 | 24 | ``` |
15 | 25 |
|
16 | | -Create a ring consting out of FODO cells: |
| 26 | +Create a ring consisting of 8 FODO cells: |
17 | 27 | ```python |
18 | 28 | D1 = ap.Drift('D1', length=0.55) |
19 | 29 | Q1 = ap.Quad('Q1', length=0.2, k1=1.2) |
20 | 30 | B1 = ap.Bend('B1', length=1.5, angle=0.392701, e1=0.1963505, e2=0.1963505) |
21 | 31 | Q2 = ap.Quad('Q2', length=0.4, k1=-1.2) |
22 | | -fodo = ap.Line('fodo-cell', [Q1, D1, B1, D1, Q2, D1, B1, D1, Q1]) |
23 | | -ring = ap.Mainline('fodo-ring', [fodo] * 8) |
| 32 | +fodo = ap.Cell('FODO-CELL', [Q1, D1, B1, D1, Q2, D1, B1, D1, Q1]) |
| 33 | +ring = ap.MainCell('FODO-RING', [fodo] * 8) |
24 | 34 | ``` |
25 | 35 |
|
26 | | -Get twiss parameters: |
| 36 | +Calculate the twiss parameters: |
27 | 37 | ```python |
28 | 38 | twiss = ap.Twiss(ring) |
29 | 39 | ``` |
30 | 40 |
|
31 | 41 |
|
32 | | -Plot twissfunctions: |
| 42 | +Plot horizontal and vertical beta functions using matplotlib: |
33 | 43 | ```python |
34 | | -plot(twiss.s, twiss.beta_x, twiss.beta_y, twiss.eta_x) |
| 44 | +plt.plot(twiss.s, twiss.beta_x, twiss.beta_y, twiss.eta_x) |
35 | 45 | ``` |
| 46 | + |
| 47 | +## License |
| 48 | +[GNU General Public License v3.0](https://github.com/andreasfelix/apace/blob/master/LICENSE) |
| 49 | + |
0 commit comments