Releases: bmad-sim/pytao
PyTao v1.0.3
What's Changed
- FIX: ensure ParticleGroup serializes to json as well by @ken-lauer in #158
Full Changelog: v1.0.2...v1.0.3
PyTao v1.0.2
What's Changed
- PERF: faster ndarray restore from msgpack + helpers for dealing with raw data by @ken-lauer in #156
- FIX: equality checks for TaoModel by @ken-lauer in #157
Full Changelog: v1.0.1...v1.0.2
PyTao v1.0.1
What's Changed
A small release:
- Error handling fixes
- Progress bars are now working with
tao.track_beam()while usingSubprocessTao(now the default for thepytaoCLI)
Pull Requests
- FIX: include all Tao output as part of exception state by @ken-lauer in #153
- CI: don't deploy docs daily by @ken-lauer in #155
- FIX: SubprocessTao progress bar by @ken-lauer in #154
Full Changelog: v1.0.0...v1.0.1
PyTao v1.0.0
New Features
Pydantic data models for Tao state (pytao.model)
PyTao now provides Pydantic v2 models that represent the live state of Tao. These models can be queried from Tao, modified in Python, and applied back.
-
TaoConfig— captures the complete configuration of a Tao session: startup parameters,BmadCom,SpaceChargeCom,BeamInit,Beam,TaoGlobal, and per-element overrides.config = tao.get_config() config.beam_init.a_emit = 1e-8 config.set(tao) # apply all settings config.set(tao, only_changed=True) # apply only what changed
-
Settings sub-models —
BmadCom,SpaceChargeCom,BeamInit,Beam, andTaoGlobalcan also be used independently:from pytao.model import BeamInit beam_init = BeamInit.from_tao(tao) beam_init.a_emit = 1e-6 with beam_init.set_context(tao): # temporarily applied; restored on exit ...
-
Element— structured representation of a lattice element with head metadata, general attributes, Twiss parameters, orbit, transfer matrix, floor coordinates, multipoles, wake fields, chamber walls, and more. Data loading is controlled per-field.ele = tao.ele("Q00W") ele.twiss.beta_a ele.attrs["k1"].data ele.floor.end.actual.x
-
Lattice— a collection ofElementobjects with lookup by name, key, or index. Multiple constructors:from_tao_tracking,from_tao_unique,from_tao_eles. -
tao.eles()— query multiple elements using Tao's full element matching syntax (wildcards, ranges, key filters):quads = tao.eles("quad::*") eles_1_to_20 = tao.eles("1:20")
-
Serialization — all models support
.write()/.from_file()for JSON,
.json.gz, msgpack, and YAML.
ormsgpackis used for the (recommended and fastest) serialization method msgpack, whileorjsonis used for faster-than-stdlib JSON serialization. These are both new requirements. -
Code generation —
TaoGlobal,BeamInit, etc. are auto-generated from Bmad/Tao structure definitions (scripts/structs.json) viamodel/codegen.py.
ParticleGroup helper
-
tao.particles()— is a new shortcut to get an openPMD-BeamPhysicsParticleGroupinstance for a given element.P = tao.particles("quad::Q1") # type: beamphysics.ParticleGroup P.plot("x", "px")
Session archiving
-
tao.archive(directory)writes a self-contained, reproducible archive: the current lattice (viawrite bmad), a Tao command file with allsetcommands, and a bash script that re-launches the session.sh_file, cmd_file = tao.archive("my_archive")
-
config.write_bash_loader_script()provides lower-level control over archive generation (custom Tao binary, prefix, optional lattice export).
CLI argument handling rework
TaoStartupnow parses all Tao command-line arguments the same way Tao does, rather than juggling a free-forminitstring alongside individual attributes.- Fixes for
pytao -commandwhich Tao had silently been ignoring; PyTao now handles it correctly. - All arguments are documented consistently in
pytao --help.
Error handling improvements
- More consistent error handling between
SubprocessTaoandTao: Tao messages from pipe command output are handled consistently between the regular Tao and the subprocess variant. - Filtered messages from pipe commands are redirected to Python logging.
- Added
PYTAO_LIB_PATHenvironment variable to force PyTao to use a specificlibtao.so.
Other Changes
- Autogenerated interface commands are now a mixin class (
_TaoAutogeneratedCommandMixin), simplifying development. - Python 3.14 compatibility fixes.
- Better support for
pip-based (PyPI) installs with proper dependency listings. - Import cleanups and fixes throughout the codebase.
- Type annotations for auto-generated Tao
pipeinterface routines. - Small performance improvements in subprocess
- Subprocess tests reuse a single
SubprocessTaoinstance by default (setTAO_REUSE_SUBPROCESS=1), speeding up CI.
Backward Incompatible Changes
- Python 3.10+ is now required.
- Bmad >=20260317 is also now required for all features to behave as designed.
- Removed legacy
tao_interfaceandtao_pexpect. - Removed
pytao-guientrypoint andpytao.guisubmodule. - Removed the largely defunct
as_dictparameter from all interface commands. TaoStartup.initattribute was removed. The free-form init string is now parsed into individual attributes. It is still accepted as an initializer argument:TaoStartup(init="-lat foo.lat").
Special Thank You
Thank you to 🧙@ken-lauer for this development!
PyTao v0.5.7
PyTao v0.5.6
What's Changed
- DOC: release process by @ken-lauer in #146
- FIX: handle potential empty string case for pytypes by @ken-lauer in #147
Full Changelog: v0.5.5...v0.5.6
PyTao v0.5.5
What's Changed
- Fix FODO notebook by @ChristopherMayes in #145
- Add parsers for the new
lord_controlandslave_controlTao pipe commands by @ChristopherMayes in #144
Full Changelog: v0.5.4...v0.5.5
PyTao v0.5.4
What's Changed
- ENH: add Tao.from_lattice_contents by @ken-lauer in #137
- Added that ACC_ENABLE_SHARED_ONLY=Y is acceptable. by @DavidSagan in #142
Full Changelog: v0.5.3...v0.5.4
PyTao v0.5.3
PyTao v0.5.2
What's Changed
- MAINT: rebuild interface for 'lat_header' by @ken-lauer in #134
- DOC: add floor plan plot with ParticleGroup plot overlays example by @ken-lauer in #110
Full Changelog: v0.5.1...v0.5.2