from conjuror.plans.truebeam import OpenField, MLCLeafBoundaryAlignmentMode, TrueBeamMachine

# INWARD: Exclude intermediate boundaries from the field
procedure = OpenField(x1=-10, x2=10, y1=-51, y2=51, mlc_mode=MLCLeafBoundaryAlignmentMode.INWARD, beam_name="INWARD")
machine = TrueBeamMachine(mlc_is_hd=False)
procedure.compute(machine)
beam = procedure.beams[0]

# Generate MLC animation and zoom in on top edge
fig = beam.animate_mlc(show=False)
fig.update_layout(xaxis_range=[-20, 20], yaxis_range=[40, 60])
fig