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

# ROUND: Round to nearest MLC boundary
procedure = OpenField(x1=-10, x2=10, y1=-51, y2=51, mlc_mode=MLCLeafBoundaryAlignmentMode.ROUND, beam_name="ROUND")
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