barc4sr
BARC library for Synchrotron Radiation
This library was created for facilitating the use of SRW and WOFRY for a few routine calculations.
It provides:
- canonical beam and magnet classes (ElectronBeam, MagneticStructure, SynchrotronSource, …)
- magnetic-field generators (bending magnets, arbitrary fields, multi-element fields)
- SRW-powered computations (electron trajectories, wavefronts, power density)
- Wofry-powered computations (CMD)
Features
Core modelling
- ElectronBeam: canonical storage of second-order moments
- MagneticStructure: bending magnets, arbitrary fields; undulators/ wigglers planned
- SynchrotronSource hierarchy:
BendingMagnetSourceArbitraryMagnetSource
Magnetic-field generation
bm_magnetic_field()– soft-edge bending magnet modelarb_magnetic_field()– arbitrary user-defined magnetic fieldsmulti_bm_magnetic_field()– composite bending-magnet latticesmulti_arb_magnetic_field()– multi-field arbitrary lattices
SRW-based radiation calculations
electron_trajectory()wavefront()power_density()
All return backend-agnostic dictionaries (NumPy arrays + metadata).
Plotting
Available via barc4sr.plotting:
plot_electron_trajectoryplot_wavefrontplot_power_density- Shared colormaps, styles, and layout helpers
I/O utilities
- Save/load: trajectories, wavefronts, power-density maps
- Simple
.datand.jsonformats for interoperability
Installation
Basic installation
pip install barc4sr
This installs the core models, magnetic-field utilities, plotting tools, and I/O helpers.
Enable SRW-based radiation calculations
To perform wavefront, power-density, and trajectory calculations, install SRW bindings:
Option 1 (recommended if it works on your setup)
pip install srwpy
Option 2 (fallback)
pip install oasys-srwpy
If neither is available for your platform, you can also build SRW from source;
barc4sr will still import, but SRW-based calculations will be unavailable.
Examples:
Check the examples! You can learn a lot from them.
Metadata
Release files for barc4sr 2025.11.28
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| barc4sr-2025.11.28.tar.gz | 55.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| barc4sr-2025.11.28-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 121.9 kB
Release files / barc4sr-2025.11.28.tar.gz
| Download URL | barc4sr-2025.11.28.tar.gz |
|---|---|
| Size | 55.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9fdab9cd47e94bfc507b19df44f6acea2eaf6b3cec691899795fadd062b71073
|
|
BLAKE2b-256 checksum How to use checksums |
734c41224404ce9f24a4e29ef5413fd5057fe91f105915191794cf2af10d8ba1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / barc4sr-2025.11.28-py3-none-any.whl
| Download URL | barc4sr-2025.11.28-py3-none-any.whl |
|---|---|
| Size | 66.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ac8d42341025f26ad5db4f80696891e07350885e48172651b6ff9250d7de606
|
|
BLAKE2b-256 checksum How to use checksums |
0c74af91b164d62b035d4640ec4a2415498256557204f2db2318d0dad9eb20c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Security for barc4sr 2025.11.28
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.