Skip to content

Releases: bmad-sim/pytao

PyTao v1.0.3

22 Apr 22:12
71c8823

Choose a tag to compare

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

22 Apr 18:23
a39698a

Choose a tag to compare

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

09 Apr 22:09
e79e76a

Choose a tag to compare

What's Changed

A small release:

  • Error handling fixes
  • Progress bars are now working with tao.track_beam() while using SubprocessTao (now the default for the pytao CLI)

Pull Requests

Full Changelog: v1.0.0...v1.0.1

PyTao v1.0.0

20 Mar 20:14
615bab4

Choose a tag to compare

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-modelsBmadCom, SpaceChargeCom, BeamInit, Beam, and TaoGlobal can 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 of Element objects 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.
    ormsgpack is used for the (recommended and fastest) serialization method msgpack, while orjson is used for faster-than-stdlib JSON serialization. These are both new requirements.

  • Code generationTaoGlobal, BeamInit, etc. are auto-generated from Bmad/Tao structure definitions (scripts/structs.json) via model/codegen.py.

ParticleGroup helper

  • tao.particles() — is a new shortcut to get an openPMD-BeamPhysics ParticleGroup instance 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 (via write bmad), a Tao command file with all set commands, 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

  • TaoStartup now parses all Tao command-line arguments the same way Tao does, rather than juggling a free-form init string alongside individual attributes.
  • Fixes for pytao -command which 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 SubprocessTao and Tao: 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_PATH environment variable to force PyTao to use a specific libtao.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 pipe interface routines.
  • Small performance improvements in subprocess
  • Subprocess tests reuse a single SubprocessTao instance by default (set TAO_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_interface and tao_pexpect.
  • Removed pytao-gui entrypoint and pytao.gui submodule.
  • Removed the largely defunct as_dict parameter from all interface commands.
  • TaoStartup.init attribute 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

14 Jan 22:12
55db6a7

Choose a tag to compare

What's Changed

Full Changelog: v0.5.6...v0.5.7

PyTao v0.5.6

18 Oct 17:44
53246bc

Choose a tag to compare

What's Changed

Full Changelog: v0.5.5...v0.5.6

PyTao v0.5.5

25 Sep 14:45
bee68aa

Choose a tag to compare

What's Changed

Full Changelog: v0.5.4...v0.5.5

PyTao v0.5.4

10 Jul 18:06
d818fcb

Choose a tag to compare

What's Changed

Full Changelog: v0.5.3...v0.5.4

PyTao v0.5.3

14 May 23:46
d39d862

Choose a tag to compare

What's Changed

Full Changelog: v0.5.2...v0.5.3

PyTao v0.5.2

28 Apr 16:45
a8d3ddb

Choose a tag to compare

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