The user can now select between two different computation backends:
Numpy. As the names suggest, with
PyTorchall involved numbers/tensors are reprenseted as
torch.Tensorobjects which also allow for gradient tracking; with
Numpyall involved numbers/tensors are represented as
np.ndarrayobjects. This allows working with other Numpy-compatible libraries and generally opens the door for incorporating new backends such as Jax. The backend can be selected via the
DIPAS_BACKENDenvironment variable (
'pytorch'); if unset, the backend will default to
PyTorchas before. Alternatively, the backend can be manually switched via
import dipas.backends; dipas.backends.backend = dipas.backends.Numpy(). Note that in this case all previously loaded lattices/elements will retain the old backend’s tensor types, so reloading is required.
dipas.elementsmodule does not expose
Parameterattributes anymore; these are now accessible via
New exception types for errors during parsing and building:
Parsing and build errors now include the line number indicating where the error originated
MADX default values for element attributes are now supported
New option to define defaults for missing variables during parsing:
dipas.madx.parser.missing_variable_names(see Compatibility with MADX and
dipas.madx.parserfor details); this is useful for parsing sequences without optics files
Deleting elements from a segment now replaces them with equivalent drift spaces (the old behavior was to simply remove them; the difference matters for non-zero-length elements). In order to completely remove elements, one should delete from
Interface for external optimizers (+ example in docs)
Random noise for BPMErrors
Method for merging consecutive drift spaces:
New command line utility:
New module for plotting lattices and Twiss data:
New command line interface for common operations such as plotting, Twiss, ORM
build.Latticenow supports auto-labeling its elements.
A custom exception is raised if the orbit diverges during closed orbit search.
BPMErrorsare included during ORM computation.
Field errors can be added to
DiPAS 1.0 supports a wide variety of simulation capabilities among which are:
Closed orbit search
Orbit Response Matrix
Various lattice elements as well as alignment errors and field errors are supported.
The framework understands most MADX syntax for describing lattices and thus can parse MADX files. It also includes utility functions for interfacing with MADX and for creating corresponding script files.