format_command

format_command(*args, **kwargs)[source]

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

Parameters:
  • cmd – base command (serves as template for parameter types)

  • args – initial bareword command arguments (including command name!)

  • kwargs – following named command arguments

Return type:

str

Returns:

command string

Examples:

>>> format_command('twiss', sequence='lhc')
'twiss, sequence=lhc;'
>>> format_command('option', echo=True)
'option, echo;'
>>> format_command('constraint', betx=Constraint(max=3.13))
'constraint, betx<3.13;'