def intensityFromBeam(self, beam): st.plotxy(beam, 1, 3) # return value is expected to be [z(x,y),x,y] intensity = [ np.arange(9).reshape((3, 3)), np.array([0.0, 1.0, 2.0]), np.array([0.0, 1.0, 2.0]) ] return intensity
if source_create == 1: # creates source from start.00 if "-s" src.load('start.00') beamSource.genSource(src) if write: beamSource.write("begin.dat") else: # reads source from binary file" start.00 beamSource.load('begin.dat') # # get fwhm of the source # g1 = st.plotxy(beamSource,1,3,calfwhm=1,nbins=200,noplot=noplot) fw0 = numpy.array([g1.fwhmx,g1.fwhmy]) # # start loop on scanList # for scanIndex,scanWhat in enumerate(scanList): # loop on scanning variable out = numpy.zeros( (9,scan1.size) ) for i in range(scan1.size): oe1.load("start.01") #run system with only 1 oe if write: oe1.FWRITE=0 # write(0) or not(3) binary files else:
bm = Shadow3BendingMagnetLightSource( electron_beam=electron_beam, bending_magnet_magnetic_structure=BendingMagnet(radius=0.0, magnetic_field=1.2, length=0.0), bending_magnet_parameters=Shadow3BendingMagnetParameters(NPOINT=50000)) slit = Shadow3Slit(name="first slit", boundary_shape=Rectangle(x_left=-0.0001, x_right=0.0001, y_bottom=-0.0005, y_top=0.0005), slit_parameters=Shadow3SlitParameters()) slit_coordinates = ElementCoordinates(p=10.0, q=0.0) elements = RaytracingElements() elements.add_beamline_element( BeamlineElement(optical_element=slit, coordinates=slit_coordinates)) raytracing_parameters = RaytracingParameters(beam=bm.generate_source(), raytracing_elements=elements) beam = raytracing_manager.do_raytracing( raytracing_parameters=raytracing_parameters, handler_name=Shadow3Raytracer.HANDLER_NAME) import Shadow.ShadowTools as ST ST.plotxy(beam, 1, 3, nolost=True) # ST.histo1(beam,11)
# get Shadow source # if source_create == 1: # creates source from start.00 if "-s" src.load('start.00') beamSource.genSource(src) if write: beamSource.write("begin.dat") else: # reads source from binary file" start.00 beamSource.load('begin.dat') # # get fwhm of the source # g1 = st.plotxy(beamSource, 1, 3, calfwhm=1, nbins=200, noplot=noplot) fw0 = numpy.array([g1.fwhmx, g1.fwhmy]) # # start loop on scanList # for scanIndex, scanWhat in enumerate(scanList): # loop on scanning variable out = numpy.zeros((9, scan1.size)) for i in range(scan1.size): oe1.load("start.01") #run system with only 1 oe if write: oe1.FWRITE = 0 # write(0) or not(3) binary files else: