Skip to content

command seems to ignored using input #52

@rdemaria

Description

@rdemaria

In the example below, it looks like the "beam;" command is not sent to mad, although it appears in the command log. Splitting the input string in two parts does not show the problem.

from cpymad.madx import Madx
mad=Madx(command_log="log1.madx")

mad.input("""
l1=1; l2=1; l3=1; l4=1;
mb1: sbend, angle:=a1, l:=l1,tilt:=t1;
mb2: sbend, angle:=a2, l:=l2,tilt:=t2;
mb3: sbend, angle:=a3, l:=l3,tilt:=t3;
mb4: sbend, angle:=a4, l:=l4,tilt:=t4;
myseq : line =(mb1,mb2,mb3,mb4);
beam; """)

try:
   mad.use(sequence="myseq")
except RuntimeError:
    print("beam command seems ignored")

mad=Madx(command_log="log2.madx")
mad.input("""
l1=1; l2=1; l3=1; l4=1;
mb1: sbend, angle:=a1, l:=l1,tilt:=t1;
mb2: sbend, angle:=a2, l:=l2,tilt:=t2;
mb3: sbend, angle:=a3, l:=l3,tilt:=t3;
mb4: sbend, angle:=a4, l:=l4,tilt:=t4;
myseq : line =(mb1,mb2,mb3,mb4);
""")
mad.input("beam;")
mad.use(sequence="myseq")
print("works")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions