def __init__(self, name="Undefined", boundary_shape=BoundaryShape(), optical_element_displacement=None): Slit.__init__(self, name=name, boundary_shape=boundary_shape) SRWOpticalElement.__init__(self, optical_element_displacement)
def __init__(self, name="Undefined", boundary_shape=BoundaryShape(), slit_parameters=Shadow3SlitParameters()): Slit.__init__(self, name=name, boundary_shape=boundary_shape) Shadow3Absorber.__init__(self, slit_parameters)
def __init__(self, name="Undefined", boundary_shape=BoundaryShape()): Slit.__init__(self, name=name, boundary_shape=boundary_shape)
from syned.beamline.beamline import Beamline from syned.beamline.beamline_element import BeamlineElement from syned.beamline.element_coordinates import ElementCoordinates if __name__ == "__main__": src1 = ElectronBeam.initialize_as_pencil_beam(energy_in_GeV=6.0,current=0.2) src2 = Undulator() screen1 = Screen("screen1") lens1 = IdealLens(name="lens1",focal_y=6.0,focal_x=None,) filter1 = Filter("filter1","H2O",3.0e-6) slit1 = Slit(name="slit1",boundary_shape=Rectangle(-0.5e-3,0.5e-3,-2e-3,2e-3)) stopper1 = BeamStopper(name="stopper1",boundary_shape=Rectangle(-0.5e-3,0.5e-3,-2e-3,2e-3)) mirror1 = Mirror(name="mirror1",boundary_shape=Rectangle(-0.5e-3,0.5e-3,-2e-3,2e-3)) crystal1 = Crystal(name="crystal1",surface_shape=Plane()) grating1 = Grating(name="grating1",surface_shape=Conic()) mylist = [src1,src2,screen1,lens1,filter1,slit1, stopper1, mirror1, grating1, crystal1] # # test individual elements # for i,element in enumerate(mylist): element.to_json("tmp_%d.json"%i) for i,element in enumerate(mylist):
from syned.beamline.shape import MultiplePatch if __name__ == "__main__": src1 = ElectronBeam.initialize_as_pencil_beam(energy_in_GeV=6.0,current=0.2) src2 = Undulator() screen1 = Screen("screen1") patches = MultiplePatch() patches.append_rectangle(-0.02,-0.01,-0.001,0.001) patches.append_rectangle(0.01,0.02,-0.001,0.001) slit1 = Slit(name="slit1",boundary_shape=patches) mylist = [src1,src2,slit1] # # test individual elements # for i,element in enumerate(mylist): element.to_json("tmp_%d.json"%i) for i,element in enumerate(mylist): print("loading element %d"%i) tmp = load_from_json_file("tmp_%d.json"%i) print("returned class: ",type(tmp))
print(lens1.to_json()) # # absorbers # filter1 = Filter("filter1","H2O",3.0e-6) filter1.keys() print(filter1.info()) print(filter1.to_json()) # print(filter1._support_dictionary) #slit1 = Slit.initialize_as_rectangle("slit1",2e-3,4e-3) slit1 = Slit(name="slit1",boundary_shape=Rectangle(-0.5e-3,0.5e-3,-2e-3,2e-3)) slit1.keys() print(slit1.info()) print(slit1.to_json()) slit2 = Slit(name="slit2") slit2.set_rectangle(width=3e-4,height=5e-4) slit2.set_circle(radius=3e-4) print(slit2.info()) print(slit2.to_json()) stopper1 = BeamStopper(name="stopper1",boundary_shape=Rectangle(-0.5e-3,0.5e-3,-2e-3,2e-3))