cpymad.util

Utility functions used in other parts of the pymad package.

Functions

mad_quote(value)

Add quotes to a string value.

is_identifier(name)

Check if name is a valid identifier in MAD-X.

name_from_internal(element_name)

Convert element name from internal representation to user API.

name_to_internal(element_name)

Convert element name from user API to internal representation.

format_param(key, value)

Format a single MAD-X command parameter.

format_cmdpar(cmd, key, value)

Format a single MAD-X command parameter.

format_command(*args, **kwargs)

Create a MAD-X command from its name and parameter list.

check_expression(expr)

Check if the given expression is a valid MAD-X expression that is safe to pass to cpymad.madx.Madx.eval().

temp_filename()

Get filename for use within 'with' block and delete file afterwards.

Classes

ChangeDirectory(path, chdir, getcwd)

Context manager for temporarily changing current working directory.

Class Inheritance Diagram

Inheritance diagram of cpymad.util.ChangeDirectory