def __init__(self, bl=None, instrument='origin', d_offset=0, **kwargs):
     """
     inputs:
         bl: instance of the beamline class from xrt
         instrument: LCLS instrument ('TXI','XPP','XCS','MFX','CXI','MEC')
         d_offset: offset distance from the sample position
         **kwargs: kwargs argument to pass to GeometricSource instance
     """
     GeometricSource.__init__(self, bl=bl, name=instrument, **kwargs)
     FWHM, div = self.LCLS_source_properties()
     d = {
         'origin': 0,
         'TXI': 140,
         'XPP': 150,
         'XCS': 400,
         'MFX': 415,
         'CXI': 425,
         'MEC': 440
     }  #[m]
     # Sample position for each instrument
     d = d[instrument] + d_offset
     FWHM = FWHM + div * d  #um
     self.dx = FWHM / 1000 / 2.634  # sigma [mm]
     self.dz = FWHM / 1000 / 2.634  # sigma [mm]
     self.dxprime = div / 1e6  # [rad]
     self.dzprime = div / 1e6  # [rad]
Пример #2
0
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
Пример #3
0
def build_beamline():
    bl = raycing.BeamLine()

    # Source
    bl.source = GeometricSource(bl=bl,
                                dx=0.02,
                                dz=0.02,
                                dxprime=4E-6,
                                dzprime=4E-6,
                                energies=[E0])
    # bl.source = GeometricSource(
    #     bl=bl, dx=0.02, dz=0.02, dxprime=0, dzprime=0, energies=[E0])

    # Optical elements
    bl.oes = []
    ParabolicalMirrorParam(bl=bl,
                           center=np.array([0, D, 0]),
                           pitch=m_pitch,
                           q=q,
                           material=m_mat,
                           isCylindrical=True,
                           limPhysY=[-200, 200])

    ParabolicalMirrorParam(bl=bl,
                           center=bl.oes[0].center + 2 * q * n,
                           pitch=-m_pitch,
                           positionRoll=np.pi,
                           p=q,
                           material=m_mat,
                           isCylindrical=True,
                           limPhysY=[-200, 200])

    # Screens
    bl.s1 = Screen(bl=bl, name='source', center=np.asarray(bl.source.center))
    bl.s2 = Screen(bl=bl,
                   name='focus',
                   center=bl.oes[0].center + q * n,
                   z=get_perpendicular_vector(n))
    bl.s3 = Screen(
        bl=bl,
        name='detector',
        center=bl.oes[1].center + np.array([0, 300, 0]),
    )

    print('\n\n')
    print('OEs position:')
    print(bl.oes[0].center)
    print(bl.oes[1].center)
    print('\n')
    print('\nScreens position:')
    print(bl.s1.center)
    print(bl.s2.center)
    print(bl.s3.center)
    print('\n\n')
    return bl
Пример #4
0
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
Пример #5
0
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
Пример #6
0
 def __init__(self, *args, **kwargs):
     self.enstep = kwargs.pop('enstep', None)
     self.ensig = kwargs.pop('ensig', None)
     self.enmix = kwargs.pop('enmix', 1)
     GeometricSource.__init__(self, *args, **kwargs)
     self.distE = 'lines'