DA-based FFAG accelerator tracking using differential algebra
Project description
pyffag
DA-based FFAG accelerator tracking using differential algebra.
Built on daceypy for arbitrary-order transfer map computation through FFAG sector magnets via integration of the exact midplane Hamiltonian.
Installation
pip install pyffag
Quick start
import numpy as np
from daceypy import DA
from pyffag import sector_map, compose_sequence, compose_n, tune, twiss
from pyffag.constants import kinetic_to_brho, M_PROTON
# 250 MeV proton FFAG ring: 8 FD doublet cells
DA.init(5, 2) # DA order 5, 2 variables (x, px)
Brho = kinetic_to_brho(250.0, M_PROTON)
# F magnet: horizontally focusing sector, 25 degrees
F = sector_map([0.9, 2.0], Brho, angle=np.radians(25.0))
# D magnet: horizontally defocusing sector, 20 degrees
D = sector_map([0.9, -3.0], Brho, angle=np.radians(20.0))
# One cell = F + D, full ring = 8 cells
cell = compose_sequence([F, D])
ring = compose_n(cell, 8)
print(f"Cell tune: {twiss(cell)['tune']:.4f}")
print(f"Ring tune: {tune(ring):.4f}")
Features
- Sector magnet tracking: Exact midplane Hamiltonian integration (no paraxial approximation) through sector magnets with polynomial field profiles
- Element maps: Drift (exact), thin quadrupole, sextupole, octupole, edge kicks for rectangular magnets
- Ring operations: Map composition, N-fold composition, closed orbit finding via Newton's method with DA Jacobian
- Optics: Tune, Twiss parameters, stability check, symplecticity error
Physics
The core sector_map() integrates the midplane equations of motion
in Frenet-Serret (curvilinear) coordinates with arc length as the
independent variable. Sector magnets have radial edge faces
(no edge focusing).
Integration with danf
Use with danf for nonlinear normal form analysis (amplitude-dependent tune shifts):
from danf import NormalForm
nf = NormalForm(ring)
nf.compute()
print(nf.tunes)
print(nf.detuning)
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyffag-0.1.1.tar.gz.
File metadata
- Download URL: pyffag-0.1.1.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24ad7dfa8014b24d5f5e8bfb5bc14a3329371e15a8a5c4a96a6a7a8c8b17a98c
|
|
| MD5 |
9a16a711db0dfbb2fb2f214166009546
|
|
| BLAKE2b-256 |
2677aa57e59cbf564493baa0ffac0ad6dc312f5acfb37e2308c3bd576b8a373b
|
File details
Details for the file pyffag-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pyffag-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
055addbc12efc9061492f8cc1c6cbcd7748b8ba1a2976831d9791ac529142635
|
|
| MD5 |
9e7ab245a2e170982c765056df661cc8
|
|
| BLAKE2b-256 |
beec806fe4768267ec9117aa9182657ab8ed3fe2b2fc2e9718fb21f1dc71b69a
|