def build_beamline(): bl = raycing.BeamLine() # Source bl.source = LCLS_source(bl=bl, instrument=instrument, **source_kwargs) # Optical elements oes = [] print('OEs position:') for kwargs in oes_kwargs: if 'crystal' in kwargs['name']: oes.append(OE(bl=bl, **kwargs)) elif 'parabolic_mirror' in kwargs['name']: oes.append(ParabolicalMirrorParam(bl=bl, **kwargs)) elif 'elliptical_mirror' in kwargs['name']: oes.append(EllipticalMirrorParam(bl=bl, **kwargs)) elif 'flat_mirror' in kwargs['name']: oes.append(OE(bl=bl, **kwargs)) print(oes[-1].center) bl.oes = oes # Screens print('\nScreens position:') for kwargs in s_kwargs: Screen(bl=bl, **kwargs) print(bl.screens[-1].center) # manual screens: bl.on_focus = Screen(bl=bl, **focus_kwargs) print('Focus:' + str(bl.screens[-1].center)) bl.detector = Screen(bl=bl, **detector_kwargs) print('Detector:' + str(bl.screens[-1].center)) print('\n') return bl
def build_beamline(): bl = raycing.BeamLine() # Source and optical elements bl.source = GeometricSource(bl=bl, **oes_kwargs[0]) oes = [] print('OEs position:') for kwargs in oes_kwargs[1:]: if 'crystal' in kwargs['name']: oes.append(OE(bl=bl, **kwargs)) elif 'parabolic_mirror' in kwargs['name']: oes.append(ParabolicalMirrorParam(bl=bl, **kwargs)) elif 'flat_mirror' in kwargs['name']: oes.append(OE(bl=bl, **kwargs)) elif 'crl' in kwargs['name']: oes.append(DoubleParaboloidLens(bl=bl, **kwargs)) elif 'slits' in kwargs['name']: oes.append(RectangularAperture(bl=bl, **kwargs)) else: print('OE not implemented (build beamline)') print('\t' + oes[-1].name + ': ' + str(oes[-1].center)) bl.oes = oes # Screens print('\nScreens position:') for kwargs in screens_kwargs: Screen(bl=bl, **kwargs) print('\t' + kwargs['name'] + ': ' + str(bl.screens[-1].center)) print('\n') return bl
def build_beamline(): bl = raycing.BeamLine() # Source and optical elements bl.source = GeometricSource(bl=bl, **source_kwargs) oes = [] oes.append(OE(bl=bl, **crystal0_kwargs)) oes.append(OE(bl=bl, **crystal1_kwargs)) # bl.oes = oes # Screens # print('\nScreens position:') # for kwargs in screens_kwargs: # Screen(bl=bl, **kwargs) # print('\t' + kwargs['name'] + ': ' + str(bl.screens[-1].center)) # print('\n') return bl
def build_beamline(): bl = raycing.BeamLine() # Source # bl.source = LCLS_source(bl=bl, instrument=instrument, **source_kwargs) pop = source_kwargs.pop('d_offset') # bl.source = GeometricSource(bl=bl, dx=100e-6, dz=100e-6, dxprime=2e-6, \ # dzprime=2e-6, **source_kwargs) bl.source = GeometricSource(bl=bl, dx=100e-6, dz=100e-6, dxprime=0, \ dzprime=0, **source_kwargs) # Optical elements oes = [] print('OEs position:') for kwargs in oes_kwargs: if 'crystal' in kwargs['name']: oes.append(OE(bl=bl, **kwargs)) elif 'parabolic_mirror' in kwargs['name']: oes.append(ParabolicalMirrorParam(bl=bl, **kwargs)) elif 'flat_mirror' in kwargs['name']: oes.append(OE(bl=bl, **kwargs)) elif 'rectangular_aperture' in kwargs['name']: oes.append(RectangularAperture(bl=bl, **kwargs)) else: print('OE not implemented (build beamline)') print('\t' + oes[-1].name + ': ' + str(oes[-1].center)) bl.oes = oes # Screens print('\nScreens position:') for kwargs in s_kwargs: Screen(bl=bl, **kwargs) print('\t' + str(bl.screens[-1].center)) for kwargs in special_screens_kwargs: Screen(bl=bl, **kwargs) print('\t' + str(bl.screens[-1].name) + ': ' + str(bl.screens[-1].center)) # bl.on_focus = Screen(bl=bl, **focus_kwargs) # print('Focus:' + str(bl.screens[-1].center)) # bl.detector = Screen(bl=bl, **detector_kwargs) # print('Detector:' + str(bl.screens[-1].center)) print('\n') return bl
def build_beamline(): ## beamline BL = raycing.BeamLine() BL.source = LSource(BL, nrays=nrays, energies=[E0, dE], enstep=enstep, ensig=ensig, enmix=enmix, distx='flat', dx=[-bsize[0] / 2, bsize[0] / 2], distz='flat', dz=[-bsize[1] / 2, bsize[1] / 2], distxprime='flat', dxprime=[-bdiv[0], bdiv[0]], distzprime='flat', dzprime=[-bdiv[1], bdiv[1]]) BL.c1 = OE(BL, center=c1_pos, material=c_1, pitch=c1_pitch, alpha=alpha_1) BL.c2 = OE(BL, center=c2_pos, material=c_2, positionRoll=pi, pitch=c2_pitch, alpha=alpha_2) BL.c3 = OE(BL, center=c3_pos, material=c_3, positionRoll=pi, pitch=c3_pitch, alpha=alpha_3) BL.c4 = OE(BL, center=c4_pos, material=c_4, pitch=c4_pitch, alpha=alpha_4) BL.c5 = OE(BL, center=c5_pos, material=c_5, pitch=c5_pitch, alpha=alpha_5) BL.c6 = OE(BL, center=c6_pos, material=c_6, positionRoll=pi, pitch=c6_pitch, alpha=alpha_6) #BL.slt1 = RectangularAperture(BL, center=slit_pos, # opening=[-0.2, 0.2, -1, 1]) ## virtual screens BL.s0 = Screen(BL, center=c1_pos) BL.s1 = Screen(BL, center=c2_pos, z=[0, -sin(c1_out), cos(c1_out)]) BL.s2 = Screen(BL, center=c3_pos, z=[0, -sin(c2_out), cos(c2_out)]) BL.s3 = Screen(BL, center=c4_pos, z=[0, -sin(c3_out), cos(c3_out)]) BL.s4 = Screen(BL, center=c5_pos, z=[0, -sin(c4_out), cos(c5_out)]) BL.s5 = Screen(BL, center=c6_pos, z=[0, -sin(c5_out), cos(c6_out)]) BL.s6 = Screen(BL, center=c6_pos + [0, 1000, 0], z=[0, -sin(c6_out), cos(c6_out)]) return BL
def build_beamline(): bl = raycing.BeamLine() # Source bl.source = LCLS_source(bl=bl, instrument=instrument, **source_kwargs) # Crystals xtals = [] for kwargs in xtal_kwargs: xtals.append(OE(bl=bl, **kwargs)) bl.xtals = xtals # Screens for kwargs in s_kwargs: Screen(bl=bl, **kwargs) bl.detector = Screen(bl=bl, **detector_kwargs) return bl
def build_beamline(): ## beamline BL = raycing.BeamLine() BL.source = LSource(BL, nrays=nrays, energies=[E0, dE], enstep=enstep, ensig=ensig, enmix=enmix, distx='flat', dx=[-bsize[0] / 2, bsize[0] / 2], distz='flat', dz=[-bsize[1] / 2, bsize[1] / 2], distxprime='flat', dxprime=[-bdiv[0], bdiv[0]], distzprime='flat', dzprime=[-bdiv[1], bdiv[1]]) BL.mirr1 = PMirror(BL, center=mirr1_pos, material=mL, pitch=braggML, limPhysY=[-mirr_len / 2, mirr_len / 2], limPhysX=[-mirr_width / 2, mirr_width / 2], f1=mirr1_p, slope_error=slope_error) BL.xtal1 = OE(BL, center=xtal1_pos, material=crystalGe, pitch=xtal1_pitch, alpha=alphaGe) BL.xtal2 = OE(BL, center=xtal2_pos, material=crystalGe, pitch=xtal2_pitch, alpha=alphaGe2) BL.mirr2 = PMirror(BL, center=mirr2_pos, material=mL, pitch=braggML2, extraPitch=xtal2_out, limPhysY=[-mirr_len / 2, mirr_len / 2], limPhysX=[-mirr_width / 2, mirr_width / 2], f2=mirr2_q, slope_error=slope_error) BL.slt1 = RectangularAperture(BL, center=slit_pos, opening=[-10.2, 10.2, -10, 10]) ## virtual screens BL.s0 = Screen(BL, center=mirr1_pos) BL.s1 = Screen(BL, center=xtal1_pos, z=[0, -sin(mirr1_out), cos(mirr1_out)]) BL.s2 = Screen(BL, center=xtal2_pos, z=[0, -sin(xtal1_out), cos(xtal1_out)]) BL.s3 = Screen(BL, center=mirr2_pos, z=[0, -sin(xtal2_out), cos(xtal2_out)]) BL.sdebug = Screen(BL, center=xtal2_pos + n[3] * 15, z=[0, -sin(xtal2_out), cos(xtal2_out)]) ## detector screen, generally placed at 2nd montel focal point s4_pos = [ 0, mirr2_pos[1] - det_mirr2 * cos(pi - mirr2_out), mirr2_pos[2] + det_mirr2 * sin(pi - mirr2_out) ] s4_ang = [ 0, -sin(mirr2_out + det_ang_offset), cos(mirr2_out + det_ang_offset) ] BL.s4 = Screen(BL, center=s4_pos, z=s4_ang) return BL
def __init__(self, *args, **kwargs): kwargs = self.__pop_kwargs(**kwargs) OE.__init__(self, *args, **kwargs) self.isParametric = True self.isCylindrical = True self.reset_pq(self.p, self.q, self.f1, self.f2)