Skip to main content

pipeline coverage pypi python


DiPAS is a program for differentiable simulations of particle accelerators. It acts as a framework and thus supports a wide range of use cases such as particle tracking or optics calculations such as closed orbit search or computation of Twiss parameters.

The involved computations are backed by the PyTorch package which also provides the relevant functionality for differentiation of user-defined quantities as well as a variety of gradient-based optimizers that integrate with the thus derived quantities.

The DiPAS program can parse MADX lattice definitions and hence allows for zero-overhead importing of existing lattices. In addition, it supports custom lattice definitions from provided element classes.

DiPAS can also be used via command line interface, see dipas --help for more information.

Example usage

Minimizing loss along beamline by tuning quadrupoles:

import numpy
from dipas.build import from_file
from dipas.elements import Quadrupole
import torch

lattice = from_file('example.madx')

for quad in lattice[Quadrupole]:
    quad.k1 = torch.nn.Parameter(quad.k1)

optimizer = torch.optim.Adam(lattice.parameters(), lr=1e-3)

particles = torch.from_numpy(numpy.load('particles.npy'))

while True:
    tracked, loss_val = lattice.linear(particles, recloss='sum')
    lost = 1 - tracked.shape[1] / particles.shape[1]
    if lost < 0.01:  # Fraction of particles lost less than 1%.
        break
    optimizer.zero_grad()
    loss_val.backward()
    optimizer.step()

Metadata

Release files for DiPAS 2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for DiPAS 2.0
File Size Uploaded
DiPAS-2.0.tar.gz 2.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for DiPAS 2.0
File Interpreter ABI Platform
DiPAS-2.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.2 MB

Release files / DiPAS-2.0.tar.gz

Download URL DiPAS-2.0.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
f0ab8ef2ba88f7661fda06efc7dfba2efc29c0595a6ad3757c0e55ad5b51272b
BLAKE2b-256 checksum
How to use checksums
08d08fe0467c713b704ced37076f3737818efef0ee85b4ea8c1711948e9c6f7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.27.1 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.9

Release files / DiPAS-2.0-py3-none-any.whl

Download URL DiPAS-2.0-py3-none-any.whl
Size 201.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1389102549084977c1b989ed60dc7e3eca141b45b2ef5f5d177f13d228be6794
BLAKE2b-256 checksum
How to use checksums
db6d969ebbe53c800b5796f840e875a14f9bcfecb52ddb9b088362dcb7b70537
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.27.1 setuptools/50.3.1.post20201107 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.9

Release history Release notifications | RSS feed

This release

2.0 This release

2 release files

1.4

2 release files

1.3.1

2 release files

1.3

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2

2 release files

1.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page