def set_optics(v=None): el = [] el.append(srwlib.SRWLOptD(1e-16)) el.append(srwlib.SRWLOptD(6.866)) ifnMirror1 = "mirror_1d.dat" if ifnMirror1: hProfDataMirror1 = srwlib.srwl_uti_read_data_cols(ifnMirror1, "\t", 0, 1) el.append(srwlib.srwl_opt_setup_surf_height_1d(hProfDataMirror1, _dim="x", _ang=0.0436332, _amp_coef=1.0, _size_x=0.001, _size_y=0.001)) el.append(srwlib.SRWLOptD(20.634)) el.append(srwlib.SRWLOptG(_mirSub=srwlib.SRWLOptMirPl(_size_tang=0.2, _size_sag=0.015, _nvx=0.0, _nvy=0.99991607766, _nvz=-0.0129552165771, _tvx=0.0, _tvy=0.0129552165771), _m=1.0, _grDen=1800.0, _grDen1=0.08997, _grDen2=3.004e-06, _grDen3=9.73e-11, _grDen4=0.0)) el.append(srwlib.SRWLOptA("r", "a", 0.015, 0.00259104331543, 0.0, 0.0)) el.append(srwlib.SRWLOptD(34.63)) el.append(srwlib.SRWLOptA("r", "a", 0.01832012956, 0.02, 0.0, 0.0)) el.append(srwlib.SRWLOptMirEl(_p=89.63, _q=8.006, _ang_graz=0.0436332, _size_tang=0.42, _size_sag=0.02, _nvx=0.999048222947, _nvy=0.0, _nvz=-0.0436193560953, _tvx=-0.0436193560953, _tvy=0.0)) el.append(srwlib.SRWLOptD(8.006)) el.append(srwlib.SRWLOptA("r", "a", 0.0015, 0.0015, 0.0, 0.0)) el.append(srwlib.SRWLOptD(6.01)) el.append(srwlib.SRWLOptA("r", "a", 0.0130858068286, 0.003, 0.0, 0.0)) el.append(srwlib.SRWLOptMirEl(_p=6.01, _q=0.911, _ang_graz=0.0872665, _size_tang=0.3, _size_sag=0.05, _nvx=0.996194694832, _nvy=0.0, _nvz=-0.0871557800056, _tvx=-0.0871557800056, _tvy=0.0)) el.append(srwlib.SRWLOptD(0.5)) el.append(srwlib.SRWLOptMirEl(_p=6.51, _q=0.411, _ang_graz=0.0872665, _size_tang=0.3, _size_sag=0.05, _nvx=0.0, _nvy=0.996194694832, _nvz=-0.0871557800056, _tvx=0.0, _tvy=-0.0871557800056)) el.append(srwlib.SRWLOptD(0.411)) pp = [] pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0]) pp.append([0, 0, 1.0, 1, 0, 1.0, 1.0, 1.0, 1.0]) if ifnMirror1: pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0]) pp.append([0, 0, 1.0, 1, 0, 1.2, 3.5, 1.2, 3.0]) pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0]) pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0]) pp.append([0, 0, 1.0, 1, 0, 1.0, 1.0, 1.0, 1.0]) pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0]) pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0]) pp.append([0, 0, 1.0, 1, 0, 3.0, 1.0, 3.0, 1.0]) pp.append([0, 0, 1.0, 0, 0, 0.4, 1.0, 0.4, 1.0]) pp.append([0, 0, 1.0, 1, 0, 1.0, 1.0, 1.0, 1.0]) pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0]) pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0]) pp.append([0, 0, 1.0, 1, 0, 2.0, 1.0, 2.0, 1.0]) pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0]) pp.append([0, 0, 1.0, 1, 0, 1.0, 1.0, 1.0, 1.0]) pp.append([0, 0, 1.0, 0, 1, 0.07, 1.5, 0.07, 6.0]) return srwlib.SRWLOptC(el, pp)
def set_optics(v=None): el = [] pp = [] names = [ 'Fixed_Mask', 'Fixed_Mask_M1A', 'M1A', 'M1A_Watchpoint', 'Watchpoint', 'M2A_VDM', 'M2A_VDM_Grating', 'Grating', 'Grating_Aperture', 'Aperture', 'Watchpoint2', 'M3A_HFM', 'M3A_HFM_Watchpoint3', 'Watchpoint3', 'Pinhole', 'Watchpoint4', 'Watchpoint4_Sample', 'Sample' ] for el_name in names: if el_name == 'Fixed_Mask': # Fixed_Mask: aperture 26.2m el.append( srwlib.SRWLOptA( _shape=v.op_Fixed_Mask_shape, _ap_or_ob='a', _Dx=v.op_Fixed_Mask_Dx, _Dy=v.op_Fixed_Mask_Dy, _x=v.op_Fixed_Mask_x, _y=v.op_Fixed_Mask_y, )) pp.append(v.op_Fixed_Mask_pp) elif el_name == 'Fixed_Mask_M1A': # Fixed_Mask_M1A: drift 26.2m el.append(srwlib.SRWLOptD(_L=v.op_Fixed_Mask_M1A_L, )) pp.append(v.op_Fixed_Mask_M1A_pp) elif el_name == 'M1A': # M1A: mirror 27.2m mirror_file = v.op_M1A_hfn assert os.path.isfile(mirror_file), \ 'Missing input file {}, required by M1A beamline element'.format(mirror_file) el.append( srwlib.srwl_opt_setup_surf_height_1d( srwlib.srwl_uti_read_data_cols(mirror_file, "\t", 0, 1), _dim=v.op_M1A_dim, _ang=abs(v.op_M1A_ang), _amp_coef=v.op_M1A_amp_coef, _size_x=v.op_M1A_size_x, _size_y=v.op_M1A_size_y, )) pp.append(v.op_M1A_pp) elif el_name == 'M1A_Watchpoint': # M1A_Watchpoint: drift 27.2m el.append(srwlib.SRWLOptD(_L=v.op_M1A_Watchpoint_L, )) pp.append(v.op_M1A_Watchpoint_pp) elif el_name == 'Watchpoint': # Watchpoint: watch 40.4m pass elif el_name == 'M2A_VDM': # M2A_VDM: mirror 40.4m mirror_file = v.op_M2A_VDM_hfn assert os.path.isfile(mirror_file), \ 'Missing input file {}, required by M2A_VDM beamline element'.format(mirror_file) el.append( srwlib.srwl_opt_setup_surf_height_1d( srwlib.srwl_uti_read_data_cols(mirror_file, "\t", 0, 1), _dim=v.op_M2A_VDM_dim, _ang=abs(v.op_M2A_VDM_ang), _amp_coef=v.op_M2A_VDM_amp_coef, _size_x=v.op_M2A_VDM_size_x, _size_y=v.op_M2A_VDM_size_y, )) pp.append(v.op_M2A_VDM_pp) elif el_name == 'M2A_VDM_Grating': # M2A_VDM_Grating: drift 40.4m el.append(srwlib.SRWLOptD(_L=v.op_M2A_VDM_Grating_L, )) pp.append(v.op_M2A_VDM_Grating_pp) elif el_name == 'Grating': # Grating: grating 40.46m mirror = srwlib.SRWLOptMirPl( _size_tang=v.op_Grating_size_tang, _size_sag=v.op_Grating_size_sag, _nvx=v.op_Grating_nvx, _nvy=v.op_Grating_nvy, _nvz=v.op_Grating_nvz, _tvx=v.op_Grating_tvx, _tvy=v.op_Grating_tvy, _x=v.op_Grating_x, _y=v.op_Grating_y, ) el.append( srwlib.SRWLOptG( _mirSub=mirror, _m=v.op_Grating_m, _grDen=v.op_Grating_grDen, _grDen1=v.op_Grating_grDen1, _grDen2=v.op_Grating_grDen2, _grDen3=v.op_Grating_grDen3, _grDen4=v.op_Grating_grDen4, )) pp.append(v.op_Grating_pp) elif el_name == 'Grating_Aperture': # Grating_Aperture: drift 40.46m el.append(srwlib.SRWLOptD(_L=v.op_Grating_Aperture_L, )) pp.append(v.op_Grating_Aperture_pp) elif el_name == 'Aperture': # Aperture: aperture 42.46m el.append( srwlib.SRWLOptA( _shape=v.op_Aperture_shape, _ap_or_ob='a', _Dx=v.op_Aperture_Dx, _Dy=v.op_Aperture_Dy, _x=v.op_Aperture_x, _y=v.op_Aperture_y, )) pp.append(v.op_Aperture_pp) elif el_name == 'Watchpoint2': # Watchpoint2: watch 42.46m pass elif el_name == 'M3A_HFM': # M3A_HFM: sphericalMirror 42.46m el.append( srwlib.SRWLOptMirSph( _r=v.op_M3A_HFM_r, _size_tang=v.op_M3A_HFM_size_tang, _size_sag=v.op_M3A_HFM_size_sag, _nvx=v.op_M3A_HFM_nvx, _nvy=v.op_M3A_HFM_nvy, _nvz=v.op_M3A_HFM_nvz, _tvx=v.op_M3A_HFM_tvx, _tvy=v.op_M3A_HFM_tvy, _x=v.op_M3A_HFM_x, _y=v.op_M3A_HFM_y, )) pp.append(v.op_M3A_HFM_pp) elif el_name == 'M3A_HFM_Watchpoint3': # M3A_HFM_Watchpoint3: drift 42.46m el.append(srwlib.SRWLOptD(_L=v.op_M3A_HFM_Watchpoint3_L, )) pp.append(v.op_M3A_HFM_Watchpoint3_pp) elif el_name == 'Watchpoint3': # Watchpoint3: watch 54.36m pass elif el_name == 'Pinhole': # Pinhole: aperture 54.36m el.append( srwlib.SRWLOptA( _shape=v.op_Pinhole_shape, _ap_or_ob='a', _Dx=v.op_Pinhole_Dx, _Dy=v.op_Pinhole_Dy, _x=v.op_Pinhole_x, _y=v.op_Pinhole_y, )) pp.append(v.op_Pinhole_pp) elif el_name == 'Watchpoint4': # Watchpoint4: watch 54.36m pass elif el_name == 'Watchpoint4_Sample': # Watchpoint4_Sample: drift 54.36m el.append(srwlib.SRWLOptD(_L=v.op_Watchpoint4_Sample_L, )) pp.append(v.op_Watchpoint4_Sample_pp) elif el_name == 'Sample': # Sample: watch 55.5m pass pp.append(v.op_fin_pp) return srwlib.SRWLOptC(el, pp)
def set_optics(v=None): el = [] pp = [] names = [ 'M1', 'M1_Grating', 'Grating', 'GA', 'GA_M3A', 'M3A', 'M3', 'M3_SSA', 'SSA', 'SSA_KBAperture', 'KBAperture', 'KBh', 'KBh_KBv', 'KBv', 'KBv_Sample', 'Sample' ] for el_name in names: if el_name == 'M1': # M1: mirror 34.366m mirror_file = v.op_M1_hfn assert os.path.isfile(mirror_file), \ 'Missing input file {}, required by M1 beamline element'.format(mirror_file) el.append( srwlib.srwl_opt_setup_surf_height_1d( srwlib.srwl_uti_read_data_cols(mirror_file, "\t", 0, 1), _dim=v.op_M1_dim, _ang=abs(v.op_M1_ang), _amp_coef=v.op_M1_amp_coef, _size_x=v.op_M1_size_x, _size_y=v.op_M1_size_y, )) pp.append(v.op_M1_pp) elif el_name == 'M1_Grating': # M1_Grating: drift 34.366m el.append(srwlib.SRWLOptD(_L=v.op_M1_Grating_L, )) pp.append(v.op_M1_Grating_pp) elif el_name == 'Grating': # Grating: grating 55.0m mirror = srwlib.SRWLOptMirPl( _size_tang=v.op_Grating_size_tang, _size_sag=v.op_Grating_size_sag, _nvx=v.op_Grating_nvx, _nvy=v.op_Grating_nvy, _nvz=v.op_Grating_nvz, _tvx=v.op_Grating_tvx, _tvy=v.op_Grating_tvy, _x=v.op_Grating_x, _y=v.op_Grating_y, ) el.append( srwlib.SRWLOptG( _mirSub=mirror, _m=v.op_Grating_m, _grDen=v.op_Grating_grDen, _grDen1=v.op_Grating_grDen1, _grDen2=v.op_Grating_grDen2, _grDen3=v.op_Grating_grDen3, _grDen4=v.op_Grating_grDen4, )) pp.append(v.op_Grating_pp) elif el_name == 'GA': # GA: aperture 55.0m el.append( srwlib.SRWLOptA( _shape=v.op_GA_shape, _ap_or_ob='a', _Dx=v.op_GA_Dx, _Dy=v.op_GA_Dy, _x=v.op_GA_x, _y=v.op_GA_y, )) pp.append(v.op_GA_pp) elif el_name == 'GA_M3A': # GA_M3A: drift 55.0m el.append(srwlib.SRWLOptD(_L=v.op_GA_M3A_L, )) pp.append(v.op_GA_M3A_pp) elif el_name == 'M3A': # M3A: aperture 89.63m el.append( srwlib.SRWLOptA( _shape=v.op_M3A_shape, _ap_or_ob='a', _Dx=v.op_M3A_Dx, _Dy=v.op_M3A_Dy, _x=v.op_M3A_x, _y=v.op_M3A_y, )) pp.append(v.op_M3A_pp) elif el_name == 'M3': # M3: ellipsoidMirror 89.63m el.append( srwlib.SRWLOptMirEl( _p=v.op_M3_p, _q=v.op_M3_q, _ang_graz=v.op_M3_ang, _size_tang=v.op_M3_size_tang, _size_sag=v.op_M3_size_sag, _nvx=v.op_M3_nvx, _nvy=v.op_M3_nvy, _nvz=v.op_M3_nvz, _tvx=v.op_M3_tvx, _tvy=v.op_M3_tvy, _x=v.op_M3_x, _y=v.op_M3_y, )) pp.append(v.op_M3_pp) elif el_name == 'M3_SSA': # M3_SSA: drift 89.63m el.append(srwlib.SRWLOptD(_L=v.op_M3_SSA_L, )) pp.append(v.op_M3_SSA_pp) elif el_name == 'SSA': # SSA: aperture 97.636m el.append( srwlib.SRWLOptA( _shape=v.op_SSA_shape, _ap_or_ob='a', _Dx=v.op_SSA_Dx, _Dy=v.op_SSA_Dy, _x=v.op_SSA_x, _y=v.op_SSA_y, )) pp.append(v.op_SSA_pp) elif el_name == 'SSA_KBAperture': # SSA_KBAperture: drift 97.636m el.append(srwlib.SRWLOptD(_L=v.op_SSA_KBAperture_L, )) pp.append(v.op_SSA_KBAperture_pp) elif el_name == 'KBAperture': # KBAperture: aperture 103.646m el.append( srwlib.SRWLOptA( _shape=v.op_KBAperture_shape, _ap_or_ob='a', _Dx=v.op_KBAperture_Dx, _Dy=v.op_KBAperture_Dy, _x=v.op_KBAperture_x, _y=v.op_KBAperture_y, )) pp.append(v.op_KBAperture_pp) elif el_name == 'KBh': # KBh: ellipsoidMirror 103.646m el.append( srwlib.SRWLOptMirEl( _p=v.op_KBh_p, _q=v.op_KBh_q, _ang_graz=v.op_KBh_ang, _size_tang=v.op_KBh_size_tang, _size_sag=v.op_KBh_size_sag, _nvx=v.op_KBh_nvx, _nvy=v.op_KBh_nvy, _nvz=v.op_KBh_nvz, _tvx=v.op_KBh_tvx, _tvy=v.op_KBh_tvy, _x=v.op_KBh_x, _y=v.op_KBh_y, )) pp.append(v.op_KBh_pp) elif el_name == 'KBh_KBv': # KBh_KBv: drift 103.646m el.append(srwlib.SRWLOptD(_L=v.op_KBh_KBv_L, )) pp.append(v.op_KBh_KBv_pp) elif el_name == 'KBv': # KBv: ellipsoidMirror 104.146m el.append( srwlib.SRWLOptMirEl( _p=v.op_KBv_p, _q=v.op_KBv_q, _ang_graz=v.op_KBv_ang, _size_tang=v.op_KBv_size_tang, _size_sag=v.op_KBv_size_sag, _nvx=v.op_KBv_nvx, _nvy=v.op_KBv_nvy, _nvz=v.op_KBv_nvz, _tvx=v.op_KBv_tvx, _tvy=v.op_KBv_tvy, _x=v.op_KBv_x, _y=v.op_KBv_y, )) pp.append(v.op_KBv_pp) elif el_name == 'KBv_Sample': # KBv_Sample: drift 104.146m el.append(srwlib.SRWLOptD(_L=v.op_KBv_Sample_L, )) pp.append(v.op_KBv_Sample_pp) elif el_name == 'Sample': # Sample: watch 104.557m pass pp.append(v.op_fin_pp) return srwlib.SRWLOptC(el, pp)
def set_optics(v=None): el = [] # M1: mirror 34.366m ifnMirror1 = "mirror_1d.dat" if ifnMirror1: assert os.path.isfile(ifnMirror1), "Missing input file mirror_1d.dat, required by M1 beamline element" hProfDataMirror1 = srwlib.srwl_uti_read_data_cols(ifnMirror1, "\t", 0, 1) el.append(srwlib.srwl_opt_setup_surf_height_1d(hProfDataMirror1, _dim="x", _ang=0.0436332, _amp_coef=1.0, _size_x=0.001, _size_y=0.001)) el.append(srwlib.SRWLOptD(20.634)) # Grating: grating 55.0m el.append(srwlib.SRWLOptG(_mirSub=srwlib.SRWLOptMirPl(_size_tang=0.2, _size_sag=0.015, _nvx=0.0, _nvy=0.99991607766, _nvz=-0.0129552165771, _tvx=0.0, _tvy=0.0129552165771, _x=0.0, _y=0.0), _m=1.0, _grDen=1800.0, _grDen1=0.08997, _grDen2=3.004e-06, _grDen3=9.73e-11, _grDen4=0.0)) # GA: aperture 55.0m el.append(srwlib.SRWLOptA("r", "a", 0.015, 0.00259104331543, 0.0, 0.0)) el.append(srwlib.SRWLOptD(34.63)) # M3A: aperture 89.63m el.append(srwlib.SRWLOptA("r", "a", 0.01832012956, 0.02, 0.0, 0.0)) # M3: ellipsoidMirror 89.63m el.append(srwlib.SRWLOptMirEl(_p=89.63, _q=8.006, _ang_graz=0.0436332, _size_tang=0.42, _size_sag=0.02, _nvx=0.999048222947, _nvy=0.0, _nvz=-0.0436193560953, _tvx=-0.0436193560953, _tvy=0.0, _x=0.0, _y=0.0)) el.append(srwlib.SRWLOptD(8.006)) # SSA: aperture 97.636m el.append(srwlib.SRWLOptA("r", "a", 0.0015, 0.0015, 0.0, 0.0)) el.append(srwlib.SRWLOptD(6.01)) # KBAperture: aperture 103.646m el.append(srwlib.SRWLOptA("r", "a", 0.0130858068286, 0.003, 0.0, 0.0)) # KBh: ellipsoidMirror 103.646m el.append(srwlib.SRWLOptMirEl(_p=6.01, _q=0.911, _ang_graz=0.0872665, _size_tang=0.3, _size_sag=0.05, _nvx=0.996194694832, _nvy=0.0, _nvz=-0.0871557800056, _tvx=-0.0871557800056, _tvy=0.0, _x=0.0, _y=0.0)) el.append(srwlib.SRWLOptD(0.5)) # KBv: ellipsoidMirror 104.146m el.append(srwlib.SRWLOptMirEl(_p=6.51, _q=0.411, _ang_graz=0.0872665, _size_tang=0.3, _size_sag=0.05, _nvx=0.0, _nvy=0.996194694832, _nvz=-0.0871557800056, _tvx=0.0, _tvy=-0.0871557800056, _x=0.0, _y=0.0)) el.append(srwlib.SRWLOptD(0.411)) # Sample: watch 104.557m pp = [] # M1 if ifnMirror1: pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) pp.append([0, 0, 1.0, 1, 0, 1.2, 3.5, 1.2, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) # Grating pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) # GA pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) pp.append([0, 0, 1.0, 1, 0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) # M3A pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) # M3 pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) pp.append([0, 0, 1.0, 1, 0, 3.0, 1.0, 3.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) # SSA pp.append([0, 0, 1.0, 0, 0, 0.4, 1.0, 0.4, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) pp.append([0, 0, 1.0, 1, 0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) # KBAperture pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) # KBh pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) pp.append([0, 0, 1.0, 1, 0, 2.0, 1.0, 2.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) # KBv pp.append([0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) pp.append([0, 0, 1.0, 1, 0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) # Sample # final post-propagation pp.append([0, 0, 1.0, 0, 1, 0.07, 1.5, 0.07, 6.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) return srwlib.SRWLOptC(el, pp)
def set_optics(v=None): el = [] pp = [] names = [ 'Fixed_Mask', 'Fixed_Mask_Ap_M1', 'Ap_M1', 'M1', 'M1_M2', 'M2', 'M2_Before_Grating', 'Before_Grating', 'Grating', 'Gr_Surf_Height_Err_Before_M3', 'Before_M3', 'M3', 'Lens_Before_Exit_Slit', 'Before_Exit_Slit', 'Exit_Slit', 'After_Exit_Slit', 'After_Exit_Slit_Before_ZP', 'Before_ZP', 'Ap_ZP', 'Zone_Plate', 'After_ZP', 'After_ZP_Watchpoint', 'Watchpoint' ] for el_name in names: if el_name == 'Fixed_Mask': # Fixed_Mask: aperture 20.0m el.append( srwlib.SRWLOptA( _shape=v.op_Fixed_Mask_shape, _ap_or_ob='a', _Dx=v.op_Fixed_Mask_Dx, _Dy=v.op_Fixed_Mask_Dy, _x=v.op_Fixed_Mask_x, _y=v.op_Fixed_Mask_y, )) pp.append(v.op_Fixed_Mask_pp) elif el_name == 'Fixed_Mask_Ap_M1': # Fixed_Mask_Ap_M1: drift 20.0m el.append(srwlib.SRWLOptD(_L=v.op_Fixed_Mask_Ap_M1_L, )) pp.append(v.op_Fixed_Mask_Ap_M1_pp) elif el_name == 'Ap_M1': # Ap_M1: aperture 27.75m el.append( srwlib.SRWLOptA( _shape=v.op_Ap_M1_shape, _ap_or_ob='a', _Dx=v.op_Ap_M1_Dx, _Dy=v.op_Ap_M1_Dy, _x=v.op_Ap_M1_x, _y=v.op_Ap_M1_y, )) pp.append(v.op_Ap_M1_pp) elif el_name == 'M1': # M1: toroidalMirror 27.75m el.append( srwlib.SRWLOptMirTor( _rt=v.op_M1_rt, _rs=v.op_M1_rs, _size_tang=v.op_M1_size_tang, _size_sag=v.op_M1_size_sag, _x=v.op_M1_horizontalPosition, _y=v.op_M1_verticalPosition, _ap_shape=v.op_M1_ap_shape, _nvx=v.op_M1_nvx, _nvy=v.op_M1_nvy, _nvz=v.op_M1_nvz, _tvx=v.op_M1_tvx, _tvy=v.op_M1_tvy, )) pp.append(v.op_M1_pp) elif el_name == 'M1_M2': # M1_M2: drift 27.75m el.append(srwlib.SRWLOptD(_L=v.op_M1_M2_L, )) pp.append(v.op_M1_M2_pp) ## elif el_name == 'M2': ## # M2: mirror 33.75m ## mirror_file = v.op_M2_hfn ## assert os.path.isfile(mirror_file), \ ## 'Missing input file {}, required by M2 beamline element'.format(mirror_file) ## el.append(srwlib.srwl_opt_setup_surf_height_2d( ## srwlib.srwl_uti_read_data_cols(mirror_file, "\t"), ## _dim=v.op_M2_dim, ## _ang=abs(v.op_M2_ang), ## _amp_coef=v.op_M2_amp_coef, ## _size_x=v.op_M2_size_x, ## _size_y=v.op_M2_size_y, ## )) ## pp.append(v.op_M2_pp) elif el_name == 'M2_Before_Grating': # M2_Before_Grating: drift 33.75m el.append(srwlib.SRWLOptD(_L=v.op_M2_Before_Grating_L, )) pp.append(v.op_M2_Before_Grating_pp) elif el_name == 'Before_Grating': # Before_Grating: watch 34.25m pass elif el_name == 'Grating': # Grating: grating 34.25m mirror = srwlib.SRWLOptMirPl( _size_tang=v.op_Grating_size_tang, _size_sag=v.op_Grating_size_sag, _nvx=v.op_Grating_nvx, _nvy=v.op_Grating_nvy, _nvz=v.op_Grating_nvz, _tvx=v.op_Grating_tvx, _tvy=v.op_Grating_tvy, _x=v.op_Grating_x, _y=v.op_Grating_y, ) el.append( srwlib.SRWLOptG( _mirSub=mirror, _m=v.op_Grating_m, _grDen=v.op_Grating_grDen, _grDen1=v.op_Grating_grDen1, _grDen2=v.op_Grating_grDen2, _grDen3=v.op_Grating_grDen3, _grDen4=v.op_Grating_grDen4, )) pp.append(v.op_Grating_pp) elif el_name == 'Gr_Surf_Height_Err_Before_M3': # Gr_Surf_Height_Err_Before_M3: drift 34.25m el.append(srwlib.SRWLOptD( _L=v.op_Gr_Surf_Height_Err_Before_M3_L, )) pp.append(v.op_Gr_Surf_Height_Err_Before_M3_pp) elif el_name == 'Before_M3': # Before_M3: watch 36.75m pass elif el_name == 'M3': # M3: toroidalMirror 36.75m el.append( srwlib.SRWLOptMirTor( _rt=v.op_M3_rt, _rs=v.op_M3_rs, _size_tang=v.op_M3_size_tang, _size_sag=v.op_M3_size_sag, _x=v.op_M3_horizontalPosition, _y=v.op_M3_verticalPosition, _ap_shape=v.op_M3_ap_shape, _nvx=v.op_M3_nvx, _nvy=v.op_M3_nvy, _nvz=v.op_M3_nvz, _tvx=v.op_M3_tvx, _tvy=v.op_M3_tvy, )) pp.append(v.op_M3_pp) elif el_name == 'Lens_Before_Exit_Slit': # Lens_Before_Exit_Slit: drift 36.75m el.append(srwlib.SRWLOptD(_L=v.op_Lens_Before_Exit_Slit_L, )) pp.append(v.op_Lens_Before_Exit_Slit_pp) elif el_name == 'Before_Exit_Slit': # Before_Exit_Slit: watch 51.75m pass elif el_name == 'Exit_Slit': # Exit_Slit: aperture 51.75m el.append( srwlib.SRWLOptA( _shape=v.op_Exit_Slit_shape, _ap_or_ob='a', _Dx=v.op_Exit_Slit_Dx, _Dy=v.op_Exit_Slit_Dy, _x=v.op_Exit_Slit_x, _y=v.op_Exit_Slit_y, )) pp.append(v.op_Exit_Slit_pp) elif el_name == 'After_Exit_Slit': # After_Exit_Slit: watch 51.75m pass elif el_name == 'After_Exit_Slit_Before_ZP': # After_Exit_Slit_Before_ZP: drift 51.75m el.append(srwlib.SRWLOptD(_L=v.op_After_Exit_Slit_Before_ZP_L, )) pp.append(v.op_After_Exit_Slit_Before_ZP_pp) elif el_name == 'Before_ZP': # Before_ZP: watch 56.75m pass elif el_name == 'Ap_ZP': # Ap_ZP: aperture 56.75m el.append( srwlib.SRWLOptA( _shape=v.op_Ap_ZP_shape, _ap_or_ob='a', _Dx=v.op_Ap_ZP_Dx, _Dy=v.op_Ap_ZP_Dy, _x=v.op_Ap_ZP_x, _y=v.op_Ap_ZP_y, )) pp.append(v.op_Ap_ZP_pp) elif el_name == 'Zone_Plate': # Zone_Plate: zonePlate 56.75m el.append( srwlib.SRWLOptZP( _nZones=v.op_Zone_Plate_nZones, _rn=v.op_Zone_Plate_rn, _thick=v.op_Zone_Plate_thick, _delta1=v.op_Zone_Plate_delta1, _atLen1=v.op_Zone_Plate_atLen1, _delta2=v.op_Zone_Plate_delta2, _atLen2=v.op_Zone_Plate_atLen2, _x=v.op_Zone_Plate_x, _y=v.op_Zone_Plate_y, )) pp.append(v.op_Zone_Plate_pp) elif el_name == 'After_ZP': # After_ZP: watch 56.75m pass elif el_name == 'After_ZP_Watchpoint': # After_ZP_Watchpoint: drift 56.75m el.append(srwlib.SRWLOptD(_L=v.op_After_ZP_Watchpoint_L, )) pp.append(v.op_After_ZP_Watchpoint_pp) elif el_name == 'Watchpoint': # Watchpoint: watch 56.753227m pass pp.append(v.op_fin_pp) #print(pp) return srwlib.SRWLOptC(el, pp)