xsuite
xsuite copied to clipboard
Mad Writer does not handle duplicated elements correctly
A Madx sequence like this
mb: sbend, l:=1, angle:=0.1, k0:=0.2, k1=0.1;
ss: sequence, l:=2, refer=entry;
mb, at=0;
mb, at=1;
endsequence;
when loaded into Xsuite, and dumped back into mad format, gives an output like this:
ss: sequence, l=2.0;
ss$start: marker, at=0.0;
mb: sbend, l = 1.0, angle = 0.1, k0 = 0.2, e1 = 0.0, fint = 0.0, hgap = 0.0, e2 = 0.0, at=0.5;
mb_entry:0: marker, at=1.0;
mb:0: sbend, l = 1.0, angle = 0.1, k0 = 0.2, at=1.5;
mb_exit:0: marker, at=2.0;
ss$end: marker, at=2.0;
endsequence;
Which is not correct, as colons cannot be part of the element name in mad. We should decide how to handle these situations. I can see the following options:
- Replace the colon with something else – an underscore?
- Just repeat the name?
Regardless of madx, how do we want to handle repeated names? A typical case arises when identical cells are repeated.
This is now corrected