Another Particle Accelerator Code
Project description
apace
apace is yet another particle accelerator code designed for the optimization of beam optics. It is available as Python package and aims to provide a convenient and straightforward API to make use of Python's numerous scientific libraries.
Installing
Install and update using pip or pipenv:
pip install -U apace
Requirements
- Python 3.6 or higher (CPython or PyPy)
- CFFI 1.0.0 or higher
- NumPy/SciPy
- Matplotlib
A Simple Example
Import apace:
import apace as ap
Create a ring consisting out of 8 FODO cells:
d1 = ap.Drift('D1', length=0.55)
b1 = ap.Bend('B1', length=1.5, angle=0.392701, e1=0.1963505, e2=0.1963505)
q1 = ap.Quad('Q1', length=0.2, k1=1.2)
q2 = ap.Quad('Q2', length=0.4, k1=-1.2)
fodo = ap.Cell('FODO', [q1, d1, b1, d1, q2, d1, b1, d1, q1])
ring = ap.Cell('RING', [fodo] * 8)
Calculate the Twiss parameters:
twiss = ap.Twiss(ring)
Plot horizontal and vertical beta functions using matplotlib:
import matplotlib.pyplot as plt
plt.plot(twiss.s, twiss.beta_x, twiss.beta_y, twiss.eta_x)
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
apace-0.0.2.tar.gz
(46.1 kB
view details)
File details
Details for the file apace-0.0.2.tar.gz
.
File metadata
- Download URL: apace-0.0.2.tar.gz
- Upload date:
- Size: 46.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c476ad8fda190160096c4635947ba02022030ed82051b347daac6e84e7a44a6 |
|
MD5 | b1fafb9c4d984734dd90c24547a6fd12 |
|
BLAKE2b-256 | 3ca35e7b57c80c635b5c7b3afede298881831217e207e8f765beb912abe8a796 |