orbit.bunch_utils.serialize#

Functions

TypedDict(typename[, fields, total])

A simple typed namespace.

collect_bunch(bunch[, output_dir, return_memmap])

Collects attributes from a PyOrbit Bunch across all MPI ranks and returns it as a dictionary. :param bunch: The PyOrbit::Bunch object from which to collect attributes. :type bunch: Bunch :param output_dir: The director to use for temporary storage of the bunch coordinates on each MPI rank. If None, the bunch will be stored in "/tmp". Note: take care that the temporary files are created in a directory where all MPI ranks have write access. :type output_dir: str | pathlib.Path, optional :param return_memmap: Return the bunch coordinates as a memory-mapped NumPy array, otherwise the entire array is copied into RAM and returned as normal NDArray. Default is True. :type return_memmap: bool, optional.

load_bunch(input_dir[, Handler])

Loads the bunch attributes from a specified directory containing NumPy binary files. :param input_dir: The directory from which to load the bunch data files. :type input_dir: str | pathlib.Path :param Handler: The file handler class to use for reading the bunch data. Default is NumPyHandler. See orbit.bunch_utils.file_handler for available handlers. :type Handler: FileHandler, optional.

save_bunch(bunch[, output_dir, Handler])

Saves the collected bunch attributes to a specified directory.

Classes

Any(*args, **kwargs)

Special type indicating an unconstrained type.

Bunch

The Bunch python wrapper

BunchDict

FileHandler(*args, **kwargs)

Protocol for file handlers to read/write bunch data.

NumPyHandler(dir_name)

Handler implementing the FileHandler protocol for NumPy binary files. This handler will create two files in the directory passed to the constructor: - coords.npy: A memory-mapped NumPy array containing the bunch coordinates. - attributes.npz: A NumPy archive containing data related to the synchronous particle and other bunch attributes.

Protocol()

Base class for protocol classes.

SyncPartDict