Exemple #1
0
def main():
    v = srwl_bl.srwl_uti_parse_options(srwl_bl.srwl_uti_ext_options(varParam),
                                       use_sys_argv=True)
    op = set_optics(v)
    v.ss = True
    v.ss_pl = 'e'
    v.sm = True
    v.sm_pl = 'e'
    v.pw = True
    v.pw_pl = 'xy'
    v.si = True
    v.si_pl = 'xy'
    v.tr = True
    v.tr_pl = 'xz'
    v.ws = True
    v.ws_pl = 'xy'
    mag = None
    if v.rs_type == 'm':
        mag = srwlib.SRWLMagFldC()
        mag.arXc.append(0)
        mag.arYc.append(0)
        mag.arMagFld.append(
            srwlib.SRWLMagFldM(v.mp_field, v.mp_order, v.mp_distribution,
                               v.mp_len))
        mag.arZc.append(v.mp_zc)
    srwl_bl.SRWLBeamline(_name=v.name, _mag_approx=mag).calc_all(v, op)
Exemple #2
0
def run_experiment(other_params, propagation_params, set_up_funcs, plot=False):
    """
    names - [list] the name list of instruments.
    setting_params - [list] the meta information of the experiment.
    physics_params - [list] .
    propagation_params - [list] .
    """
    varParam = srwl_bl.srwl_uti_ext_options(other_params + propagation_params)
    v = srwl_bl.srwl_uti_parse_options(varParam, use_sys_argv=True)
    op = None
    for n, func in enumerate(set_up_funcs):
        value = func(v)
        if func.__name__ == 'set_optics':
            op = value
    if op is None:
        raise ValueError(
            "set_optics() function should be included in set_up_funcs")
    # this part is different for different beamline?
    v.ws = True
    if plot:
        v.ws_pl = 'xy'
    mag = None
    if v.rs_type == 'm':
        mag = srwlib.SRWLMagFldC()
        mag.arXc.append(0)
        mag.arYc.append(0)
        mag.arMagFld.append(
            srwlib.SRWLMagFldM(v.mp_field, v.mp_order, v.mp_distribution,
                               v.mp_len))
        mag.arZc.append(v.mp_zc)
    srwl_bl.SRWLBeamline(_name=v.name, _mag_approx=mag).calc_all(v, op)
    # remove saved image.
    if plot:
        plt.show()
    else:
        for file in glob.glob('*.png'):
            os.remove(file)
        plt.close('all')
    return
Exemple #3
0
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'Sample from Image', 'simulation name'],

    #---Data Folder
    [
        'fdir', 's', '',
        'folder (directory) name for reading-in input and saving output data files'
    ],

    #---Electron Beam
    ['ebm_nm', 's', '', 'standard electron beam name'],
    [
        'ebm_nms', 's', '',
        'standard electron beam name suffix: e.g. can be Day1, Final'
    ],
    ['ebm_i', 'f', 0.5, 'electron beam current [A]'],
    ['ebm_e', 'f', 3.0, 'electron beam avarage energy [GeV]'],
    ['ebm_de', 'f', 0.0, 'electron beam average energy deviation [GeV]'],
    [
        'ebm_x', 'f', 0.0,
        'electron beam initial average horizontal position [m]'
    ],
    ['ebm_y', 'f', 0.0, 'electron beam initial average vertical position [m]'],
    [
        'ebm_xp', 'f', 0.0,
        'electron beam initial average horizontal angle [rad]'
    ],
    ['ebm_yp', 'f', 0.0, 'electron beam initial average vertical angle [rad]'],
    [
        'ebm_z', 'f', 0.,
        'electron beam initial average longitudinal position [m]'
    ],
    [
        'ebm_dr', 'f', -1.54,
        'electron beam longitudinal drift [m] to be performed before a required calculation'
    ],
    ['ebm_ens', 'f', 0.00089, 'electron beam relative energy spread'],
    [
        'ebm_emx', 'f', 5.500000000000001e-10,
        'electron beam horizontal emittance [m]'
    ],
    ['ebm_emy', 'f', 8e-12, 'electron beam vertical emittance [m]'],
    # Definition of the beam through Twiss:
    ['ebm_betax', 'f', 2.02, 'horizontal beta-function [m]'],
    ['ebm_betay', 'f', 1.06, 'vertical beta-function [m]'],
    ['ebm_alphax', 'f', 0.0, 'horizontal alpha-function [rad]'],
    ['ebm_alphay', 'f', 0.0, 'vertical alpha-function [rad]'],
    ['ebm_etax', 'f', 0.0, 'horizontal dispersion function [m]'],
    ['ebm_etay', 'f', 0.0, 'vertical dispersion function [m]'],
    ['ebm_etaxp', 'f', 0.0, 'horizontal dispersion function derivative [rad]'],
    ['ebm_etayp', 'f', 0.0, 'vertical dispersion function derivative [rad]'],

    #---Undulator
    ['und_bx', 'f', 0.0, 'undulator horizontal peak magnetic field [T]'],
    ['und_by', 'f', 0.88770981, 'undulator vertical peak magnetic field [T]'],
    [
        'und_phx', 'f', 0.0,
        'initial phase of the horizontal magnetic field [rad]'
    ],
    [
        'und_phy', 'f', 0.0,
        'initial phase of the vertical magnetic field [rad]'
    ],
    [
        'und_b2e', '', '',
        'estimate undulator fundamental photon energy (in [eV]) for the amplitude of sinusoidal magnetic field defined by und_b or und_bx, und_by',
        'store_true'
    ],
    [
        'und_e2b', '', '',
        'estimate undulator field amplitude (in [T]) for the photon energy defined by w_e',
        'store_true'
    ],
    ['und_per', 'f', 0.02, 'undulator period [m]'],
    ['und_len', 'f', 3.0, 'undulator length [m]'],
    ['und_zc', 'f', 0.0, 'undulator center longitudinal position [m]'],
    [
        'und_sx', 'i', 1,
        'undulator horizontal magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_sy', 'i', -1,
        'undulator vertical magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_g', 'f', 6.72,
        'undulator gap [mm] (assumes availability of magnetic measurement or simulation data)'
    ],
    [
        'und_ph', 'f', 0.0,
        'shift of magnet arrays [mm] for which the field should be set up'
    ],
    ['und_mdir', 's', '', 'name of magnetic measurements sub-folder'],
    [
        'und_mfs', 's', '',
        'name of magnetic measurements for different gaps summary file'
    ],

    #---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    [
        'tr_cti', 'f', 0.0,
        'initial time moment (c*t) for electron trajectory calculation [m]'
    ],
    [
        'tr_ctf', 'f', 0.0,
        'final time moment (c*t) for electron trajectory calculation [m]'
    ],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    [
        'tr_mag', 'i', 1,
        'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'
    ],
    [
        'tr_fn', 's', 'res_trj.dat',
        'file name for saving calculated trajectory data'
    ],
    [
        'tr_pl', 's', '',
        'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'
    ],

    #Single-Electron Spectrum vs Photon Energy
    [
        'ss', '', '', 'calculate single-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'ss_ei', 'f', 100.0,
        'initial photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ef', 'f', 20000.0,
        'final photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ne', 'i', 10000,
        'number of points vs photon energy for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_x', 'f', 0.0,
        'horizontal position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_y', 'f', 0.0,
        'vertical position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_meth', 'i', 1,
        'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'ss_prec', 'f', 0.01,
        'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'
    ],
    [
        'ss_pol', 'i', 6,
        'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'ss_mag', 'i', 1,
        'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'
    ],
    [
        'ss_ft', 's', 'f',
        'presentation/domain: "f"- frequency (photon energy), "t"- time'
    ],
    [
        'ss_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'ss_fn', 's', 'res_spec_se.dat',
        'file name for saving calculated single-e spectrum vs photon energy'
    ],
    [
        'ss_pl', 's', '',
        'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    [
        'sm', '', '', 'calculate multi-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'sm_ei', 'f', 100.0,
        'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ef', 'f', 20000.0,
        'final photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ne', 'i', 10000,
        'number of points vs photon energy for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_x', 'f', 0.0,
        'horizontal center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_rx', 'f', 0.001,
        'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_nx', 'i', 1,
        'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_y', 'f', 0.0,
        'vertical center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ry', 'f', 0.001,
        'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ny', 'i', 1,
        'number of points vs vertical position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_mag', 'i', 1,
        'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'
    ],
    [
        'sm_hi', 'i', 1,
        'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_hf', 'i', 15,
        'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_prl', 'f', 1.0,
        'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_pra', 'f', 1.0,
        'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_meth', 'i', -1,
        'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'
    ],
    [
        'sm_prec', 'f', 0.01,
        'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'
    ],
    [
        'sm_nm', 'i', 1,
        'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_na', 'i', 5,
        'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'
    ],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    [
        'sm_pol', 'i', 6,
        'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'sm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'sm_fn', 's', 'res_spec_me.dat',
        'file name for saving calculated milti-e spectrum vs photon energy'
    ],
    [
        'sm_pl', 's', '',
        'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    [
        'pw_x', 'f', 0.0,
        'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_rx', 'f', 0.015,
        'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_nx', 'i', 100,
        'number of points vs horizontal position for calculation of power density distribution'
    ],
    [
        'pw_y', 'f', 0.0,
        'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ry', 'f', 0.015,
        'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ny', 'i', 100,
        'number of points vs vertical position for calculation of power density distribution'
    ],
    [
        'pw_pr', 'f', 1.0,
        'precision factor for calculation of power density distribution'
    ],
    [
        'pw_meth', 'i', 1,
        'power density computation method (1- "near field", 2- "far field")'
    ],
    [
        'pw_zst', 'f', 0.,
        'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_zfi', 'f', 0.,
        'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_mag', 'i', 1,
        'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'
    ],
    [
        'pw_fn', 's', 'res_pow.dat',
        'file name for saving calculated power density distribution'
    ],
    [
        'pw_pl', 's', '',
        'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    [
        'si', '', '',
        'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position',
        'store_true'
    ],
    #Single-Electron Wavefront Propagation
    [
        'ws', '', '',
        'calculate single-electron (/ fully coherent) wavefront propagation',
        'store_true'
    ],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    [
        'wm', '', '',
        'calculate multi-electron (/ partially coherent) wavefront propagation',
        'store_true'
    ],
    [
        'w_e', 'f', 9000.0,
        'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ef', 'f', -1.0,
        'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ne', 'i', 1,
        'number of points vs photon energy for calculation of intensity distribution'
    ],
    [
        'w_x', 'f', 0.0,
        'central horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_rx', 'f', 0.0005,
        'range of horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_nx', 'i', 100,
        'number of points vs horizontal position for calculation of intensity distribution'
    ],
    [
        'w_y', 'f', 0.0,
        'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ry', 'f', 0.0005,
        'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ny', 'i', 100,
        'number of points vs vertical position for calculation of intensity distribution'
    ],
    [
        'w_smpf', 'f', 1.0,
        'sampling factor for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_meth', 'i', 1,
        'method to use for calculation of intensity distribution vs horizontal and vertical position: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'w_prec', 'f', 0.01,
        'relative precision for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'si_pol', 'i', 6,
        'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'si_type', 'i', 0,
        'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'
    ],
    [
        'w_mag', 'i', 1,
        'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'
    ],
    [
        'si_fn', 's', 'res_int_se.dat',
        'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'
    ],
    [
        'si_pl', 's', '',
        'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'ws_fni', 's', 'res_int_pr_se.dat',
        'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'
    ],
    [
        'ws_pl', 's', '',
        'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'wm_nm', 'i', 1000,
        'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_na', 'i', 5,
        'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'
    ],
    [
        'wm_ch', 'i', 0,
        'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y; 40- intensity(s0), mutual intensity cuts and degree of coherence vs X & Y'
    ],
    [
        'wm_ap', 'i', 0,
        'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'
    ],
    [
        'wm_x0', 'f', 0,
        'horizontal center position for mutual intensity cut calculation'
    ],
    [
        'wm_y0', 'f', 0,
        'vertical center position for mutual intensity cut calculation'
    ],
    [
        'wm_ei', 'i', 0,
        'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'
    ],
    [
        'wm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'wm_am', 'i', 0,
        'multi-electron integration approximation method: 0- no approximation (use the standard 5D integration method), 1- integrate numerically only over e-beam energy spread and use convolution to treat transverse emittance'
    ],
    [
        'wm_fni', 's', 'res_int_pr_me.dat',
        'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'
    ],

    #to add options
    [
        'op_r', 'f', 20.0,
        'longitudinal position of the first optical element [m]'
    ],

    # Former appParam:
    [
        'rs_type', 's', 'u',
        'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'
    ],

    #---Beamline optics:
    # Sample: sample
    ['op_Sample_file_path', 's', 'sample.tif', 'imageFile'],
    ['op_Sample_outputImageFormat', 's', 'tif', 'outputImageFormat'],
    ['op_Sample_position', 'f', 20.0, 'position'],
    ['op_Sample_resolution', 'f', 2.480469e-09, 'resolution'],
    ['op_Sample_thick', 'f', 1e-05, 'thickness'],
    ['op_Sample_delta', 'f', 3.738856e-05, 'refractiveIndex'],
    ['op_Sample_atten_len', 'f', 3.38902e-06, 'attenuationLength'],
    [
        'op_Sample_horizontalCenterCoordinate', 'f', 0.0,
        'horizontalCenterCoordinate'
    ],
    [
        'op_Sample_verticalCenterCoordinate', 'f', 0.0,
        'verticalCenterCoordinate'
    ],
    ['op_Sample_rotateAngle', 'f', 0.0, 'rotateAngle'],
    ['op_Sample_cutoffBackgroundNoise', 'f', 0.5, 'cutoffBackgroundNoise'],
    ['op_Sample_cropArea', 'i', 1, 'cropArea'],
    ['op_Sample_extTransm', 'i', 1, 'transmissionImage'],
    ['op_Sample_areaXStart', 'i', 0, 'areaXStart'],
    ['op_Sample_areaXEnd', 'i', 1280, 'areaXEnd'],
    ['op_Sample_areaYStart', 'i', 0, 'areaYStart'],
    ['op_Sample_areaYEnd', 'i', 834, 'areaYEnd'],
    ['op_Sample_rotateReshape', 'i', 0, 'rotateReshape'],
    ['op_Sample_backgroundColor', 'i', 0, 'backgroundColor'],
    ['op_Sample_tileImage', 'i', 0, 'tileImage'],
    ['op_Sample_tileRows', 'i', 1, 'tileRows'],
    ['op_Sample_tileColumns', 'i', 1, 'tileColumns'],
    ['op_Sample_shiftX', 'i', 0, 'shiftX'],
    ['op_Sample_shiftY', 'i', 0, 'shiftY'],
    ['op_Sample_invert', 'i', 0, 'invert'],

    #---Propagation parameters
    [
        'op_Sample_pp', 'f',
        [
            0, 0, 1.0, 0, 0, 1.0, 100.0, 1.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0, 0.0
        ], 'Sample'
    ],
    [
        'op_fin_pp', 'f',
        [
            0, 0, 1.0, 0, 0, 0.005, 20.0, 0.005, 20.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0, 0.0
        ], 'final post-propagation (resize) parameters'
    ],

    #[ 0]: Auto-Resize (1) or not (0) Before propagation
    #[ 1]: Auto-Resize (1) or not (0) After propagation
    #[ 2]: Relative Precision for propagation with Auto-Resizing (1. is nominal)
    #[ 3]: Allow (1) or not (0) for semi-analytical treatment of the quadratic (leading) phase terms at the propagation
    #[ 4]: Do any Resizing on Fourier side, using FFT, (1) or not (0)
    #[ 5]: Horizontal Range modification factor at Resizing (1. means no modification)
    #[ 6]: Horizontal Resolution modification factor at Resizing
    #[ 7]: Vertical Range modification factor at Resizing
    #[ 8]: Vertical Resolution modification factor at Resizing
    #[ 9]: Type of wavefront Shift before Resizing (not yet implemented)
    #[10]: New Horizontal wavefront Center position after Shift (not yet implemented)
    #[11]: New Vertical wavefront Center position after Shift (not yet implemented)
    #[12]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Horizontal Coordinate
    #[13]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Vertical Coordinate
    #[14]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Longitudinal Coordinate
    #[15]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Horizontal Coordinate
    #[16]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Vertical Coordinate
])
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'NSLS-II ESM beamline', 'simulation name'],

#---Data Folder
    ['fdir', 's', '', 'folder (directory) name for reading-in input and saving output data files'],

#---Electron Beam
    ['ebm_nm', 's', 'NSLS-II Low Beta Final', 'standard electron beam name'],
    ['ebm_nms', 's', '', 'standard electron beam name suffix: e.g. can be Day1, Final'],
    ['ebm_i', 'f', 0.5, 'electron beam current [A]'],
    ['ebm_e', 'f', 3.0, 'electron beam avarage energy [GeV]'],
    ['ebm_de', 'f', 0.0, 'electron beam average energy deviation [GeV]'],
    ['ebm_x', 'f', 0.0, 'electron beam initial average horizontal position [m]'],
    ['ebm_y', 'f', 0.0, 'electron beam initial average vertical position [m]'],
    ['ebm_xp', 'f', 0.0, 'electron beam initial average horizontal angle [rad]'],
    ['ebm_yp', 'f', 0.0, 'electron beam initial average vertical angle [rad]'],
    ['ebm_z', 'f', 0., 'electron beam initial average longitudinal position [m]'],
    ['ebm_dr', 'f', -1.86675, 'electron beam longitudinal drift [m] to be performed before a required calculation'],
    ['ebm_ens', 'f', 0.00089, 'electron beam relative energy spread'],
    ['ebm_emx', 'f', 5.5e-10, 'electron beam horizontal emittance [m]'],
    ['ebm_emy', 'f', 8e-12, 'electron beam vertical emittance [m]'],
    # Definition of the beam through Twiss:
    ['ebm_betax', 'f', 2.02, 'horizontal beta-function [m]'],
    ['ebm_betay', 'f', 1.06, 'vertical beta-function [m]'],
    ['ebm_alphax', 'f', 0.0, 'horizontal alpha-function [rad]'],
    ['ebm_alphay', 'f', 0.0, 'vertical alpha-function [rad]'],
    ['ebm_etax', 'f', 0.0, 'horizontal dispersion function [m]'],
    ['ebm_etay', 'f', 0.0, 'vertical dispersion function [m]'],
    ['ebm_etaxp', 'f', 0.0, 'horizontal dispersion function derivative [rad]'],
    ['ebm_etayp', 'f', 0.0, 'vertical dispersion function derivative [rad]'],
    # Definition of the beam through Moments:
    ['ebm_sigx', 'f', 3.3331666625e-05, 'horizontal RMS size of electron beam [m]'],
    ['ebm_sigy', 'f', 2.91204395571e-06, 'vertical RMS size of electron beam [m]'],
    ['ebm_sigxp', 'f', 1.65008250619e-05, 'horizontal RMS angular divergence of electron beam [rad]'],
    ['ebm_sigyp', 'f', 2.74721127897e-06, 'vertical RMS angular divergence of electron beam [rad]'],
    ['ebm_mxxp', 'f', 0.0, 'horizontal position-angle mixed 2nd order moment of electron beam [m]'],
    ['ebm_myyp', 'f', 0.0, 'vertical position-angle mixed 2nd order moment of electron beam [m]'],

#---Undulator
    ['und_bx', 'f', 0.0, 'undulator horizontal peak magnetic field [T]'],
    ['und_by', 'f', 0.187782, 'undulator vertical peak magnetic field [T]'],
    ['und_phx', 'f', 0.0, 'initial phase of the horizontal magnetic field [rad]'],
    ['und_phy', 'f', 0.0, 'initial phase of the vertical magnetic field [rad]'],
    ['und_b2e', '', '', 'estimate undulator fundamental photon energy (in [eV]) for the amplitude of sinusoidal magnetic field defined by und_b or und_bx, und_by', 'store_true'],
    ['und_e2b', '', '', 'estimate undulator field amplitude (in [T]) for the photon energy defined by w_e', 'store_true'],
    ['und_per', 'f', 0.057, 'undulator period [m]'],
    ['und_len', 'f', 3.5055, 'undulator length [m]'],
    ['und_zc', 'f', 0.0, 'undulator center longitudinal position [m]'],
    ['und_sx', 'i', 1, 'undulator horizontal magnetic field symmetry vs longitudinal position'],
    ['und_sy', 'i', 1, 'undulator vertical magnetic field symmetry vs longitudinal position'],
    ['und_g', 'f', 6.72, 'undulator gap [mm] (assumes availability of magnetic measurement or simulation data)'],
    ['und_ph', 'f', 0.0, 'shift of magnet arrays [mm] for which the field should be set up'],
    ['und_mdir', 's', '', 'name of magnetic measurements sub-folder'],
    ['und_mfs', 's', '', 'name of magnetic measurements for different gaps summary file'],


#---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    ['tr_cti', 'f', 0.0, 'initial time moment (c*t) for electron trajectory calculation [m]'],
    ['tr_ctf', 'f', 0.0, 'final time moment (c*t) for electron trajectory calculation [m]'],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    ['tr_mag', 'i', 1, 'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'],
    ['tr_fn', 's', 'res_trj.dat', 'file name for saving calculated trajectory data'],
    ['tr_pl', 's', '', 'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'],

    #Single-Electron Spectrum vs Photon Energy
    ['ss', '', '', 'calculate single-e spectrum vs photon energy', 'store_true'],
    ['ss_ei', 'f', 100.0, 'initial photon energy [eV] for single-e spectrum vs photon energy calculation'],
    ['ss_ef', 'f', 20000.0, 'final photon energy [eV] for single-e spectrum vs photon energy calculation'],
    ['ss_ne', 'i', 10000, 'number of points vs photon energy for single-e spectrum vs photon energy calculation'],
    ['ss_x', 'f', 0.0, 'horizontal position [m] for single-e spectrum vs photon energy calculation'],
    ['ss_y', 'f', 0.0, 'vertical position [m] for single-e spectrum vs photon energy calculation'],
    ['ss_meth', 'i', 1, 'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'],
    ['ss_prec', 'f', 0.01, 'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'],
    ['ss_pol', 'i', 6, 'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['ss_mag', 'i', 1, 'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'],
    ['ss_ft', 's', 'f', 'presentation/domain: "f"- frequency (photon energy), "t"- time'],
    ['ss_u', 'i', 1, 'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'],
    ['ss_fn', 's', 'res_spec_se.dat', 'file name for saving calculated single-e spectrum vs photon energy'],
    ['ss_pl', 's', '', 'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    ['sm', '', '', 'calculate multi-e spectrum vs photon energy', 'store_true'],
    ['sm_ei', 'f', 100.0, 'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'],
    ['sm_ef', 'f', 20000.0, 'final photon energy [eV] for multi-e spectrum vs photon energy calculation'],
    ['sm_ne', 'i', 10000, 'number of points vs photon energy for multi-e spectrum vs photon energy calculation'],
    ['sm_x', 'f', 0.0, 'horizontal center position [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_rx', 'f', 0.001, 'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_nx', 'i', 1, 'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'],
    ['sm_y', 'f', 0.0, 'vertical center position [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_ry', 'f', 0.001, 'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_ny', 'i', 1, 'number of points vs vertical position for multi-e spectrum vs photon energy calculation'],
    ['sm_mag', 'i', 1, 'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'],
    ['sm_hi', 'i', 1, 'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'],
    ['sm_hf', 'i', 15, 'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'],
    ['sm_prl', 'f', 1.0, 'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'],
    ['sm_pra', 'f', 1.0, 'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'],
    ['sm_meth', 'i', -1, 'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'],
    ['sm_prec', 'f', 0.01, 'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'],
    ['sm_nm', 'i', 1, 'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'],
    ['sm_na', 'i', 5, 'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'],
    ['sm_ns', 'i', 5, 'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    ['sm_pol', 'i', 6, 'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['sm_rm', 'i', 1, 'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'],
    ['sm_fn', 's', 'res_spec_me.dat', 'file name for saving calculated milti-e spectrum vs photon energy'],
    ['sm_pl', 's', '', 'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    ['pw_x', 'f', 0.0, 'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_rx', 'f', 0.015, 'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_nx', 'i', 100, 'number of points vs horizontal position for calculation of power density distribution'],
    ['pw_y', 'f', 0.0, 'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_ry', 'f', 0.015, 'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_ny', 'i', 100, 'number of points vs vertical position for calculation of power density distribution'],
    ['pw_pr', 'f', 1.0, 'precision factor for calculation of power density distribution'],
    ['pw_meth', 'i', 1, 'power density computation method (1- "near field", 2- "far field")'],
    ['pw_zst', 'f', 0., 'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'],
    ['pw_zfi', 'f', 0., 'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'],
    ['pw_mag', 'i', 1, 'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'],
    ['pw_fn', 's', 'res_pow.dat', 'file name for saving calculated power density distribution'],
    ['pw_pl', 's', '', 'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    ['si', '', '', 'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position', 'store_true'],
    #Single-Electron Wavefront Propagation
    ['ws', '', '', 'calculate single-electron (/ fully coherent) wavefront propagation', 'store_true'],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    ['wm', '', '', 'calculate multi-electron (/ partially coherent) wavefront propagation', 'store_true'],

    ['w_e', 'f', 1000.0, 'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ef', 'f', -1.0, 'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ne', 'i', 1, 'number of points vs photon energy for calculation of intensity distribution'],
    ['w_x', 'f', 0.0, 'central horizontal position [m] for calculation of intensity distribution'],
    ['w_rx', 'f', 0.002, 'range of horizontal position [m] for calculation of intensity distribution'],
    ['w_nx', 'i', 100, 'number of points vs horizontal position for calculation of intensity distribution'],
    ['w_y', 'f', 0.0, 'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ry', 'f', 0.002, 'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ny', 'i', 100, 'number of points vs vertical position for calculation of intensity distribution'],
    ['w_smpf', 'f', 1.0, 'sampling factor for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_meth', 'i', 1, 'method to use for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_prec', 'f', 0.01, 'relative precision for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_u', 'i', 1, 'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'],
    ['si_pol', 'i', 6, 'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['si_type', 'i', 0, 'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'],
    ['w_mag', 'i', 1, 'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'],

    ['si_fn', 's', 'res_int_se.dat', 'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'],
    ['si_pl', 's', '', 'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],
    ['ws_fni', 's', 'res_int_pr_se.dat', 'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'],
    ['ws_pl', 's', '', 'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],

    ['wm_nm', 'i', 100000, 'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'],
    ['wm_na', 'i', 5, 'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'],
    ['wm_ns', 'i', 5, 'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'],
    ['wm_ch', 'i', 0, 'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y'],
    ['wm_ap', 'i', 0, 'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'],
    ['wm_x0', 'f', 0, 'horizontal center position for mutual intensity cut calculation'],
    ['wm_y0', 'f', 0, 'vertical center position for mutual intensity cut calculation'],
    ['wm_ei', 'i', 0, 'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'],
    ['wm_rm', 'i', 1, 'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'],
    ['wm_am', 'i', 0, 'multi-electron integration approximation method: 0- no approximation (use the standard 5D integration method), 1- integrate numerically only over e-beam energy spread and use convolution to treat transverse emittance'],
    ['wm_fni', 's', 'res_int_pr_me.dat', 'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'],

    #to add options
    ['op_r', 'f', 20.0, 'longitudinal position of the first optical element [m]'],

    # Former appParam:
    ['source_type', 's', 'u', 'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'],

#---Beamline optics:
    # M1: mirror
    ['op_M1_hfn', 's', 'mirror_1d.dat', 'heightProfileFile'],
    ['op_M1_dim', 's', 'x', 'orientation'],
    ['op_M1_ang', 'f', 0.0436332, 'grazingAngle'],
    ['op_M1_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_M1_size_x', 'f', 0.001, 'horizontalTransverseSize'],
    ['op_M1_size_y', 'f', 0.001, 'verticalTransverseSize'],

    # M1_Grating: drift
    ['op_M1_Grating_L', 'f', 20.634, 'length'],

    # Grating: grating
    ['op_Grating_size_tang', 'f', 0.2, 'tangentialSize'],
    ['op_Grating_size_sag', 'f', 0.015, 'sagittalSize'],
    ['op_Grating_nvx', 'f', 0.0, 'normalVectorX'],
    ['op_Grating_nvy', 'f', 0.99991607766, 'normalVectorY'],
    ['op_Grating_nvz', 'f', -0.0129552165771, 'normalVectorZ'],
    ['op_Grating_tvx', 'f', 0.0, 'tangentialVectorX'],
    ['op_Grating_tvy', 'f', 0.0129552165771, 'tangentialVectorY'],
    ['op_Grating_x', 'f', 0.0, 'horizontalOffset'],
    ['op_Grating_y', 'f', 0.0, 'verticalOffset'],
    ['op_Grating_m', 'f', 1.0, 'diffractionOrder'],
    ['op_Grating_grDen', 'f', 1800.0, 'grooveDensity0'],
    ['op_Grating_grDen1', 'f', 0.08997, 'grooveDensity1'],
    ['op_Grating_grDen2', 'f', 3.004e-06, 'grooveDensity2'],
    ['op_Grating_grDen3', 'f', 9.73e-11, 'grooveDensity3'],
    ['op_Grating_grDen4', 'f', 0.0, 'grooveDensity4'],

    # GA: aperture
    ['op_GA_shape', 's', 'r', 'shape'],
    ['op_GA_Dx', 'f', 0.015, 'horizontalSize'],
    ['op_GA_Dy', 'f', 0.00259104331543, 'verticalSize'],
    ['op_GA_x', 'f', 0.0, 'horizontalOffset'],
    ['op_GA_y', 'f', 0.0, 'verticalOffset'],

    # GA_M3A: drift
    ['op_GA_M3A_L', 'f', 34.63, 'length'],

    # M3A: aperture
    ['op_M3A_shape', 's', 'r', 'shape'],
    ['op_M3A_Dx', 'f', 0.01832012956, 'horizontalSize'],
    ['op_M3A_Dy', 'f', 0.02, 'verticalSize'],
    ['op_M3A_x', 'f', 0.0, 'horizontalOffset'],
    ['op_M3A_y', 'f', 0.0, 'verticalOffset'],

    # M3: ellipsoidMirror
    ['op_M3_hfn', 's', 'None', 'heightProfileFile'],
    ['op_M3_dim', 's', 'x', 'orientation'],
    ['op_M3_p', 'f', 89.63, 'firstFocusLength'],
    ['op_M3_q', 'f', 8.006, 'focalLength'],
    ['op_M3_ang', 'f', 0.0436332, 'grazingAngle'],
    ['op_M3_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_M3_size_tang', 'f', 0.42, 'tangentialSize'],
    ['op_M3_size_sag', 'f', 0.02, 'sagittalSize'],
    ['op_M3_nvx', 'f', 0.999048222947, 'normalVectorX'],
    ['op_M3_nvy', 'f', 0.0, 'normalVectorY'],
    ['op_M3_nvz', 'f', -0.0436193560953, 'normalVectorZ'],
    ['op_M3_tvx', 'f', -0.0436193560953, 'tangentialVectorX'],
    ['op_M3_tvy', 'f', 0.0, 'tangentialVectorY'],
    ['op_M3_x', 'f', 0.0, 'horizontalOffset'],
    ['op_M3_y', 'f', 0.0, 'verticalOffset'],

    # M3_SSA: drift
    ['op_M3_SSA_L', 'f', 8.006, 'length'],

    # SSA: aperture
    ['op_SSA_shape', 's', 'r', 'shape'],
    ['op_SSA_Dx', 'f', 0.0015, 'horizontalSize'],
    ['op_SSA_Dy', 'f', 0.0015, 'verticalSize'],
    ['op_SSA_x', 'f', 0.0, 'horizontalOffset'],
    ['op_SSA_y', 'f', 0.0, 'verticalOffset'],

    # SSA_KBAperture: drift
    ['op_SSA_KBAperture_L', 'f', 6.01, 'length'],

    # KBAperture: aperture
    ['op_KBAperture_shape', 's', 'r', 'shape'],
    ['op_KBAperture_Dx', 'f', 0.0130858068286, 'horizontalSize'],
    ['op_KBAperture_Dy', 'f', 0.003, 'verticalSize'],
    ['op_KBAperture_x', 'f', 0.0, 'horizontalOffset'],
    ['op_KBAperture_y', 'f', 0.0, 'verticalOffset'],

    # KBh: ellipsoidMirror
    ['op_KBh_hfn', 's', 'None', 'heightProfileFile'],
    ['op_KBh_dim', 's', 'x', 'orientation'],
    ['op_KBh_p', 'f', 6.01, 'firstFocusLength'],
    ['op_KBh_q', 'f', 0.911, 'focalLength'],
    ['op_KBh_ang', 'f', 0.0872665, 'grazingAngle'],
    ['op_KBh_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_KBh_size_tang', 'f', 0.3, 'tangentialSize'],
    ['op_KBh_size_sag', 'f', 0.05, 'sagittalSize'],
    ['op_KBh_nvx', 'f', 0.996194694832, 'normalVectorX'],
    ['op_KBh_nvy', 'f', 0.0, 'normalVectorY'],
    ['op_KBh_nvz', 'f', -0.0871557800056, 'normalVectorZ'],
    ['op_KBh_tvx', 'f', -0.0871557800056, 'tangentialVectorX'],
    ['op_KBh_tvy', 'f', 0.0, 'tangentialVectorY'],
    ['op_KBh_x', 'f', 0.0, 'horizontalOffset'],
    ['op_KBh_y', 'f', 0.0, 'verticalOffset'],

    # KBh_KBv: drift
    ['op_KBh_KBv_L', 'f', 0.5, 'length'],

    # KBv: ellipsoidMirror
    ['op_KBv_hfn', 's', 'None', 'heightProfileFile'],
    ['op_KBv_dim', 's', 'x', 'orientation'],
    ['op_KBv_p', 'f', 6.51, 'firstFocusLength'],
    ['op_KBv_q', 'f', 0.411, 'focalLength'],
    ['op_KBv_ang', 'f', 0.0872665, 'grazingAngle'],
    ['op_KBv_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_KBv_size_tang', 'f', 0.3, 'tangentialSize'],
    ['op_KBv_size_sag', 'f', 0.05, 'sagittalSize'],
    ['op_KBv_nvx', 'f', 0.0, 'normalVectorX'],
    ['op_KBv_nvy', 'f', 0.996194694832, 'normalVectorY'],
    ['op_KBv_nvz', 'f', -0.0871557800056, 'normalVectorZ'],
    ['op_KBv_tvx', 'f', 0.0, 'tangentialVectorX'],
    ['op_KBv_tvy', 'f', -0.0871557800056, 'tangentialVectorY'],
    ['op_KBv_x', 'f', 0.0, 'horizontalOffset'],
    ['op_KBv_y', 'f', 0.0, 'verticalOffset'],

    # KBv_Sample: drift
    ['op_KBv_Sample_L', 'f', 0.411, 'length'],

#---Propagation parameters
    ['op_M1_pp', 'f',             [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], 'M1'],
    ['op_M1_Grating_pp', 'f',     [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], 'M1_Grating'],
    ['op_Grating_pp', 'f',        [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], 'Grating'],
    ['op_GA_pp', 'f',             [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'],
    ['op_GA_M3A_pp', 'f',         [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], 'GA_M3A'],
    ['op_M3A_pp', 'f',            [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], 'M3A'],
    ['op_M3_pp', 'f',             [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'],
    ['op_M3_SSA_pp', 'f',         [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], 'M3_SSA'],
    ['op_SSA_pp', 'f',            [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], 'SSA'],
    ['op_SSA_KBAperture_pp', 'f', [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], 'SSA_KBAperture'],
    ['op_KBAperture_pp', 'f',     [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], 'KBAperture'],
    ['op_KBh_pp', 'f',            [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'],
    ['op_KBh_KBv_pp', 'f',        [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], 'KBh_KBv'],
    ['op_KBv_pp', 'f',            [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], 'KBv'],
    ['op_KBv_Sample_pp', 'f',     [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], 'KBv_Sample'],
    ['op_fin_pp', 'f',            [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], 'final post-propagation (resize) parameters'],

    #[ 0]: Auto-Resize (1) or not (0) Before propagation
    #[ 1]: Auto-Resize (1) or not (0) After propagation
    #[ 2]: Relative Precision for propagation with Auto-Resizing (1. is nominal)
    #[ 3]: Allow (1) or not (0) for semi-analytical treatment of the quadratic (leading) phase terms at the propagation
    #[ 4]: Do any Resizing on Fourier side, using FFT, (1) or not (0)
    #[ 5]: Horizontal Range modification factor at Resizing (1. means no modification)
    #[ 6]: Horizontal Resolution modification factor at Resizing
    #[ 7]: Vertical Range modification factor at Resizing
    #[ 8]: Vertical Resolution modification factor at Resizing
    #[ 9]: Type of wavefront Shift before Resizing (not yet implemented)
    #[10]: New Horizontal wavefront Center position after Shift (not yet implemented)
    #[11]: New Vertical wavefront Center position after Shift (not yet implemented)
    #[12]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Horizontal Coordinate
    #[13]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Vertical Coordinate
    #[14]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Longitudinal Coordinate
    #[15]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Horizontal Coordinate
    #[16]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Vertical Coordinate
])
Exemple #5
0
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'long trace', 'simulation name'],

    #---Data Folder
    [
        'fdir', 's', '',
        'folder (directory) name for reading-in input and saving output data files'
    ],
    ['gbm_x', 'f', 0.0, 'average horizontal coordinates of waist [m]'],
    ['gbm_y', 'f', 0.0, 'average vertical coordinates of waist [m]'],
    ['gbm_z', 'f', 0.0, 'average longitudinal coordinate of waist [m]'],
    ['gbm_xp', 'f', 0.0, 'average horizontal angle at waist [rad]'],
    ['gbm_yp', 'f', 0.0, 'average verical angle at waist [rad]'],
    ['gbm_ave', 'f', 9000.0, 'average photon energy [eV]'],
    ['gbm_pen', 'f', 0.001, 'energy per pulse [J]'],
    ['gbm_rep', 'f', 1, 'rep. rate [Hz]'],
    [
        'gbm_pol', 'f', 1,
        'polarization 1- lin. hor., 2- lin. vert., 3- lin. 45 deg., 4- lin.135 deg., 5- circ. right, 6- circ. left'
    ],
    [
        'gbm_sx', 'f', 3e-06,
        'rms beam size vs horizontal position [m] at waist (for intensity)'
    ],
    [
        'gbm_sy', 'f', 3e-06,
        'rms beam size vs vertical position [m] at waist (for intensity)'
    ],
    ['gbm_st', 'f', 1e-13, 'rms pulse duration [s] (for intensity)'],
    [
        'gbm_mx', 'f', 0,
        'transverse Gauss-Hermite mode order in horizontal direction'
    ],
    [
        'gbm_my', 'f', 0,
        'transverse Gauss-Hermite mode order in vertical direction'
    ],
    [
        'gbm_ca', 's', 'c',
        'treat _sigX, _sigY as sizes in [m] in coordinate representation (_presCA="c") or as angular divergences in [rad] in angular representation (_presCA="a")'
    ],
    [
        'gbm_ft', 's', 't',
        'treat _sigT as pulse duration in [s] in time domain/representation (_presFT="t") or as bandwidth in [eV] in frequency domain/representation (_presFT="f")'
    ],

    #---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    [
        'tr_cti', 'f', 0.0,
        'initial time moment (c*t) for electron trajectory calculation [m]'
    ],
    [
        'tr_ctf', 'f', 0.0,
        'final time moment (c*t) for electron trajectory calculation [m]'
    ],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    [
        'tr_mag', 'i', 1,
        'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'
    ],
    [
        'tr_fn', 's', 'res_trj.dat',
        'file name for saving calculated trajectory data'
    ],
    [
        'tr_pl', 's', '',
        'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'
    ],

    #Single-Electron Spectrum vs Photon Energy
    [
        'ss', '', '', 'calculate single-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'ss_ei', 'f', 100.0,
        'initial photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ef', 'f', 20000.0,
        'final photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ne', 'i', 10000,
        'number of points vs photon energy for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_x', 'f', 0.0,
        'horizontal position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_y', 'f', 0.0,
        'vertical position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_meth', 'i', 1,
        'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'ss_prec', 'f', 0.01,
        'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'
    ],
    [
        'ss_pol', 'i', 6,
        'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'ss_mag', 'i', 1,
        'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'
    ],
    [
        'ss_ft', 's', 'f',
        'presentation/domain: "f"- frequency (photon energy), "t"- time'
    ],
    [
        'ss_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'ss_fn', 's', 'res_spec_se.dat',
        'file name for saving calculated single-e spectrum vs photon energy'
    ],
    [
        'ss_pl', 's', '',
        'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    [
        'sm', '', '', 'calculate multi-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'sm_ei', 'f', 100.0,
        'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ef', 'f', 20000.0,
        'final photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ne', 'i', 10000,
        'number of points vs photon energy for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_x', 'f', 0.0,
        'horizontal center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_rx', 'f', 0.001,
        'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_nx', 'i', 1,
        'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_y', 'f', 0.0,
        'vertical center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ry', 'f', 0.001,
        'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ny', 'i', 1,
        'number of points vs vertical position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_mag', 'i', 1,
        'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'
    ],
    [
        'sm_hi', 'i', 1,
        'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_hf', 'i', 15,
        'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_prl', 'f', 1.0,
        'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_pra', 'f', 1.0,
        'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_meth', 'i', -1,
        'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'
    ],
    [
        'sm_prec', 'f', 0.01,
        'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'
    ],
    [
        'sm_nm', 'i', 1,
        'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_na', 'i', 5,
        'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'
    ],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    [
        'sm_pol', 'i', 6,
        'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'sm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'sm_fn', 's', 'res_spec_me.dat',
        'file name for saving calculated milti-e spectrum vs photon energy'
    ],
    [
        'sm_pl', 's', '',
        'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    [
        'pw_x', 'f', 0.0,
        'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_rx', 'f', 0.015,
        'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_nx', 'i', 100,
        'number of points vs horizontal position for calculation of power density distribution'
    ],
    [
        'pw_y', 'f', 0.0,
        'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ry', 'f', 0.015,
        'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ny', 'i', 100,
        'number of points vs vertical position for calculation of power density distribution'
    ],
    [
        'pw_pr', 'f', 1.0,
        'precision factor for calculation of power density distribution'
    ],
    [
        'pw_meth', 'i', 1,
        'power density computation method (1- "near field", 2- "far field")'
    ],
    [
        'pw_zst', 'f', 0.,
        'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_zfi', 'f', 0.,
        'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_mag', 'i', 1,
        'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'
    ],
    [
        'pw_fn', 's', 'res_pow.dat',
        'file name for saving calculated power density distribution'
    ],
    [
        'pw_pl', 's', '',
        'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    [
        'si', '', '',
        'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position',
        'store_true'
    ],
    #Single-Electron Wavefront Propagation
    [
        'ws', '', '',
        'calculate single-electron (/ fully coherent) wavefront propagation',
        'store_true'
    ],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    [
        'wm', '', '',
        'calculate multi-electron (/ partially coherent) wavefront propagation',
        'store_true'
    ],
    [
        'w_e', 'f', 9000.0,
        'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ef', 'f', -1.,
        'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ne', 'i', 1,
        'number of points vs photon energy for calculation of intensity distribution'
    ],
    [
        'w_x', 'f', 0.0,
        'central horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_rx', 'f', 0.002,
        'range of horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_nx', 'i', 2048,
        'number of points vs horizontal position for calculation of intensity distribution'
    ],
    [
        'w_y', 'f', 0.0,
        'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ry', 'f', 0.002,
        'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ny', 'i', 2048,
        'number of points vs vertical position for calculation of intensity distribution'
    ],
    [
        'w_smpf', 'f', 0,
        'sampling factor for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_meth', 'i', 2,
        'method to use for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_prec', 'f', 0.01,
        'relative precision for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'si_pol', 'i', 6,
        'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'si_type', 'i', 0,
        'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'
    ],
    [
        'w_mag', 'i', 1,
        'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'
    ],
    [
        'si_fn', 's', 'res_int_se.dat',
        'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'
    ],
    [
        'si_pl', 's', '',
        'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'ws_fni', 's', 'res_int_pr_se.dat',
        'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'
    ],
    [
        'ws_pl', 's', '',
        'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'wm_nm', 'i', 100000,
        'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_na', 'i', 5,
        'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'
    ],
    [
        'wm_ch', 'i', 0,
        'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y'
    ],
    [
        'wm_ap', 'i', 0,
        'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'
    ],
    [
        'wm_x0', 'f', 0,
        'horizontal center position for mutual intensity cut calculation'
    ],
    [
        'wm_y0', 'f', 0,
        'vertical center position for mutual intensity cut calculation'
    ],
    [
        'wm_ei', 'i', 0,
        'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'
    ],
    [
        'wm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'wm_fni', 's', 'res_int_pr_me.dat',
        'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'
    ],

    #to add options
    [
        'op_r', 'f', 500000.0,
        'longitudinal position of the first optical element [m]'
    ],

    # Former appParam:
    [
        'source_type', 's', 'g',
        'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'
    ],
])
Exemple #6
0
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'Sample from Image', 'simulation name'],

    #---Data Folder
    [
        'fdir', 's', '',
        'folder (directory) name for reading-in input and saving output data files'
    ],

    #---Electron Beam
    ['ebm_nm', 's', 'NSLS-II Low Beta Final', 'standard electron beam name'],
    [
        'ebm_nms', 's', '',
        'standard electron beam name suffix: e.g. can be Day1, Final'
    ],
    ['ebm_i', 'f', 0.5, 'electron beam current [A]'],
    ['ebm_e', 'f', 3.0, 'electron beam avarage energy [GeV]'],
    ['ebm_de', 'f', 0.0, 'electron beam average energy deviation [GeV]'],
    [
        'ebm_x', 'f', 0.0,
        'electron beam initial average horizontal position [m]'
    ],
    ['ebm_y', 'f', 0.0, 'electron beam initial average vertical position [m]'],
    [
        'ebm_xp', 'f', 0.,
        'electron beam initial average horizontal angle [rad]'
    ],
    ['ebm_yp', 'f', 0., 'electron beam initial average vertical angle [rad]'],
    [
        'ebm_z', 'f', 0.,
        'electron beam initial average longitudinal position [m]'
    ],
    [
        'ebm_dr', 'f', -1.54,
        'electron beam longitudinal drift [m] to be performed before a required calculation'
    ],
    ['ebm_ens', 'f', 0.00089, 'electron beam relative energy spread'],
    ['ebm_emx', 'f', 5.5e-10, 'electron beam horizontal emittance [m]'],
    ['ebm_emy', 'f', 8e-12, 'electron beam vertical emittance [m]'],
    # Definition of the beam through Twiss:
    ['ebm_betax', 'f', 2.02, 'horizontal beta-function [m]'],
    ['ebm_betay', 'f', 1.06, 'vertical beta-function [m]'],
    ['ebm_alphax', 'f', 0.0, 'horizontal alpha-function [rad]'],
    ['ebm_alphay', 'f', 0.0, 'vertical alpha-function [rad]'],
    ['ebm_etax', 'f', 0.0, 'horizontal dispersion function [m]'],
    ['ebm_etay', 'f', 0.0, 'vertical dispersion function [m]'],
    ['ebm_etaxp', 'f', 0.0, 'horizontal dispersion function derivative [rad]'],
    ['ebm_etayp', 'f', 0.0, 'vertical dispersion function derivative [rad]'],
    # Definition of the beam through Moments:
    [
        'ebm_sigx', 'f', 3.3331666625e-05,
        'horizontal RMS size of electron beam [m]'
    ],
    [
        'ebm_sigy', 'f', 2.91204395571e-06,
        'vertical RMS size of electron beam [m]'
    ],
    [
        'ebm_sigxp', 'f', 1.65008250619e-05,
        'horizontal RMS angular divergence of electron beam [rad]'
    ],
    [
        'ebm_sigyp', 'f', 2.74721127897e-06,
        'vertical RMS angular divergence of electron beam [rad]'
    ],
    [
        'ebm_mxxp', 'f', 0.0,
        'horizontal position-angle mixed 2nd order moment of electron beam [m]'
    ],
    [
        'ebm_myyp', 'f', 0.0,
        'vertical position-angle mixed 2nd order moment of electron beam [m]'
    ],

    #---Undulator
    ['und_bx', 'f', 0.0, 'undulator horizontal peak magnetic field [T]'],
    ['und_by', 'f', 0.88770981, 'undulator vertical peak magnetic field [T]'],
    [
        'und_phx', 'f', 0.0,
        'initial phase of the horizontal magnetic field [rad]'
    ],
    [
        'und_phy', 'f', 0.0,
        'initial phase of the vertical magnetic field [rad]'
    ],
    [
        'und_b2e', '', '',
        'estimate undulator fundamental photon energy (in [eV]) for the amplitude of sinusoidal magnetic field defined by und_b or und_bx, und_by',
        'store_true'
    ],
    [
        'und_e2b', '', '',
        'estimate undulator field amplitude (in [T]) for the photon energy defined by w_e',
        'store_true'
    ],
    ['und_per', 'f', 0.02, 'undulator period [m]'],
    ['und_len', 'f', 3.0, 'undulator length [m]'],
    ['und_zc', 'f', 0.0, 'undulator center longitudinal position [m]'],
    [
        'und_sx', 'i', 1,
        'undulator horizontal magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_sy', 'i', -1,
        'undulator vertical magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_g', 'f', 6.72,
        'undulator gap [mm] (assumes availability of magnetic measurement or simulation data)'
    ],
    [
        'und_ph', 'f', 0.0,
        'shift of magnet arrays [mm] for which the field should be set up'
    ],
    ['und_mdir', 's', '', 'name of magnetic measurements sub-folder'],
    [
        'und_mfs', 's', '',
        'name of magnetic measurements for different gaps summary file'
    ],

    #---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    [
        'tr_cti', 'f', 0.0,
        'initial time moment (c*t) for electron trajectory calculation [m]'
    ],
    [
        'tr_ctf', 'f', 0.0,
        'final time moment (c*t) for electron trajectory calculation [m]'
    ],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    [
        'tr_mag', 'i', 1,
        'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'
    ],
    [
        'tr_fn', 's', 'res_trj.dat',
        'file name for saving calculated trajectory data'
    ],
    [
        'tr_pl', 's', '',
        'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'
    ],

    #Single-Electron Spectrum vs Photon Energy
    [
        'ss', '', '', 'calculate single-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'ss_ei', 'f', 100.0,
        'initial photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ef', 'f', 20000.0,
        'final photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ne', 'i', 10000,
        'number of points vs photon energy for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_x', 'f', 0.0,
        'horizontal position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_y', 'f', 0.0,
        'vertical position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_meth', 'i', 1,
        'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'ss_prec', 'f', 0.01,
        'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'
    ],
    [
        'ss_pol', 'i', 6,
        'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'ss_mag', 'i', 1,
        'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'
    ],
    [
        'ss_ft', 's', 'f',
        'presentation/domain: "f"- frequency (photon energy), "t"- time'
    ],
    [
        'ss_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'ss_fn', 's', 'res_spec_se.dat',
        'file name for saving calculated single-e spectrum vs photon energy'
    ],
    [
        'ss_pl', 's', '',
        'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    [
        'sm', '', '', 'calculate multi-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'sm_ei', 'f', 100.0,
        'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ef', 'f', 20000.0,
        'final photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ne', 'i', 10000,
        'number of points vs photon energy for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_x', 'f', 0.0,
        'horizontal center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_rx', 'f', 0.001,
        'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_nx', 'i', 1,
        'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_y', 'f', 0.0,
        'vertical center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ry', 'f', 0.001,
        'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ny', 'i', 1,
        'number of points vs vertical position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_mag', 'i', 1,
        'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'
    ],
    [
        'sm_hi', 'i', 1,
        'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_hf', 'i', 15,
        'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_prl', 'f', 1.0,
        'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_pra', 'f', 1.0,
        'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_meth', 'i', -1,
        'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'
    ],
    [
        'sm_prec', 'f', 0.01,
        'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'
    ],
    [
        'sm_nm', 'i', 1,
        'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_na', 'i', 5,
        'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'
    ],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    [
        'sm_pol', 'i', 6,
        'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'sm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'sm_fn', 's', 'res_spec_me.dat',
        'file name for saving calculated milti-e spectrum vs photon energy'
    ],
    [
        'sm_pl', 's', '',
        'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    [
        'pw_x', 'f', 0.0,
        'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_rx', 'f', 0.015,
        'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_nx', 'i', 100,
        'number of points vs horizontal position for calculation of power density distribution'
    ],
    [
        'pw_y', 'f', 0.0,
        'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ry', 'f', 0.015,
        'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ny', 'i', 100,
        'number of points vs vertical position for calculation of power density distribution'
    ],
    [
        'pw_pr', 'f', 1.0,
        'precision factor for calculation of power density distribution'
    ],
    [
        'pw_meth', 'i', 1,
        'power density computation method (1- "near field", 2- "far field")'
    ],
    [
        'pw_zst', 'f', 0.,
        'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_zfi', 'f', 0.,
        'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_mag', 'i', 1,
        'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'
    ],
    [
        'pw_fn', 's', 'res_pow.dat',
        'file name for saving calculated power density distribution'
    ],
    [
        'pw_pl', 's', '',
        'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    [
        'si', '', '',
        'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position',
        'store_true'
    ],
    #Single-Electron Wavefront Propagation
    [
        'ws', '', '',
        'calculate single-electron (/ fully coherent) wavefront propagation',
        'store_true'
    ],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    [
        'wm', '', '',
        'calculate multi-electron (/ partially coherent) wavefront propagation',
        'store_true'
    ],
    [
        'w_e', 'f', 9000.0,
        'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ef', 'f', -1.,
        'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ne', 'i', 1,
        'number of points vs photon energy for calculation of intensity distribution'
    ],
    [
        'w_x', 'f', 0.0,
        'central horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_rx', 'f', 0.0005,
        'range of horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_nx', 'i', 100,
        'number of points vs horizontal position for calculation of intensity distribution'
    ],
    [
        'w_y', 'f', 0.0,
        'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ry', 'f', 0.0005,
        'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ny', 'i', 100,
        'number of points vs vertical position for calculation of intensity distribution'
    ],
    [
        'w_smpf', 'f', 1.0,
        'sampling factor for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_meth', 'i', 1,
        'method to use for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_prec', 'f', 0.01,
        'relative precision for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'si_pol', 'i', 6,
        'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'si_type', 'i', 0,
        'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'
    ],
    [
        'w_mag', 'i', 1,
        'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'
    ],
    [
        'si_fn', 's', 'res_int_se.dat',
        'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'
    ],
    [
        'si_pl', 's', '',
        'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'ws_fni', 's', 'res_int_pr_se.dat',
        'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'
    ],
    [
        'ws_pl', 's', '',
        'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'wm_nm', 'i', 100000,
        'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_na', 'i', 5,
        'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'
    ],
    [
        'wm_ch', 'i', 0,
        'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y'
    ],
    [
        'wm_ap', 'i', 0,
        'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'
    ],
    [
        'wm_x0', 'f', 0,
        'horizontal center position for mutual intensity cut calculation'
    ],
    [
        'wm_y0', 'f', 0,
        'vertical center position for mutual intensity cut calculation'
    ],
    [
        'wm_ei', 'i', 0,
        'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'
    ],
    [
        'wm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'wm_fni', 's', 'res_int_pr_me.dat',
        'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'
    ],

    # Beamline optics:
    ['op_sample1', 's', 'sample.tif', 'input file of the sample #1'],

    #to add options
    [
        'op_r', 'f', 20.0,
        'longitudinal position of the first optical element [m]'
    ],

    # Former appParam:
    [
        'source_type', 's', 'u',
        'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'
    ],
])
def get_reset_varParam():
    """ Code from Sirepo's SRW code, adapted to a function to give each process their own copy of the default parameters to run """
    varParam = srwl_bl.srwl_uti_ext_options([
        ['name', 's', 'RIXS-ARI 250eV 02 2', 'simulation name'],

        #---Data Folder
        [
            'fdir', 's', '',
            'folder (directory) name for reading-in input and saving output data files'
        ],

        #---Electron Beam
        ['ebm_nm', 's', '', 'standard electron beam name'],
        [
            'ebm_nms', 's', '',
            'standard electron beam name suffix: e.g. can be Day1, Final'
        ],
        ['ebm_i', 'f', 0.5, 'electron beam current [A]'],
        ['ebm_e', 'f', 3.0, 'electron beam avarage energy [GeV]'],
        ['ebm_de', 'f', 0.0, 'electron beam average energy deviation [GeV]'],
        [
            'ebm_x', 'f', 0.0,
            'electron beam initial average horizontal position [m]'
        ],
        [
            'ebm_y', 'f', 0.0,
            'electron beam initial average vertical position [m]'
        ],
        [
            'ebm_xp', 'f', 0.0,
            'electron beam initial average horizontal angle [rad]'
        ],
        [
            'ebm_yp', 'f', 0.0,
            'electron beam initial average vertical angle [rad]'
        ],
        [
            'ebm_z', 'f', 0.,
            'electron beam initial average longitudinal position [m]'
        ],
        [
            'ebm_dr', 'f', -0.001,
            'electron beam longitudinal drift [m] to be performed before a required calculation'
        ],
        ['ebm_ens', 'f', 0.00089, 'electron beam relative energy spread'],
        ['ebm_emx', 'f', 7.6e-10, 'electron beam horizontal emittance [m]'],
        ['ebm_emy', 'f', 8e-12, 'electron beam vertical emittance [m]'],
        # Definition of the beam through Twiss:
        ['ebm_betax', 'f', 1.84, 'horizontal beta-function [m]'],
        ['ebm_betay', 'f', 1.17, 'vertical beta-function [m]'],
        ['ebm_alphax', 'f', 0.0, 'horizontal alpha-function [rad]'],
        ['ebm_alphay', 'f', 0.0, 'vertical alpha-function [rad]'],
        ['ebm_etax', 'f', 0.0, 'horizontal dispersion function [m]'],
        ['ebm_etay', 'f', 0.0, 'vertical dispersion function [m]'],
        [
            'ebm_etaxp', 'f', 0.0,
            'horizontal dispersion function derivative [rad]'
        ],
        [
            'ebm_etayp', 'f', 0.0,
            'vertical dispersion function derivative [rad]'
        ],

        #---Undulator
        ['und_bx', 'f', 0.0, 'undulator horizontal peak magnetic field [T]'],
        ['und_by', 'f', 0.425, 'undulator vertical peak magnetic field [T]'],
        [
            'und_phx', 'f', 0.0,
            'initial phase of the horizontal magnetic field [rad]'
        ],
        [
            'und_phy', 'f', 0.0,
            'initial phase of the vertical magnetic field [rad]'
        ],
        [
            'und_b2e', '', '',
            'estimate undulator fundamental photon energy (in [eV]) for the amplitude of sinusoidal magnetic field defined by und_b or und_bx, und_by',
            'store_true'
        ],
        [
            'und_e2b', '', '',
            'estimate undulator field amplitude (in [T]) for the photon energy defined by w_e',
            'store_true'
        ],
        ['und_per', 'f', 0.07, 'undulator period [m]'],
        ['und_len', 'f', 2.0, 'undulator length [m]'],
        ['und_zc', 'f', -1.25, 'undulator center longitudinal position [m]'],
        [
            'und_sx', 'i', -1,
            'undulator horizontal magnetic field symmetry vs longitudinal position'
        ],
        [
            'und_sy', 'i', 1,
            'undulator vertical magnetic field symmetry vs longitudinal position'
        ],
        [
            'und_g', 'f', 6.72,
            'undulator gap [mm] (assumes availability of magnetic measurement or simulation data)'
        ],
        [
            'und_ph', 'f', 0.0,
            'shift of magnet arrays [mm] for which the field should be set up'
        ],
        ['und_mdir', 's', '', 'name of magnetic measurements sub-folder'],
        [
            'und_mfs', 's', '',
            'name of magnetic measurements for different gaps summary file'
        ],

        #---Calculation Types
        # Electron Trajectory
        ['tr', '', '', 'calculate electron trajectory', 'store_true'],
        [
            'tr_cti', 'f', 0.0,
            'initial time moment (c*t) for electron trajectory calculation [m]'
        ],
        [
            'tr_ctf', 'f', 0.0,
            'final time moment (c*t) for electron trajectory calculation [m]'
        ],
        ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
        [
            'tr_mag', 'i', 1,
            'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'
        ],
        [
            'tr_fn', 's', 'res_trj.dat',
            'file name for saving calculated trajectory data'
        ],
        [
            'tr_pl', 's', '',
            'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'
        ],

        #Single-Electron Spectrum vs Photon Energy
        [
            'ss', '', '', 'calculate single-e spectrum vs photon energy',
            'store_true'
        ],
        [
            'ss_ei', 'f', 10.0,
            'initial photon energy [eV] for single-e spectrum vs photon energy calculation'
        ],
        [
            'ss_ef', 'f', 2100.0,
            'final photon energy [eV] for single-e spectrum vs photon energy calculation'
        ],
        [
            'ss_ne', 'i', 2000,
            'number of points vs photon energy for single-e spectrum vs photon energy calculation'
        ],
        [
            'ss_x', 'f', 0.0,
            'horizontal position [m] for single-e spectrum vs photon energy calculation'
        ],
        [
            'ss_y', 'f', 0.0,
            'vertical position [m] for single-e spectrum vs photon energy calculation'
        ],
        [
            'ss_meth', 'i', 1,
            'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
        ],
        [
            'ss_prec', 'f', 0.01,
            'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'
        ],
        [
            'ss_pol', 'i', 6,
            'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
        ],
        [
            'ss_mag', 'i', 1,
            'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'
        ],
        [
            'ss_ft', 's', 'f',
            'presentation/domain: "f"- frequency (photon energy), "t"- time'
        ],
        [
            'ss_u', 'i', 1,
            'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
        ],
        [
            'ss_fn', 's', 'res_spec_se.dat',
            'file name for saving calculated single-e spectrum vs photon energy'
        ],
        [
            'ss_pl', 's', '',
            'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
        ],

        #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
        [
            'sm', '', '', 'calculate multi-e spectrum vs photon energy',
            'store_true'
        ],
        [
            'sm_ei', 'f', 10.0,
            'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'
        ],
        [
            'sm_ef', 'f', 1000.0,
            'final photon energy [eV] for multi-e spectrum vs photon energy calculation'
        ],
        [
            'sm_ne', 'i', 5000,
            'number of points vs photon energy for multi-e spectrum vs photon energy calculation'
        ],
        [
            'sm_x', 'f', 0.0,
            'horizontal center position [m] for multi-e spectrum vs photon energy calculation'
        ],
        [
            'sm_rx', 'f', 0.008,
            'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'
        ],
        [
            'sm_nx', 'i', 1,
            'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'
        ],
        [
            'sm_y', 'f', 0.0,
            'vertical center position [m] for multi-e spectrum vs photon energy calculation'
        ],
        [
            'sm_ry', 'f', 0.008,
            'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'
        ],
        [
            'sm_ny', 'i', 1,
            'number of points vs vertical position for multi-e spectrum vs photon energy calculation'
        ],
        [
            'sm_mag', 'i', 1,
            'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'
        ],
        [
            'sm_hi', 'i', 1,
            'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
        ],
        [
            'sm_hf', 'i', 15,
            'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
        ],
        [
            'sm_prl', 'f', 1.0,
            'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'
        ],
        [
            'sm_pra', 'f', 1.0,
            'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'
        ],
        [
            'sm_meth', 'i', -1,
            'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'
        ],
        [
            'sm_prec', 'f', 0.01,
            'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'
        ],
        [
            'sm_nm', 'i', 1,
            'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'
        ],
        [
            'sm_na', 'i', 5,
            'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'
        ],
        [
            'sm_ns', 'i', 5,
            'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'
        ],
        [
            'sm_type', 'i', 1,
            'calculate flux (=1) or flux per unit surface (=2)'
        ],
        [
            'sm_pol', 'i', 6,
            'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
        ],
        [
            'sm_rm', 'i', 1,
            'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
        ],
        [
            'sm_fn', 's', 'res_spec_me.dat',
            'file name for saving calculated milti-e spectrum vs photon energy'
        ],
        [
            'sm_pl', 's', '',
            'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
        ],
        #to add options for the multi-e calculation from "accurate" magnetic field

        #Power Density Distribution vs horizontal and vertical position
        [
            'pw', '', '', 'calculate SR power density distribution',
            'store_true'
        ],
        [
            'pw_x', 'f', 0.0,
            'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
        ],
        [
            'pw_rx', 'f', 0.05,
            'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
        ],
        [
            'pw_nx', 'i', 100,
            'number of points vs horizontal position for calculation of power density distribution'
        ],
        [
            'pw_y', 'f', 0.0,
            'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
        ],
        [
            'pw_ry', 'f', 0.05,
            'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
        ],
        [
            'pw_ny', 'i', 100,
            'number of points vs vertical position for calculation of power density distribution'
        ],
        [
            'pw_pr', 'f', 1.0,
            'precision factor for calculation of power density distribution'
        ],
        [
            'pw_meth', 'i', 1,
            'power density computation method (1- "near field", 2- "far field")'
        ],
        [
            'pw_zst', 'f', 0.,
            'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
        ],
        [
            'pw_zfi', 'f', 0.,
            'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
        ],
        [
            'pw_mag', 'i', 1,
            'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'
        ],
        [
            'pw_fn', 's', 'res_pow.dat',
            'file name for saving calculated power density distribution'
        ],
        [
            'pw_pl', 's', '',
            'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
        ],

        #Single-Electron Intensity distribution vs horizontal and vertical position
        [
            'si', '', '',
            'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position',
            'store_true'
        ],
        #Single-Electron Wavefront Propagation
        [
            'ws', '', '',
            'calculate single-electron (/ fully coherent) wavefront propagation',
            'store_true'
        ],
        #Multi-Electron (partially-coherent) Wavefront Propagation
        [
            'wm', '', '',
            'calculate multi-electron (/ partially coherent) wavefront propagation',
            'store_true'
        ],
        [
            'w_e', 'f', 250.0,
            'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
        ],
        [
            'w_ef', 'f', -1.0,
            'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
        ],
        [
            'w_ne', 'i', 1,
            'number of points vs photon energy for calculation of intensity distribution'
        ],
        [
            'w_x', 'f', 0.0,
            'central horizontal position [m] for calculation of intensity distribution'
        ],
        [
            'w_rx', 'f', 0.006,
            'range of horizontal position [m] for calculation of intensity distribution'
        ],
        [
            'w_nx', 'i', 100,
            'number of points vs horizontal position for calculation of intensity distribution'
        ],
        [
            'w_y', 'f', 0.0,
            'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
        ],
        [
            'w_ry', 'f', 0.006,
            'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
        ],
        [
            'w_ny', 'i', 100,
            'number of points vs vertical position for calculation of intensity distribution'
        ],
        [
            'w_smpf', 'f', 0.3,
            'sampling factor for calculation of intensity distribution vs horizontal and vertical position'
        ],
        [
            'w_meth', 'i', 1,
            'method to use for calculation of intensity distribution vs horizontal and vertical position: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
        ],
        [
            'w_prec', 'f', 0.01,
            'relative precision for calculation of intensity distribution vs horizontal and vertical position'
        ],
        [
            'w_u', 'i', 1,
            'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
        ],
        [
            'si_pol', 'i', 6,
            'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
        ],
        [
            'si_type', 'i', 0,
            'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'
        ],
        [
            'w_mag', 'i', 1,
            'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'
        ],
        [
            'si_fn', 's', 'res_int_se.dat',
            'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'
        ],
        [
            'si_pl', 's', '',
            'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
        ],
        [
            'ws_fni', 's', 'res_int_pr_se.dat',
            'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'
        ],
        [
            'ws_pl', 's', '',
            'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
        ],
        [
            'wm_nm', 'i', 100000,
            'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'
        ],
        [
            'wm_na', 'i', 5,
            'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'
        ],
        [
            'wm_ns', 'i', 5,
            'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'
        ],
        [
            'wm_ch', 'i', 0,
            'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y; 40- intensity(s0), mutual intensity cuts and degree of coherence vs X & Y'
        ],
        [
            'wm_ap', 'i', 0,
            'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'
        ],
        [
            'wm_x0', 'f', 0.0,
            'horizontal center position for mutual intensity cut calculation'
        ],
        [
            'wm_y0', 'f', 0.0,
            'vertical center position for mutual intensity cut calculation'
        ],
        [
            'wm_ei', 'i', 0,
            'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'
        ],
        [
            'wm_rm', 'i', 1,
            'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
        ],
        [
            'wm_am', 'i', 0,
            'multi-electron integration approximation method: 0- no approximation (use the standard 5D integration method), 1- integrate numerically only over e-beam energy spread and use convolution to treat transverse emittance'
        ],
        [
            'wm_fni', 's', 'res_int_pr_me.dat',
            'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'
        ],
        [
            'wm_fbk', '', '',
            'create backup file(s) with propagated multi-e intensity distribution vs horizontal and vertical position and other radiation characteristics',
            'store_true'
        ],

        #to add options
        [
            'op_r', 'f', 18.75,
            'longitudinal position of the first optical element [m]'
        ],
        # Former appParam:
        [
            'rs_type', 's', 'u',
            'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'
        ],

        #---Beamline optics:
        # Fixed_Mask: aperture
        ['op_Fixed_Mask_shape', 's', 'r', 'shape'],
        ['op_Fixed_Mask_Dx', 'f', 0.006, 'horizontalSize'],
        ['op_Fixed_Mask_Dy', 'f', 0.006, 'verticalSize'],
        ['op_Fixed_Mask_x', 'f', 0.0, 'horizontalOffset'],
        ['op_Fixed_Mask_y', 'f', 0.0, 'verticalOffset'],

        # Fixed_Mask_Ap_M1: drift
        ['op_Fixed_Mask_Ap_M1_L', 'f', 8.5, 'length'],

        # Ap_M1: aperture
        ['op_Ap_M1_shape', 's', 'r', 'shape'],
        ['op_Ap_M1_Dx', 'f', 0.0088, 'horizontalSize'],
        ['op_Ap_M1_Dy', 'f', 0.01, 'verticalSize'],
        ['op_Ap_M1_x', 'f', 0.0, 'horizontalOffset'],
        ['op_Ap_M1_y', 'f', 0.0, 'verticalOffset'],

        # M1: ellipsoidMirror
        [
            'op_M1_hfn', 's', 'OlegM1_200tan2000sagFractBeta3.txt',
            'heightProfileFile'
        ],
        ['op_M1_dim', 's', 'x', 'orientation'],
        ['op_M1_p', 'f', 28.5, 'firstFocusLength'],
        ['op_M1_q', 'f', 9.0, 'focalLength'],
        ['op_M1_ang', 'f', 0.03490658503988659, 'grazingAngle'],
        ['op_M1_amp_coef', 'f', 1.0, 'heightAmplification'],
        ['op_M1_size_tang', 'f', 0.25, 'tangentialSize'],
        ['op_M1_size_sag', 'f', 0.01, 'sagittalSize'],
        ['op_M1_nvx', 'f', 0.9993908270190958, 'normalVectorX'],
        ['op_M1_nvy', 'f', 0.0, 'normalVectorY'],
        ['op_M1_nvz', 'f', -0.03489949670250097, 'normalVectorZ'],
        ['op_M1_tvx', 'f', 0.03489949670250097, 'tangentialVectorX'],
        ['op_M1_tvy', 'f', 0.0, 'tangentialVectorY'],
        ['op_M1_x', 'f', 0.0, 'horizontalOffset'],
        ['op_M1_y', 'f', 0.0, 'verticalOffset'],

        # M1_M2: drift
        ['op_M1_M2_L', 'f', 2.1000000000000014, 'length'],

        # M2: mirror
        [
            'op_M2_hfn', 's', 'OlegM2_200tan500sagFractBeta3.txt',
            'heightProfileFile'
        ],
        ['op_M2_dim', 's', 'y', 'orientation'],
        ['op_M2_ang', 'f', 0.0440043, 'grazingAngle'],
        ['op_M2_amp_coef', 'f', 1.0, 'heightAmplification'],
        ['op_M2_size_x', 'f', 0.4, 'horizontalTransverseSize'],
        ['op_M2_size_y', 'f', 0.012, 'verticalTransverseSize'],

        # M2_Before_Grating: drift
        ['op_M2_Before_Grating_L', 'f', 0.3999999999999986, 'length'],

        # After_Grating_Before_H_Slit: drift
        ['op_After_Grating_Before_H_Slit_L', 'f', 6.5, 'length'],

        # H_Slit: aperture
        ['op_H_Slit_shape', 's', 'r', 'shape'],
        ['op_H_Slit_Dx', 'f', 5e-05, 'horizontalSize'],
        ['op_H_Slit_Dy', 'f', 0.02, 'verticalSize'],
        ['op_H_Slit_x', 'f', 0.0, 'horizontalOffset'],
        ['op_H_Slit_y', 'f', 0.0, 'verticalOffset'],

        # H_Slit_Aux_1: drift
        ['op_H_Slit_Aux_1_L', 'f', 0.25, 'length'],

        # Aux_1_Before_V_Slit: drift
        ['op_Aux_1_Before_V_Slit_L', 'f', 4.75, 'length'],

        # V_Slit: aperture
        ['op_V_Slit_shape', 's', 'r', 'shape'],
        ['op_V_Slit_Dx', 'f', 0.01, 'horizontalSize'],
        ['op_V_Slit_Dy', 'f', 2e-05, 'verticalSize'],
        ['op_V_Slit_x', 'f', 0.0, 'horizontalOffset'],
        ['op_V_Slit_y', 'f', 0.0, 'verticalOffset'],

        # V_Slit_Aux_2: drift
        ['op_V_Slit_Aux_2_L', 'f', 0.10000000000000142, 'length'],

        # Aux_2_Before_KBV: drift
        ['op_Aux_2_Before_KBV_L', 'f', 27.984, 'length'],

        # KBV: ellipsoidMirror
        [
            'op_KBV_hfn', 's', 'OlegKBVrixs_200tan500sagFractBeta3.txt',
            'heightProfileFile'
        ],
        ['op_KBV_dim', 's', 'y', 'orientation'],
        ['op_KBV_p', 'f', 28.084, 'firstFocusLength'],
        ['op_KBV_q', 'f', 0.416, 'focalLength'],
        ['op_KBV_ang', 'f', 0.043633229999999995, 'grazingAngle'],
        ['op_KBV_amp_coef', 'f', 1.0, 'heightAmplification'],
        ['op_KBV_size_tang', 'f', 0.377, 'tangentialSize'],
        ['op_KBV_size_sag', 'f', 0.03, 'sagittalSize'],
        ['op_KBV_nvx', 'f', 0.0, 'normalVectorX'],
        ['op_KBV_nvy', 'f', 0.9990482216385568, 'normalVectorY'],
        ['op_KBV_nvz', 'f', -0.043619386066714935, 'normalVectorZ'],
        ['op_KBV_tvx', 'f', 0.0, 'tangentialVectorX'],
        ['op_KBV_tvy', 'f', 0.043619386066714935, 'tangentialVectorY'],
        ['op_KBV_x', 'f', 0.0, 'horizontalOffset'],
        ['op_KBV_y', 'f', 0.0, 'verticalOffset'],

        # KBV_KBH: drift
        ['op_KBV_KBH_L', 'f', 0.29399999999999693, 'length'],

        # KBH: ellipsoidMirror
        [
            'op_KBH_hfn', 's', 'OlegKBHrixs_600tan1000sagFractBeta3.txt',
            'heightProfileFile'
        ],
        ['op_KBH_dim', 's', 'x', 'orientation'],
        ['op_KBH_p', 'f', 33.378, 'firstFocusLength'],
        ['op_KBH_q', 'f', 0.122, 'focalLength'],
        ['op_KBH_ang', 'f', 0.043633229999999995, 'grazingAngle'],
        ['op_KBH_amp_coef', 'f', 1.0, 'heightAmplification'],
        ['op_KBH_size_tang', 'f', 0.171, 'tangentialSize'],
        ['op_KBH_size_sag', 'f', 0.02, 'sagittalSize'],
        ['op_KBH_nvx', 'f', 0.9990482216385568, 'normalVectorX'],
        ['op_KBH_nvy', 'f', 0.0, 'normalVectorY'],
        ['op_KBH_nvz', 'f', -0.043619386066714935, 'normalVectorZ'],
        ['op_KBH_tvx', 'f', 0.043619386066714935, 'tangentialVectorX'],
        ['op_KBH_tvy', 'f', 0.0, 'tangentialVectorY'],
        ['op_KBH_x', 'f', 0.0, 'horizontalOffset'],
        ['op_KBH_y', 'f', 0.0, 'verticalOffset'],

        # After_KBH_Sample: drift
        ['op_After_KBH_Sample_L', 'f', 0.12199999999999989, 'length'],

        #---Propagation parameters
        [
            'op_Fixed_Mask_pp', 'f',
            [
                0, 0, 1.0, 0, 0, 1.2, 8.0, 2.5, 8.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                0.0, 0.0, 0.0
            ], 'Fixed_Mask'
        ],
        [
            'op_Fixed_Mask_Ap_M1_pp', 'f',
            [
                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
            ], 'Fixed_Mask_Ap_M1'
        ],
        [
            'op_Ap_M1_pp', 'f',
            [
                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
            ], 'Ap_M1'
        ],
        [
            'op_M1_pp', 'f',
            [
                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
            ], 'M1'
        ],
        [
            'op_M1_M2_pp', 'f',
            [
                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
            ], 'M1_M2'
        ],
        [
            'op_M2_pp', 'f',
            [
                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
            ], 'M2'
        ],
        [
            'op_M2_Before_Grating_pp', 'f',
            [
                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
            ], 'M2_Before_Grating'
        ],
        [
            'op_After_Grating_Before_H_Slit_pp', 'f',
            [
                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
            ], 'After_Grating_Before_H_Slit'
        ],
        [
            'op_H_Slit_pp', 'f',
            [
                0, 0, 1.0, 0, 0, 0.3, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                0.0, 0.0, 0.0
            ], 'H_Slit'
        ],
        [
            'op_H_Slit_Aux_1_pp', 'f',
            [
                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
            ], 'H_Slit_Aux_1'
        ],
        [
            'op_Aux_1_Before_V_Slit_pp', 'f',
            [
                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
            ], 'Aux_1_Before_V_Slit'
        ],
        [
            'op_V_Slit_pp', 'f',
            [
                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
            ], 'V_Slit'
        ],
        [
            'op_V_Slit_Aux_2_pp', 'f',
            [
                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
            ], 'V_Slit_Aux_2'
        ],
        [
            'op_Aux_2_Before_KBV_pp', 'f',
            [
                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
            ], 'Aux_2_Before_KBV'
        ],
        [
            'op_KBV_pp', 'f',
            [
                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
            ], 'KBV'
        ],
        [
            'op_KBV_KBH_pp', 'f',
            [
                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
            ], 'KBV_KBH'
        ],
        [
            'op_KBH_pp', 'f',
            [
                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'
        ],
        [
            'op_After_KBH_Sample_pp', 'f',
            [
                0, 0, 1.0, 4, 0, 0.5, 1.0, 0.5, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                0.0, 0.0, 0.0
            ], 'After_KBH_Sample'
        ],
        [
            'op_fin_pp', 'f',
            [
                0, 0, 1.0, 0, 0, 1.0, 1.0, 0.2, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                0.0, 0.0, 0.0
            ], 'final post-propagation (resize) parameters'
        ],

        #[ 0]: Auto-Resize (1) or not (0) Before propagation
        #[ 1]: Auto-Resize (1) or not (0) After propagation
        #[ 2]: Relative Precision for propagation with Auto-Resizing (1. is nominal)
        #[ 3]: Allow (1) or not (0) for semi-analytical treatment of the quadratic (leading) phase terms at the propagation
        #[ 4]: Do any Resizing on Fourier side, using FFT, (1) or not (0)
        #[ 5]: Horizontal Range modification factor at Resizing (1. means no modification)
        #[ 6]: Horizontal Resolution modification factor at Resizing
        #[ 7]: Vertical Range modification factor at Resizing
        #[ 8]: Vertical Resolution modification factor at Resizing
        #[ 9]: Type of wavefront Shift before Resizing (not yet implemented)
        #[10]: New Horizontal wavefront Center position after Shift (not yet implemented)
        #[11]: New Vertical wavefront Center position after Shift (not yet implemented)
        #[12]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Horizontal Coordinate
        #[13]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Vertical Coordinate
        #[14]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Longitudinal Coordinate
        #[15]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Horizontal Coordinate
        #[16]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Vertical Coordinate
    ])

    return varParam
Exemple #8
0
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'Mask example', 'simulation name'],

#---Data Folder
    ['fdir', 's', '', 'folder (directory) name for reading-in input and saving output data files'],

    ['gbm_x', 'f', 0.0, 'average horizontal coordinates of waist [m]'],
    ['gbm_y', 'f', 0.0, 'average vertical coordinates of waist [m]'],
    ['gbm_z', 'f', 0.0, 'average longitudinal coordinate of waist [m]'],
    ['gbm_xp', 'f', 0.0, 'average horizontal angle at waist [rad]'],
    ['gbm_yp', 'f', 0.0, 'average verical angle at waist [rad]'],
    ['gbm_ave', 'f', 9000.0, 'average photon energy [eV]'],
    ['gbm_pen', 'f', 0.001, 'energy per pulse [J]'],
    ['gbm_rep', 'f', 1, 'rep. rate [Hz]'],
    ['gbm_pol', 'f', 1, 'polarization 1- lin. hor., 2- lin. vert., 3- lin. 45 deg., 4- lin.135 deg., 5- circ. right, 6- circ. left'],
    ['gbm_sx', 'f', 3e-06, 'rms beam size vs horizontal position [m] at waist (for intensity)'],
    ['gbm_sy', 'f', 3e-06, 'rms beam size vs vertical position [m] at waist (for intensity)'],
    ['gbm_st', 'f', 1e-13, 'rms pulse duration [s] (for intensity)'],
    ['gbm_mx', 'f', 0, 'transverse Gauss-Hermite mode order in horizontal direction'],
    ['gbm_my', 'f', 0, 'transverse Gauss-Hermite mode order in vertical direction'],
    ['gbm_ca', 's', 'c', 'treat _sigX, _sigY as sizes in [m] in coordinate representation (_presCA="c") or as angular divergences in [rad] in angular representation (_presCA="a")'],
    ['gbm_ft', 's', 't', 'treat _sigT as pulse duration in [s] in time domain/representation (_presFT="t") or as bandwidth in [eV] in frequency domain/representation (_presFT="f")'],

#---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    ['tr_cti', 'f', 0.0, 'initial time moment (c*t) for electron trajectory calculation [m]'],
    ['tr_ctf', 'f', 0.0, 'final time moment (c*t) for electron trajectory calculation [m]'],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    ['tr_mag', 'i', 1, 'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'],
    ['tr_fn', 's', 'res_trj.dat', 'file name for saving calculated trajectory data'],
    ['tr_pl', 's', '', 'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'],

    #Single-Electron Spectrum vs Photon Energy
    ['ss', '', '', 'calculate single-e spectrum vs photon energy', 'store_true'],
    ['ss_ei', 'f', 100.0, 'initial photon energy [eV] for single-e spectrum vs photon energy calculation'],
    ['ss_ef', 'f', 20000.0, 'final photon energy [eV] for single-e spectrum vs photon energy calculation'],
    ['ss_ne', 'i', 10000, 'number of points vs photon energy for single-e spectrum vs photon energy calculation'],
    ['ss_x', 'f', 0.0, 'horizontal position [m] for single-e spectrum vs photon energy calculation'],
    ['ss_y', 'f', 0.0, 'vertical position [m] for single-e spectrum vs photon energy calculation'],
    ['ss_meth', 'i', 1, 'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'],
    ['ss_prec', 'f', 0.01, 'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'],
    ['ss_pol', 'i', 6, 'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['ss_mag', 'i', 1, 'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'],
    ['ss_ft', 's', 'f', 'presentation/domain: "f"- frequency (photon energy), "t"- time'],
    ['ss_u', 'i', 1, 'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'],
    ['ss_fn', 's', 'res_spec_se.dat', 'file name for saving calculated single-e spectrum vs photon energy'],
    ['ss_pl', 's', '', 'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    ['sm', '', '', 'calculate multi-e spectrum vs photon energy', 'store_true'],
    ['sm_ei', 'f', 100.0, 'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'],
    ['sm_ef', 'f', 20000.0, 'final photon energy [eV] for multi-e spectrum vs photon energy calculation'],
    ['sm_ne', 'i', 10000, 'number of points vs photon energy for multi-e spectrum vs photon energy calculation'],
    ['sm_x', 'f', 0.0, 'horizontal center position [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_rx', 'f', 0.001, 'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_nx', 'i', 1, 'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'],
    ['sm_y', 'f', 0.0, 'vertical center position [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_ry', 'f', 0.001, 'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_ny', 'i', 1, 'number of points vs vertical position for multi-e spectrum vs photon energy calculation'],
    ['sm_mag', 'i', 1, 'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'],
    ['sm_hi', 'i', 1, 'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'],
    ['sm_hf', 'i', 15, 'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'],
    ['sm_prl', 'f', 1.0, 'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'],
    ['sm_pra', 'f', 1.0, 'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'],
    ['sm_meth', 'i', -1, 'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'],
    ['sm_prec', 'f', 0.01, 'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'],
    ['sm_nm', 'i', 1, 'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'],
    ['sm_na', 'i', 5, 'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'],
    ['sm_ns', 'i', 5, 'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    ['sm_pol', 'i', 6, 'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['sm_rm', 'i', 1, 'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'],
    ['sm_fn', 's', 'res_spec_me.dat', 'file name for saving calculated milti-e spectrum vs photon energy'],
    ['sm_pl', 's', '', 'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    ['pw_x', 'f', 0.0, 'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_rx', 'f', 0.015, 'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_nx', 'i', 100, 'number of points vs horizontal position for calculation of power density distribution'],
    ['pw_y', 'f', 0.0, 'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_ry', 'f', 0.015, 'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_ny', 'i', 100, 'number of points vs vertical position for calculation of power density distribution'],
    ['pw_pr', 'f', 1.0, 'precision factor for calculation of power density distribution'],
    ['pw_meth', 'i', 1, 'power density computation method (1- "near field", 2- "far field")'],
    ['pw_zst', 'f', 0., 'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'],
    ['pw_zfi', 'f', 0., 'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'],
    ['pw_mag', 'i', 1, 'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'],
    ['pw_fn', 's', 'res_pow.dat', 'file name for saving calculated power density distribution'],
    ['pw_pl', 's', '', 'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    ['si', '', '', 'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position', 'store_true'],
    #Single-Electron Wavefront Propagation
    ['ws', '', '', 'calculate single-electron (/ fully coherent) wavefront propagation', 'store_true'],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    ['wm', '', '', 'calculate multi-electron (/ partially coherent) wavefront propagation', 'store_true'],

    ['w_e', 'f', 9000.0, 'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ef', 'f', -1.0, 'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ne', 'i', 1, 'number of points vs photon energy for calculation of intensity distribution'],
    ['w_x', 'f', 0.0, 'central horizontal position [m] for calculation of intensity distribution'],
    ['w_rx', 'f', 0.002, 'range of horizontal position [m] for calculation of intensity distribution'],
    ['w_nx', 'i', 2048, 'number of points vs horizontal position for calculation of intensity distribution'],
    ['w_y', 'f', 0.0, 'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ry', 'f', 0.002, 'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ny', 'i', 2048, 'number of points vs vertical position for calculation of intensity distribution'],
    ['w_smpf', 'f', 0, 'sampling factor for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_meth', 'i', 2, 'method to use for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_prec', 'f', 0.01, 'relative precision for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_u', 'i', 1, 'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'],
    ['si_pol', 'i', 6, 'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['si_type', 'i', 0, 'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'],
    ['w_mag', 'i', 1, 'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'],

    ['si_fn', 's', 'res_int_se.dat', 'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'],
    ['si_pl', 's', '', 'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],
    ['ws_fni', 's', 'res_int_pr_se.dat', 'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'],
    ['ws_pl', 's', '', 'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],

    ['wm_nm', 'i', 100000, 'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'],
    ['wm_na', 'i', 5, 'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'],
    ['wm_ns', 'i', 5, 'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'],
    ['wm_ch', 'i', 0, 'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y'],
    ['wm_ap', 'i', 0, 'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'],
    ['wm_x0', 'f', 0, 'horizontal center position for mutual intensity cut calculation'],
    ['wm_y0', 'f', 0, 'vertical center position for mutual intensity cut calculation'],
    ['wm_ei', 'i', 0, 'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'],
    ['wm_rm', 'i', 1, 'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'],
    ['wm_am', 'i', 0, 'multi-electron integration approximation method: 0- no approximation (use the standard 5D integration method), 1- integrate numerically only over e-beam energy spread and use convolution to treat transverse emittance'],
    ['wm_fni', 's', 'res_int_pr_me.dat', 'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'],

    #to add options
    ['op_r', 'f', 20.0, 'longitudinal position of the first optical element [m]'],

    # Former appParam:
    ['source_type', 's', 'g', 'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'],

#---Beamline optics:
    # VFM: ellipsoidMirror
    ['op_VFM_hfn', 's', 'None', 'heightProfileFile'],
    ['op_VFM_dim', 's', 'x', 'orientation'],
    ['op_VFM_p', 'f', 50.0, 'firstFocusLength'],
    ['op_VFM_q', 'f', 0.4, 'focalLength'],
    ['op_VFM_ang', 'f', 0.003, 'grazingAngle'],
    ['op_VFM_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_VFM_size_tang', 'f', 0.2, 'tangentialSize'],
    ['op_VFM_size_sag', 'f', 0.01, 'sagittalSize'],
    ['op_VFM_nvx', 'f', 0.0, 'normalVectorX'],
    ['op_VFM_nvy', 'f', 0.999995500003, 'normalVectorY'],
    ['op_VFM_nvz', 'f', -0.0029999955, 'normalVectorZ'],
    ['op_VFM_tvx', 'f', 0.0, 'tangentialVectorX'],
    ['op_VFM_tvy', 'f', -0.0029999955, 'tangentialVectorY'],
    ['op_VFM_x', 'f', 0.0, 'horizontalOffset'],
    ['op_VFM_y', 'f', 0.0, 'verticalOffset'],

    # VFM_HFM: drift
    ['op_VFM_HFM_L', 'f', 0.2, 'length'],

    # HFM: ellipsoidMirror
    ['op_HFM_hfn', 's', 'None', 'heightProfileFile'],
    ['op_HFM_dim', 's', 'x', 'orientation'],
    ['op_HFM_p', 'f', 50.0, 'firstFocusLength'],
    ['op_HFM_q', 'f', 0.2, 'focalLength'],
    ['op_HFM_ang', 'f', 0.003, 'grazingAngle'],
    ['op_HFM_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_HFM_size_tang', 'f', 0.2, 'tangentialSize'],
    ['op_HFM_size_sag', 'f', 0.01, 'sagittalSize'],
    ['op_HFM_nvx', 'f', 0.999995500003, 'normalVectorX'],
    ['op_HFM_nvy', 'f', 0.0, 'normalVectorY'],
    ['op_HFM_nvz', 'f', -0.0029999955, 'normalVectorZ'],
    ['op_HFM_tvx', 'f', -0.0029999955, 'tangentialVectorX'],
    ['op_HFM_tvy', 'f', 0.0, 'tangentialVectorY'],
    ['op_HFM_x', 'f', 0.0, 'horizontalOffset'],
    ['op_HFM_y', 'f', 0.0, 'verticalOffset'],

    # HFM_Watchpoint: drift
    ['op_HFM_Watchpoint_L', 'f', 0.2, 'length'],

    # Watchpoint_Mask: drift
    ['op_Watchpoint_Mask_L', 'f', 0.2, 'length'],

    # Mask: mask
    ['op_Mask_delta', 'f', 1.0, 'refractiveIndex'],
    ['op_Mask_atten_len', 'f', 1.0, 'attenuationLength'],
    ['op_Mask_thick', 'f', 1.0, 'maskThickness'],
    ['op_Mask_grid_sh', 'f', 0, 'gridShape'],
    ['op_Mask_grid_dx', 'f', 5e-06, 'horizontalGridDimension'],
    ['op_Mask_grid_dy', 'f', 5e-06, 'verticalGridDimension'],
    ['op_Mask_pitch_x', 'f', 2e-05, 'horizontalGridPitch'],
    ['op_Mask_pitch_y', 'f', 2e-05, 'verticalGridPitch'],
    ['op_Mask_gridTiltAngle', 'f', 0.436332312999, 'gridTiltAngle'],
    ['op_Mask_hx', 'f', 7.32e-07, 'horizontalSamplingInterval'],
    ['op_Mask_hy', 'f', 7.32e-07, 'verticalSamplingInterval'],
    ['op_Mask_mask_x0', 'f', 0.0, 'horizontalMaskCoordinate'],
    ['op_Mask_mask_y0', 'f', 0.0, 'verticalMaskCoordinate'],
    ['op_Mask_mask_Nx', 'i', 1024, 'horizontalPixelsNumber'],
    ['op_Mask_mask_Ny', 'i', 1024, 'verticalPixelsNumber'],
    ['op_Mask_grid_nx', 'i', 21, 'horizontalGridsNumber'],
    ['op_Mask_grid_ny', 'i', 21, 'verticalGridsNumber'],

#---Propagation parameters
    ['op_VFM_pp', 'f',             [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], 'VFM'],
    ['op_VFM_HFM_pp', 'f',         [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], 'VFM_HFM'],
    ['op_HFM_pp', 'f',             [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], 'HFM'],
    ['op_HFM_Watchpoint_pp', 'f',  [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], 'HFM_Watchpoint'],
    ['op_Watchpoint_Mask_pp', 'f', [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], 'Watchpoint_Mask'],
    ['op_Mask_pp', 'f',            [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], 'Mask'],
    ['op_fin_pp', 'f',             [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], 'final post-propagation (resize) parameters'],

    #[ 0]: Auto-Resize (1) or not (0) Before propagation
    #[ 1]: Auto-Resize (1) or not (0) After propagation
    #[ 2]: Relative Precision for propagation with Auto-Resizing (1. is nominal)
    #[ 3]: Allow (1) or not (0) for semi-analytical treatment of the quadratic (leading) phase terms at the propagation
    #[ 4]: Do any Resizing on Fourier side, using FFT, (1) or not (0)
    #[ 5]: Horizontal Range modification factor at Resizing (1. means no modification)
    #[ 6]: Horizontal Resolution modification factor at Resizing
    #[ 7]: Vertical Range modification factor at Resizing
    #[ 8]: Vertical Resolution modification factor at Resizing
    #[ 9]: Type of wavefront Shift before Resizing (not yet implemented)
    #[10]: New Horizontal wavefront Center position after Shift (not yet implemented)
    #[11]: New Vertical wavefront Center position after Shift (not yet implemented)
    #[12]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Horizontal Coordinate
    #[13]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Vertical Coordinate
    #[14]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Longitudinal Coordinate
    #[15]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Horizontal Coordinate
    #[16]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Vertical Coordinate
])
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'NSLS-II SRX beamline', 'simulation name'],

#---Data Folder
    ['fdir', 's', '', 'folder (directory) name for reading-in input and saving output data files'],

#---Electron Beam
    ['ebm_nm', 's', 'NSLS-II Low Beta Day 1', 'standard electron beam name'],
    ['ebm_nms', 's', '', 'standard electron beam name suffix: e.g. can be Day1, Final'],
    ['ebm_i', 'f', 0.5, 'electron beam current [A]'],
    ['ebm_e', 'f', 3.0, 'electron beam avarage energy [GeV]'],
    ['ebm_de', 'f', 0.0, 'electron beam average energy deviation [GeV]'],
    ['ebm_x', 'f', 0.0, 'electron beam initial average horizontal position [m]'],
    ['ebm_y', 'f', 0.0, 'electron beam initial average vertical position [m]'],
    ['ebm_xp', 'f', 0.0, 'electron beam initial average horizontal angle [rad]'],
    ['ebm_yp', 'f', 0.0, 'electron beam initial average vertical angle [rad]'],
    ['ebm_z', 'f', 0., 'electron beam initial average longitudinal position [m]'],
    ['ebm_dr', 'f', 0.0, 'electron beam longitudinal drift [m] to be performed before a required calculation'],
    ['ebm_ens', 'f', 0.00089, 'electron beam relative energy spread'],
    ['ebm_emx', 'f', 9e-10, 'electron beam horizontal emittance [m]'],
    ['ebm_emy', 'f', 8e-12, 'electron beam vertical emittance [m]'],
    # Definition of the beam through Twiss:
    ['ebm_betax', 'f', 1.84, 'horizontal beta-function [m]'],
    ['ebm_betay', 'f', 1.17, 'vertical beta-function [m]'],
    ['ebm_alphax', 'f', 0.0, 'horizontal alpha-function [rad]'],
    ['ebm_alphay', 'f', 0.0, 'vertical alpha-function [rad]'],
    ['ebm_etax', 'f', 0.0, 'horizontal dispersion function [m]'],
    ['ebm_etay', 'f', 0.0, 'vertical dispersion function [m]'],
    ['ebm_etaxp', 'f', 0.0, 'horizontal dispersion function derivative [rad]'],
    ['ebm_etayp', 'f', 0.0, 'vertical dispersion function derivative [rad]'],
    # Definition of the beam through Moments:
    ['ebm_sigx', 'f', 4.06939799e-05, 'horizontal RMS size of electron beam [m]'],
    ['ebm_sigy', 'f', 3.05941171e-06, 'vertical RMS size of electron beam [m]'],
    ['ebm_sigxp', 'f', 2.211629342e-05, 'horizontal RMS angular divergence of electron beam [rad]'],
    ['ebm_sigyp', 'f', 2.6148818e-06, 'vertical RMS angular divergence of electron beam [rad]'],
    ['ebm_mxxp', 'f', 0.0, 'horizontal position-angle mixed 2nd order moment of electron beam [m]'],
    ['ebm_myyp', 'f', 0.0, 'vertical position-angle mixed 2nd order moment of electron beam [m]'],

#---Undulator
    ['und_bx', 'f', 0.0, 'undulator horizontal peak magnetic field [T]'],
    ['und_by', 'f', 0.88770981, 'undulator vertical peak magnetic field [T]'],
    ['und_phx', 'f', 0.0, 'initial phase of the horizontal magnetic field [rad]'],
    ['und_phy', 'f', 0.0, 'initial phase of the vertical magnetic field [rad]'],
    ['und_b2e', '', '', 'estimate undulator fundamental photon energy (in [eV]) for the amplitude of sinusoidal magnetic field defined by und_b or und_bx, und_by', 'store_true'],
    ['und_e2b', '', '', 'estimate undulator field amplitude (in [T]) for the photon energy defined by w_e', 'store_true'],
    ['und_per', 'f', 0.02, 'undulator period [m]'],
    ['und_len', 'f', 3.0, 'undulator length [m]'],
    ['und_zc', 'f', -1.25, 'undulator center longitudinal position [m]'],
    ['und_sx', 'i', 1, 'undulator horizontal magnetic field symmetry vs longitudinal position'],
    ['und_sy', 'i', -1, 'undulator vertical magnetic field symmetry vs longitudinal position'],
    ['und_g', 'f', 6.715, 'undulator gap [mm] (assumes availability of magnetic measurement or simulation data)'],
    ['und_ph', 'f', 0.0, 'shift of magnet arrays [mm] for which the field should be set up'],
    ['und_mdir', 's', '', 'name of magnetic measurements sub-folder'],
    ['und_mfs', 's', '', 'name of magnetic measurements for different gaps summary file'],


#---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    ['tr_cti', 'f', 0.0, 'initial time moment (c*t) for electron trajectory calculation [m]'],
    ['tr_ctf', 'f', 0.0, 'final time moment (c*t) for electron trajectory calculation [m]'],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    ['tr_mag', 'i', 2, 'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'],
    ['tr_fn', 's', 'res_trj.dat', 'file name for saving calculated trajectory data'],
    ['tr_pl', 's', '', 'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'],

    #Single-Electron Spectrum vs Photon Energy
    ['ss', '', '', 'calculate single-e spectrum vs photon energy', 'store_true'],
    ['ss_ei', 'f', 100.0, 'initial photon energy [eV] for single-e spectrum vs photon energy calculation'],
    ['ss_ef', 'f', 20000.0, 'final photon energy [eV] for single-e spectrum vs photon energy calculation'],
    ['ss_ne', 'i', 10000, 'number of points vs photon energy for single-e spectrum vs photon energy calculation'],
    ['ss_x', 'f', 0.0, 'horizontal position [m] for single-e spectrum vs photon energy calculation'],
    ['ss_y', 'f', 0.0, 'vertical position [m] for single-e spectrum vs photon energy calculation'],
    ['ss_meth', 'i', 1, 'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'],
    ['ss_prec', 'f', 0.01, 'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'],
    ['ss_pol', 'i', 6, 'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['ss_mag', 'i', 2, 'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'],
    ['ss_ft', 's', 'f', 'presentation/domain: "f"- frequency (photon energy), "t"- time'],
    ['ss_u', 'i', 1, 'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'],
    ['ss_fn', 's', 'res_spec_se.dat', 'file name for saving calculated single-e spectrum vs photon energy'],
    ['ss_pl', 's', '', 'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    ['sm', '', '', 'calculate multi-e spectrum vs photon energy', 'store_true'],
    ['sm_ei', 'f', 100.0, 'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'],
    ['sm_ef', 'f', 20000.0, 'final photon energy [eV] for multi-e spectrum vs photon energy calculation'],
    ['sm_ne', 'i', 10000, 'number of points vs photon energy for multi-e spectrum vs photon energy calculation'],
    ['sm_x', 'f', 0.0, 'horizontal center position [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_rx', 'f', 0.001, 'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_nx', 'i', 1, 'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'],
    ['sm_y', 'f', 0.0, 'vertical center position [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_ry', 'f', 0.001, 'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_ny', 'i', 1, 'number of points vs vertical position for multi-e spectrum vs photon energy calculation'],
    ['sm_mag', 'i', 1, 'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'],
    ['sm_hi', 'i', 1, 'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'],
    ['sm_hf', 'i', 15, 'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'],
    ['sm_prl', 'f', 1.0, 'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'],
    ['sm_pra', 'f', 1.0, 'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'],
    ['sm_meth', 'i', -1, 'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'],
    ['sm_prec', 'f', 0.01, 'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'],
    ['sm_nm', 'i', 1, 'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'],
    ['sm_na', 'i', 5, 'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'],
    ['sm_ns', 'i', 5, 'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    ['sm_pol', 'i', 6, 'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['sm_rm', 'i', 1, 'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'],
    ['sm_fn', 's', 'res_spec_me.dat', 'file name for saving calculated milti-e spectrum vs photon energy'],
    ['sm_pl', 's', '', 'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    ['pw_x', 'f', 0.0, 'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_rx', 'f', 0.025, 'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_nx', 'i', 100, 'number of points vs horizontal position for calculation of power density distribution'],
    ['pw_y', 'f', 0.0, 'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_ry', 'f', 0.025, 'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_ny', 'i', 100, 'number of points vs vertical position for calculation of power density distribution'],
    ['pw_pr', 'f', 1.0, 'precision factor for calculation of power density distribution'],
    ['pw_meth', 'i', 1, 'power density computation method (1- "near field", 2- "far field")'],
    ['pw_zst', 'f', 0., 'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'],
    ['pw_zfi', 'f', 0., 'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'],
    ['pw_mag', 'i', 1, 'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'],
    ['pw_fn', 's', 'res_pow.dat', 'file name for saving calculated power density distribution'],
    ['pw_pl', 's', '', 'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    ['si', '', '', 'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position', 'store_true'],
    #Single-Electron Wavefront Propagation
    ['ws', '', '', 'calculate single-electron (/ fully coherent) wavefront propagation', 'store_true'],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    ['wm', '', '', 'calculate multi-electron (/ partially coherent) wavefront propagation', 'store_true'],

    ['w_e', 'f', 8000.0, 'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ef', 'f', -1.0, 'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ne', 'i', 1, 'number of points vs photon energy for calculation of intensity distribution'],
    ['w_x', 'f', 0.0, 'central horizontal position [m] for calculation of intensity distribution'],
    ['w_rx', 'f', 0.0025, 'range of horizontal position [m] for calculation of intensity distribution'],
    ['w_nx', 'i', 100, 'number of points vs horizontal position for calculation of intensity distribution'],
    ['w_y', 'f', 0.0, 'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ry', 'f', 0.0013, 'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ny', 'i', 100, 'number of points vs vertical position for calculation of intensity distribution'],
    ['w_smpf', 'f', 0.1, 'sampling factor for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_meth', 'i', 1, 'method to use for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_prec', 'f', 0.01, 'relative precision for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_u', 'i', 1, 'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'],
    ['si_pol', 'i', 6, 'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['si_type', 'i', 0, 'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'],
    ['w_mag', 'i', 2, 'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'],

    ['si_fn', 's', 'res_int_se.dat', 'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'],
    ['si_pl', 's', '', 'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],
    ['ws_fni', 's', 'res_int_pr_se.dat', 'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'],
    ['ws_pl', 's', '', 'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],

    ['wm_nm', 'i', 100000, 'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'],
    ['wm_na', 'i', 5, 'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'],
    ['wm_ns', 'i', 5, 'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'],
    ['wm_ch', 'i', 0, 'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y'],
    ['wm_ap', 'i', 0, 'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'],
    ['wm_x0', 'f', 0, 'horizontal center position for mutual intensity cut calculation'],
    ['wm_y0', 'f', 0, 'vertical center position for mutual intensity cut calculation'],
    ['wm_ei', 'i', 0, 'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'],
    ['wm_rm', 'i', 1, 'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'],
    ['wm_am', 'i', 0, 'multi-electron integration approximation method: 0- no approximation (use the standard 5D integration method), 1- integrate numerically only over e-beam energy spread and use convolution to treat transverse emittance'],
    ['wm_fni', 's', 'res_int_pr_me.dat', 'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'],

    #to add options
    ['op_r', 'f', 20.0, 'longitudinal position of the first optical element [m]'],

    # Former appParam:
    ['source_type', 's', 't', 'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'],

#---Beamline optics:
    # S0: aperture
    ['op_S0_shape', 's', 'r', 'shape'],
    ['op_S0_Dx', 'f', 0.002, 'horizontalSize'],
    ['op_S0_Dy', 'f', 0.001, 'verticalSize'],
    ['op_S0_x', 'f', 0.0, 'horizontalOffset'],
    ['op_S0_y', 'f', 0.0, 'verticalOffset'],

    # S0_HFM: drift
    ['op_S0_HFM_L', 'f', 1.081, 'length'],

    # HFM: sphericalMirror
    ['op_HFM_hfn', 's', 'None', 'heightProfileFile'],
    ['op_HFM_dim', 's', 'x', 'orientation'],
    ['op_HFM_r', 'f', 8871.45, 'radius'],
    ['op_HFM_size_tang', 'f', 0.95, 'tangentialSize'],
    ['op_HFM_size_sag', 'f', 0.005, 'sagittalSize'],
    ['op_HFM_ang', 'f', 0.0025, 'grazingAngle'],
    ['op_HFM_nvx', 'f', 0.999996875002, 'normalVectorX'],
    ['op_HFM_nvy', 'f', 0.0, 'normalVectorY'],
    ['op_HFM_nvz', 'f', -0.00249999739583, 'normalVectorZ'],
    ['op_HFM_tvx', 'f', 0.00249999739583, 'tangentialVectorX'],
    ['op_HFM_tvy', 'f', 0.0, 'tangentialVectorY'],
    ['op_HFM_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_HFM_x', 'f', 0.0, 'horizontalOffset'],
    ['op_HFM_y', 'f', 0.0, 'verticalOffset'],

    # HFM_S1: drift
    ['op_HFM_S1_L', 'f', 1.407, 'length'],

    # S1: aperture
    ['op_S1_shape', 's', 'r', 'shape'],
    ['op_S1_Dx', 'f', 0.0024, 'horizontalSize'],
    ['op_S1_Dy', 'f', 0.0015, 'verticalSize'],
    ['op_S1_x', 'f', 0.0, 'horizontalOffset'],
    ['op_S1_y', 'f', 0.0, 'verticalOffset'],

    # S1_DCM_C1: drift
    ['op_S1_DCM_C1_L', 'f', 0.781, 'length'],

    # DCM_C1: crystal
    ['op_DCM_C1_hfn', 's', '', 'heightProfileFile'],
    ['op_DCM_C1_dim', 's', 'x', 'orientation'],
    ['op_DCM_C1_d_sp', 'f', 3.13557135638, 'dSpacing'],
    ['op_DCM_C1_psi0r', 'f', -1.53227839905e-05, 'psi0r'],
    ['op_DCM_C1_psi0i', 'f', 3.59410775406e-07, 'psi0i'],
    ['op_DCM_C1_psiHr', 'f', -8.10706354484e-06, 'psiHr'],
    ['op_DCM_C1_psiHi', 'f', 2.50931132347e-07, 'psiHi'],
    ['op_DCM_C1_psiHBr', 'f', -8.10706354484e-06, 'psiHBr'],
    ['op_DCM_C1_psiHBi', 'f', 2.50931132347e-07, 'psiHBi'],
    ['op_DCM_C1_tc', 'f', 0.01, 'crystalThickness'],
    ['op_DCM_C1_ang_as', 'f', 0.0, 'asymmetryAngle'],
    ['op_DCM_C1_nvx', 'f', -0.968973817886, 'nvx'],
    ['op_DCM_C1_nvy', 'f', 2.59635532439e-08, 'nvy'],
    ['op_DCM_C1_nvz', 'f', -0.247163387763, 'nvz'],
    ['op_DCM_C1_tvx', 'f', -0.247163387763, 'tvx'],
    ['op_DCM_C1_tvy', 'f', 6.62271741473e-09, 'tvy'],
    ['op_DCM_C1_ang', 'f', 1.5707963, 'grazingAngle'],
    ['op_DCM_C1_amp_coef', 'f', 1.0, 'heightAmplification'],

    # DCM_C2: crystal
    ['op_DCM_C2_hfn', 's', '', 'heightProfileFile'],
    ['op_DCM_C2_dim', 's', 'x', 'orientation'],
    ['op_DCM_C2_d_sp', 'f', 3.13557135638, 'dSpacing'],
    ['op_DCM_C2_psi0r', 'f', -1.53227839905e-05, 'psi0r'],
    ['op_DCM_C2_psi0i', 'f', 3.59410775406e-07, 'psi0i'],
    ['op_DCM_C2_psiHr', 'f', -8.10706354484e-06, 'psiHr'],
    ['op_DCM_C2_psiHi', 'f', 2.50931132347e-07, 'psiHi'],
    ['op_DCM_C2_psiHBr', 'f', -8.10706354484e-06, 'psiHBr'],
    ['op_DCM_C2_psiHBi', 'f', 2.50931132347e-07, 'psiHBi'],
    ['op_DCM_C2_tc', 'f', 0.01, 'crystalThickness'],
    ['op_DCM_C2_ang_as', 'f', 0.0, 'asymmetryAngle'],
    ['op_DCM_C2_nvx', 'f', 0.968973817886, 'nvx'],
    ['op_DCM_C2_nvy', 'f', 0.0, 'nvy'],
    ['op_DCM_C2_nvz', 'f', -0.247163387763, 'nvz'],
    ['op_DCM_C2_tvx', 'f', 0.247163387763, 'tvx'],
    ['op_DCM_C2_tvy', 'f', 0.0, 'tvy'],
    ['op_DCM_C2_ang', 'f', -1.5707963, 'grazingAngle'],
    ['op_DCM_C2_amp_coef', 'f', 1.0, 'heightAmplification'],

    # DCM_C2_At_BPM1: drift
    ['op_DCM_C2_At_BPM1_L', 'f', 2.2416, 'length'],

    # At_BPM1_Before_SSA: drift
    ['op_At_BPM1_Before_SSA_L', 'f', 11.9668, 'length'],

    # SSA: aperture
    ['op_SSA_shape', 's', 'r', 'shape'],
    ['op_SSA_Dx', 'f', 5e-05, 'horizontalSize'],
    ['op_SSA_Dy', 'f', 0.003, 'verticalSize'],
    ['op_SSA_x', 'f', 0.0, 'horizontalOffset'],
    ['op_SSA_y', 'f', 0.0, 'verticalOffset'],

    # SSA_AKB: drift
    ['op_SSA_AKB_L', 'f', 11.8308, 'length'],

    # AKB: aperture
    ['op_AKB_shape', 's', 'r', 'shape'],
    ['op_AKB_Dx', 'f', 0.003, 'horizontalSize'],
    ['op_AKB_Dy', 'f', 0.000875, 'verticalSize'],
    ['op_AKB_x', 'f', 0.0, 'horizontalOffset'],
    ['op_AKB_y', 'f', 0.0, 'verticalOffset'],

    # AKB_KBV: drift
    ['op_AKB_KBV_L', 'f', 0.175, 'length'],

    # KBV: ellipsoidMirror
    ['op_KBV_hfn', 's', '', 'heightProfileFile'],
    ['op_KBV_dim', 's', 'x', 'orientation'],
    ['op_KBV_p', 'f', 63.913, 'firstFocusLength'],
    ['op_KBV_q', 'f', 0.637, 'focalLength'],
    ['op_KBV_ang', 'f', 0.0025, 'grazingAngle'],
    ['op_KBV_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_KBV_size_tang', 'f', 0.35, 'tangentialSize'],
    ['op_KBV_size_sag', 'f', 0.003, 'sagittalSize'],
    ['op_KBV_nvx', 'f', 0.0, 'normalVectorX'],
    ['op_KBV_nvy', 'f', 0.999996875002, 'normalVectorY'],
    ['op_KBV_nvz', 'f', -0.00249999739583, 'normalVectorZ'],
    ['op_KBV_tvx', 'f', 0.0, 'tangentialVectorX'],
    ['op_KBV_tvy', 'f', -0.00249999739583, 'tangentialVectorY'],
    ['op_KBV_x', 'f', 0.0, 'horizontalOffset'],
    ['op_KBV_y', 'f', 0.0, 'verticalOffset'],

    # KBV_KBH: drift
    ['op_KBV_KBH_L', 'f', 0.337, 'length'],

    # KBH: ellipsoidMirror
    ['op_KBH_hfn', 's', '', 'heightProfileFile'],
    ['op_KBH_dim', 's', 'x', 'orientation'],
    ['op_KBH_p', 'f', 12.3428, 'firstFocusLength'],
    ['op_KBH_q', 'f', 0.3, 'focalLength'],
    ['op_KBH_ang', 'f', 0.0025, 'grazingAngle'],
    ['op_KBH_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_KBH_size_tang', 'f', 0.3, 'tangentialSize'],
    ['op_KBH_size_sag', 'f', 0.003, 'sagittalSize'],
    ['op_KBH_nvx', 'f', 0.999996875002, 'normalVectorX'],
    ['op_KBH_nvy', 'f', 0.0, 'normalVectorY'],
    ['op_KBH_nvz', 'f', -0.00249999739583, 'normalVectorZ'],
    ['op_KBH_tvx', 'f', -0.00249999739583, 'tangentialVectorX'],
    ['op_KBH_tvy', 'f', 0.0, 'tangentialVectorY'],
    ['op_KBH_x', 'f', 0.0, 'horizontalOffset'],
    ['op_KBH_y', 'f', 0.0, 'verticalOffset'],

    # KBH_At_Sample: drift
    ['op_KBH_At_Sample_L', 'f', 0.3, 'length'],

#---Propagation parameters
    ['op_S0_pp', 'f',                 [0, 0, 1.0, 0, 0, 1.1, 7.0, 1.3, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'S0'],
    ['op_S0_HFM_pp', 'f',             [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], 'S0_HFM'],
    ['op_HFM_pp', 'f',                [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], 'HFM'],
    ['op_HFM_S1_pp', 'f',             [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], 'HFM_S1'],
    ['op_S1_pp', 'f',                 [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], 'S1'],
    ['op_S1_DCM_C1_pp', 'f',          [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], 'S1_DCM_C1'],
    ['op_DCM_C1_pp', 'f',             [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], 'DCM_C1'],
    ['op_DCM_C2_pp', 'f',             [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], 'DCM_C2'],
    ['op_DCM_C2_At_BPM1_pp', 'f',     [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], 'DCM_C2_At_BPM1'],
    ['op_At_BPM1_Before_SSA_pp', 'f', [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], 'At_BPM1_Before_SSA'],
    ['op_SSA_pp', 'f',                [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], 'SSA'],
    ['op_SSA_AKB_pp', 'f',            [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], 'SSA_AKB'],
    ['op_AKB_pp', 'f',                [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], 'AKB'],
    ['op_AKB_KBV_pp', 'f',            [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], 'AKB_KBV'],
    ['op_KBV_pp', 'f',                [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], 'KBV'],
    ['op_KBV_KBH_pp', 'f',            [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], 'KBV_KBH'],
    ['op_KBH_pp', 'f',                [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'],
    ['op_KBH_At_Sample_pp', 'f',      [0, 0, 1.0, 4, 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_At_Sample'],
    ['op_fin_pp', 'f',                [0, 0, 1.0, 0, 1, 0.5, 1.0, 0.2, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'final post-propagation (resize) parameters'],

    #[ 0]: Auto-Resize (1) or not (0) Before propagation
    #[ 1]: Auto-Resize (1) or not (0) After propagation
    #[ 2]: Relative Precision for propagation with Auto-Resizing (1. is nominal)
    #[ 3]: Allow (1) or not (0) for semi-analytical treatment of the quadratic (leading) phase terms at the propagation
    #[ 4]: Do any Resizing on Fourier side, using FFT, (1) or not (0)
    #[ 5]: Horizontal Range modification factor at Resizing (1. means no modification)
    #[ 6]: Horizontal Resolution modification factor at Resizing
    #[ 7]: Vertical Range modification factor at Resizing
    #[ 8]: Vertical Resolution modification factor at Resizing
    #[ 9]: Type of wavefront Shift before Resizing (not yet implemented)
    #[10]: New Horizontal wavefront Center position after Shift (not yet implemented)
    #[11]: New Vertical wavefront Center position after Shift (not yet implemented)
    #[12]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Horizontal Coordinate
    #[13]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Vertical Coordinate
    #[14]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Longitudinal Coordinate
    #[15]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Horizontal Coordinate
    #[16]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Vertical Coordinate
])
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'Diffraction by an Aperture', 'simulation name'],

#---Data Folder
    ['fdir', 's', '', 'folder (directory) name for reading-in input and saving output data files'],

    ['gbm_x', 'f', 0.0, 'average horizontal coordinates of waist [m]'],
    ['gbm_y', 'f', 0.0, 'average vertical coordinates of waist [m]'],
    ['gbm_z', 'f', 0.0, 'average longitudinal coordinate of waist [m]'],
    ['gbm_xp', 'f', 0.0, 'average horizontal angle at waist [rad]'],
    ['gbm_yp', 'f', 0.0, 'average verical angle at waist [rad]'],
    ['gbm_ave', 'f', 1.95251, 'average photon energy [eV]'],
    ['gbm_pen', 'f', 0.001, 'energy per pulse [J]'],
    ['gbm_rep', 'f', 1, 'rep. rate [Hz]'],
    ['gbm_pol', 'f', 1, 'polarization 1- lin. hor., 2- lin. vert., 3- lin. 45 deg., 4- lin.135 deg., 5- circ. right, 6- circ. left'],
    ['gbm_sx', 'f', 0.001, 'rms beam size vs horizontal position [m] at waist (for intensity)'],
    ['gbm_sy', 'f', 0.001, 'rms beam size vs vertical position [m] at waist (for intensity)'],
    ['gbm_st', 'f', 1e-13, 'rms pulse duration [s] (for intensity)'],
    ['gbm_mx', 'f', 0, 'transverse Gauss-Hermite mode order in horizontal direction'],
    ['gbm_my', 'f', 0, 'transverse Gauss-Hermite mode order in vertical direction'],
    ['gbm_ca', 's', 'c', 'treat _sigX, _sigY as sizes in [m] in coordinate representation (_presCA="c") or as angular divergences in [rad] in angular representation (_presCA="a")'],
    ['gbm_ft', 's', 't', 'treat _sigT as pulse duration in [s] in time domain/representation (_presFT="t") or as bandwidth in [eV] in frequency domain/representation (_presFT="f")'],

#---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    ['tr_cti', 'f', 0.0, 'initial time moment (c*t) for electron trajectory calculation [m]'],
    ['tr_ctf', 'f', 0.0, 'final time moment (c*t) for electron trajectory calculation [m]'],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    ['tr_mag', 'i', 1, 'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'],
    ['tr_fn', 's', 'res_trj.dat', 'file name for saving calculated trajectory data'],
    ['tr_pl', 's', '', 'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'],

    #Single-Electron Spectrum vs Photon Energy
    ['ss', '', '', 'calculate single-e spectrum vs photon energy', 'store_true'],
    ['ss_ei', 'f', 100.0, 'initial photon energy [eV] for single-e spectrum vs photon energy calculation'],
    ['ss_ef', 'f', 20000.0, 'final photon energy [eV] for single-e spectrum vs photon energy calculation'],
    ['ss_ne', 'i', 10000, 'number of points vs photon energy for single-e spectrum vs photon energy calculation'],
    ['ss_x', 'f', 0.0, 'horizontal position [m] for single-e spectrum vs photon energy calculation'],
    ['ss_y', 'f', 0.0, 'vertical position [m] for single-e spectrum vs photon energy calculation'],
    ['ss_meth', 'i', 0, 'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'],
    ['ss_prec', 'f', 0.01, 'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'],
    ['ss_pol', 'i', 6, 'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['ss_mag', 'i', 1, 'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'],
    ['ss_ft', 's', 'f', 'presentation/domain: "f"- frequency (photon energy), "t"- time'],
    ['ss_u', 'i', 1, 'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'],
    ['ss_fn', 's', 'res_spec_se.dat', 'file name for saving calculated single-e spectrum vs photon energy'],
    ['ss_pl', 's', '', 'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    ['sm', '', '', 'calculate multi-e spectrum vs photon energy', 'store_true'],
    ['sm_ei', 'f', 100.0, 'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'],
    ['sm_ef', 'f', 20000.0, 'final photon energy [eV] for multi-e spectrum vs photon energy calculation'],
    ['sm_ne', 'i', 10000, 'number of points vs photon energy for multi-e spectrum vs photon energy calculation'],
    ['sm_x', 'f', 0.0, 'horizontal center position [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_rx', 'f', 0.001, 'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_nx', 'i', 1, 'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'],
    ['sm_y', 'f', 0.0, 'vertical center position [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_ry', 'f', 0.001, 'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_ny', 'i', 1, 'number of points vs vertical position for multi-e spectrum vs photon energy calculation'],
    ['sm_mag', 'i', 1, 'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'],
    ['sm_hi', 'i', 1, 'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'],
    ['sm_hf', 'i', 15, 'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'],
    ['sm_prl', 'f', 1.0, 'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'],
    ['sm_pra', 'f', 1.0, 'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'],
    ['sm_meth', 'i', -1, 'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'],
    ['sm_prec', 'f', 0.01, 'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'],
    ['sm_nm', 'i', 1, 'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'],
    ['sm_na', 'i', 5, 'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'],
    ['sm_ns', 'i', 5, 'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    ['sm_pol', 'i', 6, 'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['sm_rm', 'i', 1, 'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'],
    ['sm_fn', 's', 'res_spec_me.dat', 'file name for saving calculated milti-e spectrum vs photon energy'],
    ['sm_pl', 's', '', 'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    ['pw_x', 'f', 0.0, 'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_rx', 'f', 0.015, 'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_nx', 'i', 100, 'number of points vs horizontal position for calculation of power density distribution'],
    ['pw_y', 'f', 0.0, 'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_ry', 'f', 0.015, 'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_ny', 'i', 100, 'number of points vs vertical position for calculation of power density distribution'],
    ['pw_pr', 'f', 1.0, 'precision factor for calculation of power density distribution'],
    ['pw_meth', 'i', 1, 'power density computation method (1- "near field", 2- "far field")'],
    ['pw_zst', 'f', 0., 'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'],
    ['pw_zfi', 'f', 0., 'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'],
    ['pw_mag', 'i', 1, 'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'],
    ['pw_fn', 's', 'res_pow.dat', 'file name for saving calculated power density distribution'],
    ['pw_pl', 's', '', 'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    ['si', '', '', 'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position', 'store_true'],
    #Single-Electron Wavefront Propagation
    ['ws', '', '', 'calculate single-electron (/ fully coherent) wavefront propagation', 'store_true'],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    ['wm', '', '', 'calculate multi-electron (/ partially coherent) wavefront propagation', 'store_true'],

    ['w_e', 'f', 1.95251, 'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ef', 'f', -1., 'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ne', 'i', 1, 'number of points vs photon energy for calculation of intensity distribution'],
    ['w_x', 'f', 0.0, 'central horizontal position [m] for calculation of intensity distribution'],
    ['w_rx', 'f', 0.008, 'range of horizontal position [m] for calculation of intensity distribution'],
    ['w_nx', 'i', 200, 'number of points vs horizontal position for calculation of intensity distribution'],
    ['w_y', 'f', 0.0, 'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ry', 'f', 0.008, 'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ny', 'i', 200, 'number of points vs vertical position for calculation of intensity distribution'],
    ['w_smpf', 'f', 1.0, 'sampling factor for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_meth', 'i', 2, 'method to use for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_prec', 'f', 0.01, 'relative precision for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_u', 'i', 1, 'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'],
    ['si_pol', 'i', 6, 'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['si_type', 'i', 0, 'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'],
    ['w_mag', 'i', 1, 'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'],

    ['si_fn', 's', 'res_int_se.dat', 'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'],
    ['si_pl', 's', '', 'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],
    ['ws_fni', 's', 'res_int_pr_se.dat', 'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'],
    ['ws_pl', 's', '', 'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],

    ['wm_nm', 'i', 100000, 'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'],
    ['wm_na', 'i', 5, 'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'],
    ['wm_ns', 'i', 5, 'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'],
    ['wm_ch', 'i', 0, 'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y'],
    ['wm_ap', 'i', 0, 'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'],
    ['wm_x0', 'f', 0, 'horizontal center position for mutual intensity cut calculation'],
    ['wm_y0', 'f', 0, 'vertical center position for mutual intensity cut calculation'],
    ['wm_ei', 'i', 0, 'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'],
    ['wm_rm', 'i', 1, 'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'],
    ['wm_fni', 's', 'res_int_pr_me.dat', 'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'],


    #to add options
    ['op_r', 'f', 0.5, 'longitudinal position of the first optical element [m]'],

    # Former appParam:
    ['source_type', 's', 'g', 'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'],
])
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'Boron Fiber CRL with 3 lenses', 'simulation name'],

#---Data Folder
    ['fdir', 's', '', 'folder (directory) name for reading-in input and saving output data files'],

#---Electron Beam
    ['ebm_nm', 's', 'NSLS-II Low Beta Final', 'standard electron beam name'],
    ['ebm_nms', 's', '', 'standard electron beam name suffix: e.g. can be Day1, Final'],
    ['ebm_i', 'f', 0.5, 'electron beam current [A]'],
    ['ebm_e', 'f', 3.0, 'electron beam avarage energy [GeV]'],
    ['ebm_de', 'f', 0.0, 'electron beam average energy deviation [GeV]'],
    ['ebm_x', 'f', 0.0, 'electron beam initial average horizontal position [m]'],
    ['ebm_y', 'f', 0.0, 'electron beam initial average vertical position [m]'],
    ['ebm_xp', 'f', 0.0, 'electron beam initial average horizontal angle [rad]'],
    ['ebm_yp', 'f', 0.0, 'electron beam initial average vertical angle [rad]'],
    ['ebm_z', 'f', 0., 'electron beam initial average longitudinal position [m]'],
    ['ebm_dr', 'f', -1.54, 'electron beam longitudinal drift [m] to be performed before a required calculation'],
    ['ebm_ens', 'f', 0.00089, 'electron beam relative energy spread'],
    ['ebm_emx', 'f', 5.5e-10, 'electron beam horizontal emittance [m]'],
    ['ebm_emy', 'f', 8e-12, 'electron beam vertical emittance [m]'],
    # Definition of the beam through Twiss:
    ['ebm_betax', 'f', 2.02, 'horizontal beta-function [m]'],
    ['ebm_betay', 'f', 1.06, 'vertical beta-function [m]'],
    ['ebm_alphax', 'f', 0.0, 'horizontal alpha-function [rad]'],
    ['ebm_alphay', 'f', 0.0, 'vertical alpha-function [rad]'],
    ['ebm_etax', 'f', 0.0, 'horizontal dispersion function [m]'],
    ['ebm_etay', 'f', 0.0, 'vertical dispersion function [m]'],
    ['ebm_etaxp', 'f', 0.0, 'horizontal dispersion function derivative [rad]'],
    ['ebm_etayp', 'f', 0.0, 'vertical dispersion function derivative [rad]'],
    # Definition of the beam through Moments:
    ['ebm_sigx', 'f', 3.3331666625e-05, 'horizontal RMS size of electron beam [m]'],
    ['ebm_sigy', 'f', 2.91204395571e-06, 'vertical RMS size of electron beam [m]'],
    ['ebm_sigxp', 'f', 1.65008250619e-05, 'horizontal RMS angular divergence of electron beam [rad]'],
    ['ebm_sigyp', 'f', 2.74721127897e-06, 'vertical RMS angular divergence of electron beam [rad]'],
    ['ebm_mxxp', 'f', 0.0, 'horizontal position-angle mixed 2nd order moment of electron beam [m]'],
    ['ebm_myyp', 'f', 0.0, 'vertical position-angle mixed 2nd order moment of electron beam [m]'],

#---Undulator
    ['und_bx', 'f', 0.0, 'undulator horizontal peak magnetic field [T]'],
    ['und_by', 'f', 0.9316, 'undulator vertical peak magnetic field [T]'],
    ['und_phx', 'f', 0.0, 'initial phase of the horizontal magnetic field [rad]'],
    ['und_phy', 'f', 0.0, 'initial phase of the vertical magnetic field [rad]'],
    ['und_b2e', '', '', 'estimate undulator fundamental photon energy (in [eV]) for the amplitude of sinusoidal magnetic field defined by und_b or und_bx, und_by', 'store_true'],
    ['und_e2b', '', '', 'estimate undulator field amplitude (in [T]) for the photon energy defined by w_e', 'store_true'],
    ['und_per', 'f', 0.02, 'undulator period [m]'],
    ['und_len', 'f', 3.0, 'undulator length [m]'],
    ['und_zc', 'f', 1.25, 'undulator center longitudinal position [m]'],
    ['und_sx', 'i', 1, 'undulator horizontal magnetic field symmetry vs longitudinal position'],
    ['und_sy', 'i', -1, 'undulator vertical magnetic field symmetry vs longitudinal position'],
    ['und_g', 'f', 6.72, 'undulator gap [mm] (assumes availability of magnetic measurement or simulation data)'],
    ['und_ph', 'f', 0.0, 'shift of magnet arrays [mm] for which the field should be set up'],
    ['und_mdir', 's', '', 'name of magnetic measurements sub-folder'],
    ['und_mfs', 's', '', 'name of magnetic measurements for different gaps summary file'],


#---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    ['tr_cti', 'f', 0.0, 'initial time moment (c*t) for electron trajectory calculation [m]'],
    ['tr_ctf', 'f', 0.0, 'final time moment (c*t) for electron trajectory calculation [m]'],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    ['tr_mag', 'i', 1, 'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'],
    ['tr_fn', 's', 'res_trj.dat', 'file name for saving calculated trajectory data'],
    ['tr_pl', 's', '', 'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'],

    #Single-Electron Spectrum vs Photon Energy
    ['ss', '', '', 'calculate single-e spectrum vs photon energy', 'store_true'],
    ['ss_ei', 'f', 100.0, 'initial photon energy [eV] for single-e spectrum vs photon energy calculation'],
    ['ss_ef', 'f', 20000.0, 'final photon energy [eV] for single-e spectrum vs photon energy calculation'],
    ['ss_ne', 'i', 10000, 'number of points vs photon energy for single-e spectrum vs photon energy calculation'],
    ['ss_x', 'f', 0.0, 'horizontal position [m] for single-e spectrum vs photon energy calculation'],
    ['ss_y', 'f', 0.0, 'vertical position [m] for single-e spectrum vs photon energy calculation'],
    ['ss_meth', 'i', 1, 'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'],
    ['ss_prec', 'f', 0.01, 'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'],
    ['ss_pol', 'i', 6, 'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['ss_mag', 'i', 1, 'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'],
    ['ss_ft', 's', 'f', 'presentation/domain: "f"- frequency (photon energy), "t"- time'],
    ['ss_u', 'i', 1, 'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'],
    ['ss_fn', 's', 'res_spec_se.dat', 'file name for saving calculated single-e spectrum vs photon energy'],
    ['ss_pl', 's', '', 'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    ['sm', '', '', 'calculate multi-e spectrum vs photon energy', 'store_true'],
    ['sm_ei', 'f', 100.0, 'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'],
    ['sm_ef', 'f', 20000.0, 'final photon energy [eV] for multi-e spectrum vs photon energy calculation'],
    ['sm_ne', 'i', 10000, 'number of points vs photon energy for multi-e spectrum vs photon energy calculation'],
    ['sm_x', 'f', 0.0, 'horizontal center position [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_rx', 'f', 0.001, 'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_nx', 'i', 1, 'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'],
    ['sm_y', 'f', 0.0, 'vertical center position [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_ry', 'f', 0.001, 'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_ny', 'i', 1, 'number of points vs vertical position for multi-e spectrum vs photon energy calculation'],
    ['sm_mag', 'i', 1, 'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'],
    ['sm_hi', 'i', 1, 'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'],
    ['sm_hf', 'i', 15, 'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'],
    ['sm_prl', 'f', 1.0, 'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'],
    ['sm_pra', 'f', 1.0, 'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'],
    ['sm_meth', 'i', -1, 'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'],
    ['sm_prec', 'f', 0.01, 'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'],
    ['sm_nm', 'i', 1, 'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'],
    ['sm_na', 'i', 5, 'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'],
    ['sm_ns', 'i', 5, 'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    ['sm_pol', 'i', 6, 'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['sm_rm', 'i', 1, 'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'],
    ['sm_fn', 's', 'res_spec_me.dat', 'file name for saving calculated milti-e spectrum vs photon energy'],
    ['sm_pl', 's', '', 'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    ['pw_x', 'f', 0.0, 'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_rx', 'f', 0.015, 'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_nx', 'i', 100, 'number of points vs horizontal position for calculation of power density distribution'],
    ['pw_y', 'f', 0.0, 'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_ry', 'f', 0.015, 'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_ny', 'i', 100, 'number of points vs vertical position for calculation of power density distribution'],
    ['pw_pr', 'f', 1.0, 'precision factor for calculation of power density distribution'],
    ['pw_meth', 'i', 1, 'power density computation method (1- "near field", 2- "far field")'],
    ['pw_zst', 'f', 0., 'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'],
    ['pw_zfi', 'f', 0., 'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'],
    ['pw_mag', 'i', 1, 'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'],
    ['pw_fn', 's', 'res_pow.dat', 'file name for saving calculated power density distribution'],
    ['pw_pl', 's', '', 'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    ['si', '', '', 'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position', 'store_true'],
    #Single-Electron Wavefront Propagation
    ['ws', '', '', 'calculate single-electron (/ fully coherent) wavefront propagation', 'store_true'],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    ['wm', '', '', 'calculate multi-electron (/ partially coherent) wavefront propagation', 'store_true'],

    ['w_e', 'f', 8500.63, 'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ef', 'f', -1.0, 'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ne', 'i', 1, 'number of points vs photon energy for calculation of intensity distribution'],
    ['w_x', 'f', 0.0, 'central horizontal position [m] for calculation of intensity distribution'],
    ['w_rx', 'f', 0.0008, 'range of horizontal position [m] for calculation of intensity distribution'],
    ['w_nx', 'i', 100, 'number of points vs horizontal position for calculation of intensity distribution'],
    ['w_y', 'f', 0.0, 'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ry', 'f', 0.0007, 'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ny', 'i', 100, 'number of points vs vertical position for calculation of intensity distribution'],
    ['w_smpf', 'f', 0.7, 'sampling factor for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_meth', 'i', 1, 'method to use for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_prec', 'f', 0.01, 'relative precision for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_u', 'i', 1, 'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'],
    ['si_pol', 'i', 6, 'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['si_type', 'i', 0, 'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'],
    ['w_mag', 'i', 1, 'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'],

    ['si_fn', 's', 'res_int_se.dat', 'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'],
    ['si_pl', 's', '', 'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],
    ['ws_fni', 's', 'res_int_pr_se.dat', 'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'],
    ['ws_pl', 's', '', 'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],

    ['wm_nm', 'i', 100000, 'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'],
    ['wm_na', 'i', 5, 'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'],
    ['wm_ns', 'i', 5, 'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'],
    ['wm_ch', 'i', 0, 'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y'],
    ['wm_ap', 'i', 0, 'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'],
    ['wm_x0', 'f', 0, 'horizontal center position for mutual intensity cut calculation'],
    ['wm_y0', 'f', 0, 'vertical center position for mutual intensity cut calculation'],
    ['wm_ei', 'i', 0, 'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'],
    ['wm_rm', 'i', 1, 'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'],
    ['wm_am', 'i', 0, 'multi-electron integration approximation method: 0- no approximation (use the standard 5D integration method), 1- integrate numerically only over e-beam energy spread and use convolution to treat transverse emittance'],
    ['wm_fni', 's', 'res_int_pr_me.dat', 'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'],

    #to add options
    ['op_r', 'f', 20.0, 'longitudinal position of the first optical element [m]'],

    # Former appParam:
    ['source_type', 's', 'u', 'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'],

#---Beamline optics:
    # CRL: crl
    ['op_CRL_foc_plane', 'f', 2, 'focalPlane'],
    ['op_CRL_delta', 'f', 4.716943e-06, 'refractiveIndex'],
    ['op_CRL_atten_len', 'f', 0.006257, 'attenuationLength'],
    ['op_CRL_shape', 'f', 1, 'shape'],
    ['op_CRL_apert_h', 'f', 0.001, 'horizontalApertureSize'],
    ['op_CRL_apert_v', 'f', 0.001, 'verticalApertureSize'],
    ['op_CRL_r_min', 'f', 0.0005, 'tipRadius'],
    ['op_CRL_wall_thick', 'f', 8e-05, 'tipWallThickness'],
    ['op_CRL_x', 'f', 0.0, 'horizontalOffset'],
    ['op_CRL_y', 'f', 0.0, 'verticalOffset'],
    ['op_CRL_n', 'i', 3, 'numberOfLenses'],

    # CRL_Watchpoint: drift
    ['op_CRL_Watchpoint_L', 'f', 34.1915, 'length'],

    # Fiber: fiber
    ['op_Fiber_foc_plane', 'f', 2, 'focalPlane'],
    ['op_Fiber_delta_ext', 'f', 6.228746e-06, 'externalRefractiveIndex'],
    ['op_Fiber_delta_core', 'f', 4.129923e-05, 'coreRefractiveIndex'],
    ['op_Fiber_atten_len_ext', 'f', 0.002412, 'externalAttenuationLength'],
    ['op_Fiber_atten_len_core', 'f', 3.63751e-06, 'coreAttenuationLength'],
    ['op_Fiber_externalDiameter', 'f', 0.0001, 'externalDiameter'],
    ['op_Fiber_diam_core', 'f', 1e-05, 'coreDiameter'],
    ['op_Fiber_xc', 'f', 0.0, 'horizontalCenterPosition'],
    ['op_Fiber_yc', 'f', 0.0, 'verticalCenterPosition'],

    # Fiber_Watchpoint2: drift
    ['op_Fiber_Watchpoint2_L', 'f', 0.6585, 'length'],

#---Propagation parameters
    ['op_CRL_pp', 'f',               [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], 'CRL'],
    ['op_CRL_Watchpoint_pp', 'f',    [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], 'CRL_Watchpoint'],
    ['op_Fiber_pp', 'f',             [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], 'Fiber'],
    ['op_Fiber_Watchpoint2_pp', 'f', [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], 'Fiber_Watchpoint2'],
    ['op_fin_pp', 'f',               [0, 0, 1.0, 0, 0, 0.7, 2.0, 0.2, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 'final post-propagation (resize) parameters'],

    #[ 0]: Auto-Resize (1) or not (0) Before propagation
    #[ 1]: Auto-Resize (1) or not (0) After propagation
    #[ 2]: Relative Precision for propagation with Auto-Resizing (1. is nominal)
    #[ 3]: Allow (1) or not (0) for semi-analytical treatment of the quadratic (leading) phase terms at the propagation
    #[ 4]: Do any Resizing on Fourier side, using FFT, (1) or not (0)
    #[ 5]: Horizontal Range modification factor at Resizing (1. means no modification)
    #[ 6]: Horizontal Resolution modification factor at Resizing
    #[ 7]: Vertical Range modification factor at Resizing
    #[ 8]: Vertical Resolution modification factor at Resizing
    #[ 9]: Type of wavefront Shift before Resizing (not yet implemented)
    #[10]: New Horizontal wavefront Center position after Shift (not yet implemented)
    #[11]: New Vertical wavefront Center position after Shift (not yet implemented)
    #[12]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Horizontal Coordinate
    #[13]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Vertical Coordinate
    #[14]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Longitudinal Coordinate
    #[15]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Horizontal Coordinate
    #[16]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Vertical Coordinate
])
Exemple #12
0
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'NSLS-II ESM beamline', 'simulation name'],

    #---Data Folder
    [
        'fdir', 's', '',
        'folder (directory) name for reading-in input and saving output data files'
    ],

    #---Electron Beam
    ['ebm_nm', 's', '', 'standard electron beam name'],
    [
        'ebm_nms', 's', '',
        'standard electron beam name suffix: e.g. can be Day1, Final'
    ],
    ['ebm_i', 'f', 0.5, 'electron beam current [A]'],
    ['ebm_e', 'f', 3.0, 'electron beam avarage energy [GeV]'],
    ['ebm_de', 'f', 0.0, 'electron beam average energy deviation [GeV]'],
    [
        'ebm_x', 'f', 0.0,
        'electron beam initial average horizontal position [m]'
    ],
    ['ebm_y', 'f', 0.0, 'electron beam initial average vertical position [m]'],
    [
        'ebm_xp', 'f', 0.0,
        'electron beam initial average horizontal angle [rad]'
    ],
    ['ebm_yp', 'f', 0.0, 'electron beam initial average vertical angle [rad]'],
    [
        'ebm_z', 'f', 0.,
        'electron beam initial average longitudinal position [m]'
    ],
    [
        'ebm_dr', 'f', -1.8667500000000001,
        'electron beam longitudinal drift [m] to be performed before a required calculation'
    ],
    ['ebm_ens', 'f', 0.00089, 'electron beam relative energy spread'],
    [
        'ebm_emx', 'f', 5.500000000000001e-10,
        'electron beam horizontal emittance [m]'
    ],
    ['ebm_emy', 'f', 8e-12, 'electron beam vertical emittance [m]'],
    # Definition of the beam through Twiss:
    ['ebm_betax', 'f', 2.02, 'horizontal beta-function [m]'],
    ['ebm_betay', 'f', 1.06, 'vertical beta-function [m]'],
    ['ebm_alphax', 'f', 0.0, 'horizontal alpha-function [rad]'],
    ['ebm_alphay', 'f', 0.0, 'vertical alpha-function [rad]'],
    ['ebm_etax', 'f', 0.0, 'horizontal dispersion function [m]'],
    ['ebm_etay', 'f', 0.0, 'vertical dispersion function [m]'],
    ['ebm_etaxp', 'f', 0.0, 'horizontal dispersion function derivative [rad]'],
    ['ebm_etayp', 'f', 0.0, 'vertical dispersion function derivative [rad]'],

    #---Undulator
    ['und_bx', 'f', 0.0, 'undulator horizontal peak magnetic field [T]'],
    ['und_by', 'f', 0.187782, 'undulator vertical peak magnetic field [T]'],
    [
        'und_phx', 'f', 0.0,
        'initial phase of the horizontal magnetic field [rad]'
    ],
    [
        'und_phy', 'f', 0.0,
        'initial phase of the vertical magnetic field [rad]'
    ],
    [
        'und_b2e', '', '',
        'estimate undulator fundamental photon energy (in [eV]) for the amplitude of sinusoidal magnetic field defined by und_b or und_bx, und_by',
        'store_true'
    ],
    [
        'und_e2b', '', '',
        'estimate undulator field amplitude (in [T]) for the photon energy defined by w_e',
        'store_true'
    ],
    ['und_per', 'f', 0.057, 'undulator period [m]'],
    ['und_len', 'f', 3.5055, 'undulator length [m]'],
    ['und_zc', 'f', 0.0, 'undulator center longitudinal position [m]'],
    [
        'und_sx', 'i', 1,
        'undulator horizontal magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_sy', 'i', 1,
        'undulator vertical magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_g', 'f', 6.72,
        'undulator gap [mm] (assumes availability of magnetic measurement or simulation data)'
    ],
    [
        'und_ph', 'f', 0.0,
        'shift of magnet arrays [mm] for which the field should be set up'
    ],
    ['und_mdir', 's', '', 'name of magnetic measurements sub-folder'],
    [
        'und_mfs', 's', '',
        'name of magnetic measurements for different gaps summary file'
    ],

    #---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    [
        'tr_cti', 'f', 0.0,
        'initial time moment (c*t) for electron trajectory calculation [m]'
    ],
    [
        'tr_ctf', 'f', 0.0,
        'final time moment (c*t) for electron trajectory calculation [m]'
    ],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    [
        'tr_mag', 'i', 1,
        'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'
    ],
    [
        'tr_fn', 's', 'res_trj.dat',
        'file name for saving calculated trajectory data'
    ],
    [
        'tr_pl', 's', '',
        'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'
    ],

    #Single-Electron Spectrum vs Photon Energy
    [
        'ss', '', '', 'calculate single-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'ss_ei', 'f', 100.0,
        'initial photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ef', 'f', 20000.0,
        'final photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ne', 'i', 10000,
        'number of points vs photon energy for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_x', 'f', 0.0,
        'horizontal position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_y', 'f', 0.0,
        'vertical position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_meth', 'i', 1,
        'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'ss_prec', 'f', 0.01,
        'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'
    ],
    [
        'ss_pol', 'i', 6,
        'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'ss_mag', 'i', 1,
        'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'
    ],
    [
        'ss_ft', 's', 'f',
        'presentation/domain: "f"- frequency (photon energy), "t"- time'
    ],
    [
        'ss_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'ss_fn', 's', 'res_spec_se.dat',
        'file name for saving calculated single-e spectrum vs photon energy'
    ],
    [
        'ss_pl', 's', '',
        'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    [
        'sm', '', '', 'calculate multi-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'sm_ei', 'f', 100.0,
        'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ef', 'f', 20000.0,
        'final photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ne', 'i', 10000,
        'number of points vs photon energy for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_x', 'f', 0.0,
        'horizontal center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_rx', 'f', 0.001,
        'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_nx', 'i', 1,
        'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_y', 'f', 0.0,
        'vertical center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ry', 'f', 0.001,
        'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ny', 'i', 1,
        'number of points vs vertical position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_mag', 'i', 1,
        'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'
    ],
    [
        'sm_hi', 'i', 1,
        'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_hf', 'i', 15,
        'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_prl', 'f', 1.0,
        'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_pra', 'f', 1.0,
        'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_meth', 'i', -1,
        'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'
    ],
    [
        'sm_prec', 'f', 0.01,
        'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'
    ],
    [
        'sm_nm', 'i', 1,
        'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_na', 'i', 5,
        'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'
    ],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    [
        'sm_pol', 'i', 6,
        'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'sm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'sm_fn', 's', 'res_spec_me.dat',
        'file name for saving calculated milti-e spectrum vs photon energy'
    ],
    [
        'sm_pl', 's', '',
        'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    [
        'pw_x', 'f', 0.0,
        'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_rx', 'f', 0.015,
        'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_nx', 'i', 100,
        'number of points vs horizontal position for calculation of power density distribution'
    ],
    [
        'pw_y', 'f', 0.0,
        'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ry', 'f', 0.015,
        'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ny', 'i', 100,
        'number of points vs vertical position for calculation of power density distribution'
    ],
    [
        'pw_pr', 'f', 1.0,
        'precision factor for calculation of power density distribution'
    ],
    [
        'pw_meth', 'i', 1,
        'power density computation method (1- "near field", 2- "far field")'
    ],
    [
        'pw_zst', 'f', 0.,
        'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_zfi', 'f', 0.,
        'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_mag', 'i', 1,
        'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'
    ],
    [
        'pw_fn', 's', 'res_pow.dat',
        'file name for saving calculated power density distribution'
    ],
    [
        'pw_pl', 's', '',
        'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    [
        'si', '', '',
        'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position',
        'store_true'
    ],
    #Single-Electron Wavefront Propagation
    [
        'ws', '', '',
        'calculate single-electron (/ fully coherent) wavefront propagation',
        'store_true'
    ],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    [
        'wm', '', '',
        'calculate multi-electron (/ partially coherent) wavefront propagation',
        'store_true'
    ],
    [
        'w_e', 'f', 1000.0,
        'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ef', 'f', -1.0,
        'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ne', 'i', 1,
        'number of points vs photon energy for calculation of intensity distribution'
    ],
    [
        'w_x', 'f', 0.0,
        'central horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_rx', 'f', 0.002,
        'range of horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_nx', 'i', 100,
        'number of points vs horizontal position for calculation of intensity distribution'
    ],
    [
        'w_y', 'f', 0.0,
        'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ry', 'f', 0.002,
        'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ny', 'i', 100,
        'number of points vs vertical position for calculation of intensity distribution'
    ],
    [
        'w_smpf', 'f', 1.0,
        'sampling factor for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_meth', 'i', 1,
        'method to use for calculation of intensity distribution vs horizontal and vertical position: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'w_prec', 'f', 0.01,
        'relative precision for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'si_pol', 'i', 6,
        'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'si_type', 'i', 0,
        'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'
    ],
    [
        'w_mag', 'i', 1,
        'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'
    ],
    [
        'si_fn', 's', 'res_int_se.dat',
        'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'
    ],
    [
        'si_pl', 's', '',
        'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'ws_fni', 's', 'res_int_pr_se.dat',
        'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'
    ],
    [
        'ws_pl', 's', '',
        'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'wm_nm', 'i', 100000,
        'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_na', 'i', 5,
        'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'
    ],
    [
        'wm_ch', 'i', 0,
        'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y; 40- intensity(s0), mutual intensity cuts and degree of coherence vs X & Y'
    ],
    [
        'wm_ap', 'i', 0,
        'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'
    ],
    [
        'wm_x0', 'f', 0.0,
        'horizontal center position for mutual intensity cut calculation'
    ],
    [
        'wm_y0', 'f', 0.0,
        'vertical center position for mutual intensity cut calculation'
    ],
    [
        'wm_ei', 'i', 0,
        'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'
    ],
    [
        'wm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'wm_am', 'i', 0,
        'multi-electron integration approximation method: 0- no approximation (use the standard 5D integration method), 1- integrate numerically only over e-beam energy spread and use convolution to treat transverse emittance'
    ],
    [
        'wm_fni', 's', 'res_int_pr_me.dat',
        'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'
    ],
    [
        'wm_fbk', '', '',
        'create backup file(s) with propagated multi-e intensity distribution vs horizontal and vertical position and other radiation characteristics',
        'store_true'
    ],

    #to add options
    [
        'op_r', 'f', 34.366,
        'longitudinal position of the first optical element [m]'
    ],
    # Former appParam:
    [
        'rs_type', 's', 'u',
        'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'
    ],

    #---Beamline optics:
    # M1: mirror
    [
        'op_M1_hfn', 's', 'configurations/esm_mirror_1d.dat',
        'heightProfileFile'
    ],
    ['op_M1_dim', 's', 'x', 'orientation'],
    ['op_M1_ang', 'f', 0.043633200000000004, 'grazingAngle'],
    ['op_M1_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_M1_size_x', 'f', 0.001, 'horizontalTransverseSize'],
    ['op_M1_size_y', 'f', 0.001, 'verticalTransverseSize'],

    # M1_Grating: drift
    ['op_M1_Grating_L', 'f', 20.634, 'length'],

    # Grating: grating
    ['op_Grating_hfn', 's', '', 'heightProfileFile'],
    ['op_Grating_dim', 's', 'y', 'orientation'],
    ['op_Grating_size_tang', 'f', 0.2, 'tangentialSize'],
    ['op_Grating_size_sag', 'f', 0.015, 'sagittalSize'],
    ['op_Grating_nvx', 'f', 0.0, 'nvx'],
    ['op_Grating_nvy', 'f', 0.9999160776602402, 'nvy'],
    ['op_Grating_nvz', 'f', -0.012955216577139016, 'nvz'],
    ['op_Grating_tvx', 'f', 0.0, 'tvx'],
    ['op_Grating_tvy', 'f', 0.012955216577139016, 'tvy'],
    ['op_Grating_x', 'f', 0.0, 'horizontalOffset'],
    ['op_Grating_y', 'f', 0.0, 'verticalOffset'],
    ['op_Grating_m', 'f', 1.0, 'diffractionOrder'],
    ['op_Grating_grDen', 'f', 1800.0, 'grooveDensity0'],
    ['op_Grating_grDen1', 'f', 0.08997, 'grooveDensity1'],
    ['op_Grating_grDen2', 'f', 3.004e-06, 'grooveDensity2'],
    ['op_Grating_grDen3', 'f', 9.73e-11, 'grooveDensity3'],
    ['op_Grating_grDen4', 'f', 0.0, 'grooveDensity4'],
    ['op_Grating_e_avg', 'f', 1000.0, 'energyAvg'],
    ['op_Grating_cff', 'f', 5.249936863206202, 'cff'],
    ['op_Grating_ang', 'f', 0.012955579, 'grazingAngle'],
    ['op_Grating_rollAngle', 'f', 0.0, 'rollAngle'],
    ['op_Grating_outoptvx', 'f', 0.0, 'outoptvx'],
    ['op_Grating_outoptvy', 'f', 0.08093357816613847, 'outoptvy'],
    ['op_Grating_outoptvz', 'f', 0.996719497113017, 'outoptvz'],
    ['op_Grating_outframevx', 'f', 1.0, 'outframevx'],
    ['op_Grating_outframevy', 'f', 0.0, 'outframevy'],
    ['op_Grating_computeParametersFrom', 'f', 2, 'computeParametersFrom'],
    ['op_Grating_amp_coef', 'f', 0.001, 'heightAmplification'],

    # GA: aperture
    ['op_GA_shape', 's', 'r', 'shape'],
    ['op_GA_Dx', 'f', 0.015, 'horizontalSize'],
    ['op_GA_Dy', 'f', 0.0025910433154276145, 'verticalSize'],
    ['op_GA_x', 'f', 0.0, 'horizontalOffset'],
    ['op_GA_y', 'f', 0.0, 'verticalOffset'],

    # GA_M3A: drift
    ['op_GA_M3A_L', 'f', 34.629999999999995, 'length'],

    # M3A: aperture
    ['op_M3A_shape', 's', 'r', 'shape'],
    ['op_M3A_Dx', 'f', 0.018320129560012673, 'horizontalSize'],
    ['op_M3A_Dy', 'f', 0.02, 'verticalSize'],
    ['op_M3A_x', 'f', 0.0, 'horizontalOffset'],
    ['op_M3A_y', 'f', 0.0, 'verticalOffset'],

    # M3: ellipsoidMirror
    ['op_M3_hfn', 's', 'None', 'heightProfileFile'],
    ['op_M3_dim', 's', 'x', 'orientation'],
    ['op_M3_p', 'f', 89.63, 'firstFocusLength'],
    ['op_M3_q', 'f', 8.006, 'focalLength'],
    ['op_M3_ang', 'f', 0.043633200000000004, 'grazingAngle'],
    ['op_M3_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_M3_size_tang', 'f', 0.42, 'tangentialSize'],
    ['op_M3_size_sag', 'f', 0.02, 'sagittalSize'],
    ['op_M3_nvx', 'f', 0.9990482229471379, 'normalVectorX'],
    ['op_M3_nvy', 'f', 0.0, 'normalVectorY'],
    ['op_M3_nvz', 'f', -0.04361935609526827, 'normalVectorZ'],
    ['op_M3_tvx', 'f', -0.04361935609526827, 'tangentialVectorX'],
    ['op_M3_tvy', 'f', 0.0, 'tangentialVectorY'],
    ['op_M3_x', 'f', 0.0, 'horizontalOffset'],
    ['op_M3_y', 'f', 0.0, 'verticalOffset'],

    # M3_SSA: drift
    ['op_M3_SSA_L', 'f', 8.006, 'length'],

    # SSA: aperture
    ['op_SSA_shape', 's', 'r', 'shape'],
    ['op_SSA_Dx', 'f', 0.0015, 'horizontalSize'],
    ['op_SSA_Dy', 'f', 0.0015, 'verticalSize'],
    ['op_SSA_x', 'f', 0.0, 'horizontalOffset'],
    ['op_SSA_y', 'f', 0.0, 'verticalOffset'],

    # SSA_KBAperture: drift
    ['op_SSA_KBAperture_L', 'f', 6.010000000000005, 'length'],

    # KBAperture: aperture
    ['op_KBAperture_shape', 's', 'r', 'shape'],
    ['op_KBAperture_Dx', 'f', 0.01308580682858048, 'horizontalSize'],
    ['op_KBAperture_Dy', 'f', 0.003, 'verticalSize'],
    ['op_KBAperture_x', 'f', 0.0, 'horizontalOffset'],
    ['op_KBAperture_y', 'f', 0.0, 'verticalOffset'],

    # KBh: ellipsoidMirror
    ['op_KBh_hfn', 's', 'None', 'heightProfileFile'],
    ['op_KBh_dim', 's', 'x', 'orientation'],
    ['op_KBh_p', 'f', 6.01, 'firstFocusLength'],
    ['op_KBh_q', 'f', 0.911, 'focalLength'],
    ['op_KBh_ang', 'f', 0.0872665, 'grazingAngle'],
    ['op_KBh_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_KBh_size_tang', 'f', 0.3, 'tangentialSize'],
    ['op_KBh_size_sag', 'f', 0.05, 'sagittalSize'],
    ['op_KBh_nvx', 'f', 0.9961946948320953, 'normalVectorX'],
    ['op_KBh_nvy', 'f', 0.0, 'normalVectorY'],
    ['op_KBh_nvz', 'f', -0.08715578000562225, 'normalVectorZ'],
    ['op_KBh_tvx', 'f', -0.08715578000562225, 'tangentialVectorX'],
    ['op_KBh_tvy', 'f', 0.0, 'tangentialVectorY'],
    ['op_KBh_x', 'f', 0.0, 'horizontalOffset'],
    ['op_KBh_y', 'f', 0.0, 'verticalOffset'],

    # KBh_KBv: drift
    ['op_KBh_KBv_L', 'f', 0.5, 'length'],

    # KBv: ellipsoidMirror
    ['op_KBv_hfn', 's', 'None', 'heightProfileFile'],
    ['op_KBv_dim', 's', 'x', 'orientation'],
    ['op_KBv_p', 'f', 6.51, 'firstFocusLength'],
    ['op_KBv_q', 'f', 0.411, 'focalLength'],
    ['op_KBv_ang', 'f', 0.0872665, 'grazingAngle'],
    ['op_KBv_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_KBv_size_tang', 'f', 0.3, 'tangentialSize'],
    ['op_KBv_size_sag', 'f', 0.05, 'sagittalSize'],
    ['op_KBv_nvx', 'f', 0.0, 'normalVectorX'],
    ['op_KBv_nvy', 'f', 0.9961946948320953, 'normalVectorY'],
    ['op_KBv_nvz', 'f', -0.08715578000562225, 'normalVectorZ'],
    ['op_KBv_tvx', 'f', 0.0, 'tangentialVectorX'],
    ['op_KBv_tvy', 'f', -0.08715578000562225, 'tangentialVectorY'],
    ['op_KBv_x', 'f', 0.0, 'horizontalOffset'],
    ['op_KBv_y', 'f', 0.0, 'verticalOffset'],

    # KBv_Sample: drift
    ['op_KBv_Sample_L', 'f', 0.41100000000000136, 'length'],

    #---Propagation parameters
    [
        'op_M1_pp', 'f',
        [
            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
        ], 'M1'
    ],
    [
        'op_M1_Grating_pp', 'f',
        [
            0, 0, 1.0, 1, 0, 1.5, 1.75, 2.75, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0, 0.0
        ], 'M1_Grating'
    ],
    [
        'op_Grating_pp', 'f',
        [
            0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0,
            0.08093357816613847, 0.996719497113017, 1.0, 0.0
        ], 'Grating'
    ],
    [
        'op_GA_pp', 'f',
        [
            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'
    ],
    [
        'op_GA_M3A_pp', 'f',
        [
            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
        ], 'GA_M3A'
    ],
    [
        'op_M3A_pp', 'f',
        [
            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
        ], 'M3A'
    ],
    [
        'op_M3_pp', 'f',
        [
            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'
    ],
    [
        'op_M3_SSA_pp', 'f',
        [
            0, 0, 1.0, 1, 0, 1.5, 1.0, 2.5, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0
        ], 'M3_SSA'
    ],
    [
        'op_SSA_pp', 'f',
        [
            0, 0, 1.0, 0, 0, 1.5, 1.0, 2.5, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0
        ], 'SSA'
    ],
    [
        'op_SSA_KBAperture_pp', 'f',
        [
            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
        ], 'SSA_KBAperture'
    ],
    [
        'op_KBAperture_pp', 'f',
        [
            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
        ], 'KBAperture'
    ],
    [
        'op_KBh_pp', 'f',
        [
            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'
    ],
    [
        'op_KBh_KBv_pp', 'f',
        [
            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
        ], 'KBh_KBv'
    ],
    [
        'op_KBv_pp', 'f',
        [
            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
        ], 'KBv'
    ],
    [
        'op_KBv_Sample_pp', 'f',
        [
            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
        ], 'KBv_Sample'
    ],
    [
        'op_fin_pp', 'f',
        [
            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
        ], 'final post-propagation (resize) parameters'
    ],
    ['op_rv', 'f', [5], "Multi-Output."]
    #[ 0]: Auto-Resize (1) or not (0) Before propagation
    #[ 1]: Auto-Resize (1) or not (0) After propagation
    #[ 2]: Relative Precision for propagation with Auto-Resizing (1. is nominal)
    #[ 3]: Allow (1) or not (0) for semi-analytical treatment of the quadratic (leading) phase terms at the propagation
    #[ 4]: Do any Resizing on Fourier side, using FFT, (1) or not (0)
    #[ 5]: Horizontal Range modification factor at Resizing (1. means no modification)
    #[ 6]: Horizontal Resolution modification factor at Resizing
    #[ 7]: Vertical Range modification factor at Resizing
    #[ 8]: Vertical Resolution modification factor at Resizing
    #[ 9]: Type of wavefront Shift before Resizing (not yet implemented)
    #[10]: New Horizontal wavefront Center position after Shift (not yet implemented)
    #[11]: New Vertical wavefront Center position after Shift (not yet implemented)
    #[12]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Horizontal Coordinate
    #[13]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Vertical Coordinate
    #[14]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Longitudinal Coordinate
    #[15]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Horizontal Coordinate
    #[16]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Vertical Coordinate
])
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'SXN_V02_250eV_realZP debug', 'simulation name'],

    #---Data Folder
    [
        'fdir', 's', '',
        'folder (directory) name for reading-in input and saving output data files'
    ],

    #---Electron Beam
    ['ebm_nm', 's', '', 'standard electron beam name'],
    [
        'ebm_nms', 's', '',
        'standard electron beam name suffix: e.g. can be Day1, Final'
    ],
    ['ebm_i', 'f', 0.5, 'electron beam current [A]'],
    ['ebm_e', 'f', 3.0, 'electron beam avarage energy [GeV]'],
    ['ebm_de', 'f', 0.0, 'electron beam average energy deviation [GeV]'],
    [
        'ebm_x', 'f', 0.0,
        'electron beam initial average horizontal position [m]'
    ],
    ['ebm_y', 'f', 0.0, 'electron beam initial average vertical position [m]'],
    [
        'ebm_xp', 'f', 0.0,
        'electron beam initial average horizontal angle [rad]'
    ],
    ['ebm_yp', 'f', 0.0, 'electron beam initial average vertical angle [rad]'],
    [
        'ebm_z', 'f', 0.,
        'electron beam initial average longitudinal position [m]'
    ],
    [
        'ebm_dr', 'f', 0.0,
        'electron beam longitudinal drift [m] to be performed before a required calculation'
    ],
    ['ebm_ens', 'f', 0.00089, 'electron beam relative energy spread'],
    ['ebm_emx', 'f', 7.6e-10, 'electron beam horizontal emittance [m]'],
    ['ebm_emy', 'f', 8e-12, 'electron beam vertical emittance [m]'],
    # Definition of the beam through Moments:
    [
        'ebm_sigx', 'f', 3.73951868561e-05,
        'horizontal RMS size of electron beam [m]'
    ],
    [
        'ebm_sigy', 'f', 3.05941170816e-06,
        'vertical RMS size of electron beam [m]'
    ],
    [
        'ebm_sigxp', 'f', 2.03234711174e-05,
        'horizontal RMS angular divergence of electron beam [rad]'
    ],
    [
        'ebm_sigyp', 'f', 2.61488180184e-06,
        'vertical RMS angular divergence of electron beam [rad]'
    ],
    [
        'ebm_mxxp', 'f', 0.0,
        'horizontal position-angle mixed 2nd order moment of electron beam [m]'
    ],
    [
        'ebm_myyp', 'f', 0.0,
        'vertical position-angle mixed 2nd order moment of electron beam [m]'
    ],

    #---Undulator
    ['und_bx', 'f', 0.0, 'undulator horizontal peak magnetic field [T]'],
    ['und_by', 'f', 0.72799921, 'undulator vertical peak magnetic field [T]'],
    [
        'und_phx', 'f', 0.0,
        'initial phase of the horizontal magnetic field [rad]'
    ],
    [
        'und_phy', 'f', 0.0,
        'initial phase of the vertical magnetic field [rad]'
    ],
    [
        'und_b2e', '', '',
        'estimate undulator fundamental photon energy (in [eV]) for the amplitude of sinusoidal magnetic field defined by und_b or und_bx, und_by',
        'store_true'
    ],
    [
        'und_e2b', '', '',
        'estimate undulator field amplitude (in [T]) for the photon energy defined by w_e',
        'store_true'
    ],
    ['und_per', 'f', 0.05, 'undulator period [m]'],
    ['und_len', 'f', 2.0, 'undulator length [m]'],
    ['und_zc', 'f', 1.25, 'undulator center longitudinal position [m]'],
    [
        'und_sx', 'i', -1,
        'undulator horizontal magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_sy', 'i', 1,
        'undulator vertical magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_g', 'f', 6.72,
        'undulator gap [mm] (assumes availability of magnetic measurement or simulation data)'
    ],
    [
        'und_ph', 'f', 0.0,
        'shift of magnet arrays [mm] for which the field should be set up'
    ],
    ['und_mdir', 's', '', 'name of magnetic measurements sub-folder'],
    [
        'und_mfs', 's', '',
        'name of magnetic measurements for different gaps summary file'
    ],

    #---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    [
        'tr_cti', 'f', 0.0,
        'initial time moment (c*t) for electron trajectory calculation [m]'
    ],
    [
        'tr_ctf', 'f', 0.0,
        'final time moment (c*t) for electron trajectory calculation [m]'
    ],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    [
        'tr_mag', 'i', 1,
        'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'
    ],
    [
        'tr_fn', 's', 'res_trj.dat',
        'file name for saving calculated trajectory data'
    ],
    [
        'tr_pl', 's', '',
        'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'
    ],

    #Single-Electron Spectrum vs Photon Energy
    [
        'ss', '', '', 'calculate single-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'ss_ei', 'f', 10.0,
        'initial photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ef', 'f', 2100.0,
        'final photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ne', 'i', 2000,
        'number of points vs photon energy for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_x', 'f', 0.0,
        'horizontal position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_y', 'f', 0.0,
        'vertical position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_meth', 'i', 1,
        'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'ss_prec', 'f', 0.01,
        'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'
    ],
    [
        'ss_pol', 'i', 6,
        'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'ss_mag', 'i', 1,
        'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'
    ],
    [
        'ss_ft', 's', 'f',
        'presentation/domain: "f"- frequency (photon energy), "t"- time'
    ],
    [
        'ss_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'ss_fn', 's', 'res_spec_se.dat',
        'file name for saving calculated single-e spectrum vs photon energy'
    ],
    [
        'ss_pl', 's', '',
        'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    [
        'sm', '', '', 'calculate multi-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'sm_ei', 'f', 10.0,
        'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ef', 'f', 2000.0,
        'final photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ne', 'i', 5000,
        'number of points vs photon energy for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_x', 'f', 0.0,
        'horizontal center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_rx', 'f', 0.004,
        'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_nx', 'i', 1,
        'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_y', 'f', 0.0,
        'vertical center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ry', 'f', 0.004,
        'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ny', 'i', 1,
        'number of points vs vertical position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_mag', 'i', 1,
        'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'
    ],
    [
        'sm_hi', 'i', 1,
        'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_hf', 'i', 15,
        'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_prl', 'f', 1.0,
        'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_pra', 'f', 1.0,
        'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_meth', 'i', -1,
        'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'
    ],
    [
        'sm_prec', 'f', 0.01,
        'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'
    ],
    [
        'sm_nm', 'i', 1,
        'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_na', 'i', 5,
        'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'
    ],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    [
        'sm_pol', 'i', 6,
        'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'sm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'sm_fn', 's', 'res_spec_me.dat',
        'file name for saving calculated milti-e spectrum vs photon energy'
    ],
    [
        'sm_pl', 's', '',
        'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    [
        'pw_x', 'f', 0.0,
        'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_rx', 'f', 0.05,
        'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_nx', 'i', 100,
        'number of points vs horizontal position for calculation of power density distribution'
    ],
    [
        'pw_y', 'f', 0.0,
        'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ry', 'f', 0.05,
        'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ny', 'i', 100,
        'number of points vs vertical position for calculation of power density distribution'
    ],
    [
        'pw_pr', 'f', 1.0,
        'precision factor for calculation of power density distribution'
    ],
    [
        'pw_meth', 'i', 1,
        'power density computation method (1- "near field", 2- "far field")'
    ],
    [
        'pw_zst', 'f', 0.,
        'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_zfi', 'f', 0.,
        'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_mag', 'i', 1,
        'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'
    ],
    [
        'pw_fn', 's', 'res_pow.dat',
        'file name for saving calculated power density distribution'
    ],
    [
        'pw_pl', 's', '',
        'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    [
        'si', '', '',
        'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position',
        'store_true'
    ],
    #Single-Electron Wavefront Propagation
    [
        'ws', '', '',
        'calculate single-electron (/ fully coherent) wavefront propagation',
        'store_true'
    ],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    [
        'wm', '', '',
        'calculate multi-electron (/ partially coherent) wavefront propagation',
        'store_true'
    ],
    [
        'w_e', 'f', 250.0,
        'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ef', 'f', -1.0,
        'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ne', 'i', 1,
        'number of points vs photon energy for calculation of intensity distribution'
    ],
    [
        'w_x', 'f', 0.0,
        'central horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_rx', 'f', 0.004,
        'range of horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_nx', 'i', 100,
        'number of points vs horizontal position for calculation of intensity distribution'
    ],
    [
        'w_y', 'f', 0.0,
        'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ry', 'f', 0.004,
        'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ny', 'i', 100,
        'number of points vs vertical position for calculation of intensity distribution'
    ],
    [
        'w_smpf', 'f', 0.3,
        'sampling factor for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_meth', 'i', 1,
        'method to use for calculation of intensity distribution vs horizontal and vertical position: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'w_prec', 'f', 0.01,
        'relative precision for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'si_pol', 'i', 6,
        'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'si_type', 'i', 0,
        'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'
    ],
    [
        'w_mag', 'i', 1,
        'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'
    ],
    [
        'si_fn', 's', 'res_int_se.dat',
        'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'
    ],
    [
        'si_pl', 's', '',
        'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'ws_fni', 's', 'res_int_pr_se.dat',
        'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'
    ],
    [
        'ws_pl', 's', '',
        'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'wm_nm', 'i', 15000,
        'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_na', 'i', 5,
        'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'
    ],
    [
        'wm_ch', 'i', 40,
        'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y; 40- intensity(s0), mutual intensity cuts and degree of coherence vs X & Y'
    ],
    [
        'wm_ap', 'i', 0,
        'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'
    ],
    [
        'wm_x0', 'f', 0,
        'horizontal center position for mutual intensity cut calculation'
    ],
    [
        'wm_y0', 'f', 0,
        'vertical center position for mutual intensity cut calculation'
    ],
    [
        'wm_ei', 'i', 0,
        'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'
    ],
    [
        'wm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'wm_am', 'i', 0,
        'multi-electron integration approximation method: 0- no approximation (use the standard 5D integration method), 1- integrate numerically only over e-beam energy spread and use convolution to treat transverse emittance'
    ],
    [
        'wm_fni', 's', 'res_int_pr_me.dat',
        'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'
    ],

    #to add options
    [
        'op_r', 'f', 20.0,
        'longitudinal position of the first optical element [m]'
    ],

    # Former appParam:
    [
        'rs_type', 's', 'u',
        'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'
    ],

    #---Beamline optics:
    # Fixed_Mask: aperture
    ['op_Fixed_Mask_shape', 's', 'r', 'shape'],
    ['op_Fixed_Mask_Dx', 'f', 0.004, 'horizontalSize'],
    ['op_Fixed_Mask_Dy', 'f', 0.004, 'verticalSize'],
    ['op_Fixed_Mask_x', 'f', 0.0, 'horizontalOffset'],
    ['op_Fixed_Mask_y', 'f', 0.0, 'verticalOffset'],

    # Fixed_Mask_Ap_M1: drift
    ['op_Fixed_Mask_Ap_M1_L', 'f', 7.75, 'length'],

    # Ap_M1: aperture
    ['op_Ap_M1_shape', 's', 'r', 'shape'],
    ['op_Ap_M1_Dx', 'f', 0.005, 'horizontalSize'],
    ['op_Ap_M1_Dy', 'f', 0.005, 'verticalSize'],
    ['op_Ap_M1_x', 'f', 0.0, 'horizontalOffset'],
    ['op_Ap_M1_y', 'f', 0.0, 'verticalOffset'],

    # M1: toroidalMirror
    ['op_M1_hfn', 's', 'None', 'heightProfileFile'],
    ['op_M1_dim', 's', 'x', 'orientation'],
    ['op_M1_ap_shape', 's', 'r', 'apertureShape'],
    ['op_M1_rt', 'f', 1e+23, 'tangentialRadius'],
    ['op_M1_rs', 'f', 1.04058, 'sagittalRadius'],
    ['op_M1_size_tang', 'f', 0.3, 'tangentialSize'],
    ['op_M1_size_sag', 'f', 0.015, 'sagittalSize'],
    ['op_M1_ang', 'f', 0.019635, 'grazingAngle'],
    ['op_M1_horizontalPosition', 'f', 0.0, 'horizontalPosition'],
    ['op_M1_verticalPosition', 'f', 0.0, 'verticalPosition'],
    ['op_M1_nvx', 'f', 0.999807239581, 'normalVectorX'],
    ['op_M1_nvy', 'f', 0.0, 'normalVectorY'],
    ['op_M1_nvz', 'f', -0.0196337383668, 'normalVectorZ'],
    ['op_M1_tvx', 'f', 0.0196337383668, 'tangentialVectorX'],
    ['op_M1_tvy', 'f', 0.0, 'tangentialVectorY'],
    ['op_M1_amp_coef', 'f', 0.0001, 'heightAmplification'],

    # M1_M2: drift
    ['op_M1_M2_L', 'f', 6.0, 'length'],

    # M2: mirror
    ['op_M2_hfn', 's', 'M2err.dat', 'heightProfileFile'],
    ['op_M2_dim', 's', 'y', 'orientation'],
    ['op_M2_ang', 'f', 0.043119085, 'grazingAngle'],
    ['op_M2_amp_coef', 'f', 0.0001, 'heightAmplification'],
    ['op_M2_size_x', 'f', 0.02, 'horizontalTransverseSize'],
    ['op_M2_size_y', 'f', 0.014, 'verticalTransverseSize'],

    # M2_Before_Grating: drift
    ['op_M2_Before_Grating_L', 'f', 0.5, 'length'],

    # Grating: grating
    ['op_Grating_size_tang', 'f', 0.2, 'tangentialSize'],
    ['op_Grating_size_sag', 'f', 0.02, 'sagittalSize'],
    ['op_Grating_nvx', 'f', 0.0, 'normalVectorX'],
    ['op_Grating_nvy', 'f', -0.999405274299, 'normalVectorY'],
    ['op_Grating_nvz', 'f', -0.0344832960142, 'normalVectorZ'],
    ['op_Grating_tvx', 'f', 0.0, 'tangentialVectorX'],
    ['op_Grating_tvy', 'f', -0.0344832960142, 'tangentialVectorY'],
    ['op_Grating_x', 'f', 0.0, 'horizontalOffset'],
    ['op_Grating_y', 'f', 0.0, 'verticalOffset'],
    ['op_Grating_m', 'f', 1.0, 'diffractionOrder'],
    ['op_Grating_grDen', 'f', 150.0, 'grooveDensity0'],
    ['op_Grating_grDen1', 'f', 0.0, 'grooveDensity1'],
    ['op_Grating_grDen2', 'f', 0.0, 'grooveDensity2'],
    ['op_Grating_grDen3', 'f', 0.0, 'grooveDensity3'],
    ['op_Grating_grDen4', 'f', 0.0, 'grooveDensity4'],

    # Gr_Surf_Height_Err_Before_M3: drift
    ['op_Gr_Surf_Height_Err_Before_M3_L', 'f', 2.5, 'length'],

    # M3: toroidalMirror
    ['op_M3_hfn', 's', 'None', 'heightProfileFile'],
    ['op_M3_dim', 's', 'x', 'orientation'],
    ['op_M3_ap_shape', 's', 'r', 'apertureShape'],
    ['op_M3_rt', 'f', 1074.128, 'tangentialRadius'],
    ['op_M3_rs', 'f', 0.58901, 'sagittalRadius'],
    ['op_M3_size_tang', 'f', 0.38, 'tangentialSize'],
    ['op_M3_size_sag', 'f', 0.03, 'sagittalSize'],
    ['op_M3_ang', 'f', 0.019635, 'grazingAngle'],
    ['op_M3_horizontalPosition', 'f', 0.0, 'horizontalPosition'],
    ['op_M3_verticalPosition', 'f', 0.0, 'verticalPosition'],
    ['op_M3_nvx', 'f', 0.999807239581, 'normalVectorX'],
    ['op_M3_nvy', 'f', 0.0, 'normalVectorY'],
    ['op_M3_nvz', 'f', -0.0196337383668, 'normalVectorZ'],
    ['op_M3_tvx', 'f', 0.0196337383668, 'tangentialVectorX'],
    ['op_M3_tvy', 'f', 0.0, 'tangentialVectorY'],
    ['op_M3_amp_coef', 'f', 0.0001, 'heightAmplification'],

    # Lens_Before_Exit_Slit: drift
    ['op_Lens_Before_Exit_Slit_L', 'f', 15.0, 'length'],

    # Exit_Slit: aperture
    ['op_Exit_Slit_shape', 's', 'r', 'shape'],
    ['op_Exit_Slit_Dx', 'f', 2e-05, 'horizontalSize'],
    ['op_Exit_Slit_Dy', 'f', 2e-05, 'verticalSize'],
    ['op_Exit_Slit_x', 'f', 0.0, 'horizontalOffset'],
    ['op_Exit_Slit_y', 'f', 0.0, 'verticalOffset'],

    # After_Exit_Slit_Before_ZP: drift
    ['op_After_Exit_Slit_Before_ZP_L', 'f', 5.0, 'length'],

    # Ap_ZP: aperture
    ['op_Ap_ZP_shape', 's', 'c', 'shape'],
    ['op_Ap_ZP_Dx', 'f', 0.00032, 'horizontalSize'],
    ['op_Ap_ZP_Dy', 'f', 0.00032, 'verticalSize'],
    ['op_Ap_ZP_x', 'f', 0.0, 'horizontalOffset'],
    ['op_Ap_ZP_y', 'f', 0.0, 'verticalOffset'],

    # Zone_Plate: zonePlate
    ['op_Zone_Plate_rn', 'f', 0.00016, 'outerRadius'],
    ['op_Zone_Plate_thick', 'f', 0.0001, 'thickness'],
    ['op_Zone_Plate_delta1', 'f', 0.007639, 'mainRefractiveIndex'],
    ['op_Zone_Plate_atLen1', 'f', 3.680028e-08, 'mainAttenuationLength'],
    ['op_Zone_Plate_delta2', 'f', 0.0, 'complementaryRefractiveIndex'],
    ['op_Zone_Plate_atLen2', 'f', 1000000.0, 'complementaryAttenuationLength'],
    ['op_Zone_Plate_x', 'f', 0.0, 'horizontalOffset'],
    ['op_Zone_Plate_y', 'f', 0.0, 'verticalOffset'],
    ['op_Zone_Plate_nZones', 'i', 1600, 'numberOfZones'],

    # After_ZP_Watchpoint: drift
    ['op_After_ZP_Watchpoint_L', 'f', 0.003227, 'length'],

    #---Propagation parameters
    [
        'op_Fixed_Mask_pp', 'f',
        [
            0, 0, 1.0, 0, 0, 1.2, 12.0, 1.6, 12.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0, 0.0
        ], 'Fixed_Mask'
    ],
    [
        'op_Fixed_Mask_Ap_M1_pp', 'f',
        [
            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
        ], 'Fixed_Mask_Ap_M1'
    ],
    [
        'op_Ap_M1_pp', 'f',
        [
            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
        ], 'Ap_M1'
    ],
    [
        'op_M1_pp', 'f',
        [
            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
        ], 'M1'
    ],
    [
        'op_M1_M2_pp', 'f',
        [
            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
        ], 'M1_M2'
    ],
    [
        'op_M2_pp', 'f',
        [
            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
        ], 'M2'
    ],
    [
        'op_M2_Before_Grating_pp', 'f',
        [
            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
        ], 'M2_Before_Grating'
    ],
    [
        'op_Grating_pp', 'f',
        [
            0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0,
            -0.0861313174, 0.99628379, 1.0, 0.0
        ], 'Grating'
    ],
    [
        'op_Gr_Surf_Height_Err_Before_M3_pp', 'f',
        [
            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
        ], 'Gr_Surf_Height_Err_Before_M3'
    ],
    [
        'op_M3_pp', 'f',
        [
            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'
    ],
    [
        'op_Lens_Before_Exit_Slit_pp', 'f',
        [
            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
        ], 'Lens_Before_Exit_Slit'
    ],
    [
        'op_Exit_Slit_pp', 'f',
        [
            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
        ], 'Exit_Slit'
    ],
    [
        'op_After_Exit_Slit_Before_ZP_pp', 'f',
        [
            0, 0, 1.0, 3, 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
        ], 'After_Exit_Slit_Before_ZP'
    ],
    [
        'op_Ap_ZP_pp', 'f',
        [
            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
        ], 'Ap_ZP'
    ],
    [
        'op_Zone_Plate_pp', 'f',
        [
            0, 0, 1.0, 0, 0, 0.03, 800.0, 0.03, 800.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0, 0.0
        ], 'Zone_Plate'
    ],
    [
        'op_After_ZP_Watchpoint_pp', 'f',
        [
            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
        ], 'After_ZP_Watchpoint'
    ],
    [
        'op_fin_pp', 'f',
        [
            0, 0, 1.0, 0, 0, 0.01, 2.0, 0.01, 2.0, 3, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0
        ], 'final post-propagation (resize) parameters'
    ],

    #[ 0]: Auto-Resize (1) or not (0) Before propagation
    #[ 1]: Auto-Resize (1) or not (0) After propagation
    #[ 2]: Relative Precision for propagation with Auto-Resizing (1. is nominal)
    #[ 3]: Allow (1) or not (0) for semi-analytical treatment of the quadratic (leading) phase terms at the propagation
    #[ 4]: Do any Resizing on Fourier side, using FFT, (1) or not (0)
    #[ 5]: Horizontal Range modification factor at Resizing (1. means no modification)
    #[ 6]: Horizontal Resolution modification factor at Resizing
    #[ 7]: Vertical Range modification factor at Resizing
    #[ 8]: Vertical Resolution modification factor at Resizing
    #[ 9]: Type of wavefront Shift before Resizing: 1- vs Hor. Position, 2- vs Vert. Position, 3- vs Hor. and Vert. Position
    #[10]: New Horizontal wavefront Center position after Shift
    #[11]: New Vertical wavefront Center position after Shift
    #[12]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Horizontal Coordinate
    #[13]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Vertical Coordinate
    #[14]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Longitudinal Coordinate
    #[15]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Horizontal Coordinate
    #[16]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Vertical Coordinate
])
Exemple #14
0
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'NSLS-II SMI beamline', 'simulation name'],

    #---Data Folder
    [
        'fdir', 's', '',
        'folder (directory) name for reading-in input and saving output data files'
    ],

    #---Electron Beam
    ['ebm_nm', 's', '', 'standard electron beam name'],
    [
        'ebm_nms', 's', '',
        'standard electron beam name suffix: e.g. can be Day1, Final'
    ],
    ['ebm_i', 'f', 0.5, 'electron beam current [A]'],
    ['ebm_e', 'f', 3.0, 'electron beam avarage energy [GeV]'],
    ['ebm_de', 'f', 0.0, 'electron beam average energy deviation [GeV]'],
    [
        'ebm_x', 'f', 0.0,
        'electron beam initial average horizontal position [m]'
    ],
    ['ebm_y', 'f', 0.0, 'electron beam initial average vertical position [m]'],
    [
        'ebm_xp', 'f', 0.0,
        'electron beam initial average horizontal angle [rad]'
    ],
    ['ebm_yp', 'f', 0.0, 'electron beam initial average vertical angle [rad]'],
    [
        'ebm_z', 'f', 0.,
        'electron beam initial average longitudinal position [m]'
    ],
    [
        'ebm_dr', 'f', -1.44325,
        'electron beam longitudinal drift [m] to be performed before a required calculation'
    ],
    ['ebm_ens', 'f', 0.00089, 'electron beam relative energy spread'],
    ['ebm_emx', 'f', 9e-10, 'electron beam horizontal emittance [m]'],
    ['ebm_emy', 'f', 8e-12, 'electron beam vertical emittance [m]'],
    # Definition of the beam through Twiss:
    ['ebm_betax', 'f', 20.85, 'horizontal beta-function [m]'],
    ['ebm_betay', 'f', 3.4, 'vertical beta-function [m]'],
    ['ebm_alphax', 'f', 0.0, 'horizontal alpha-function [rad]'],
    ['ebm_alphay', 'f', 0.0, 'vertical alpha-function [rad]'],
    ['ebm_etax', 'f', 0.0, 'horizontal dispersion function [m]'],
    ['ebm_etay', 'f', 0.0, 'vertical dispersion function [m]'],
    ['ebm_etaxp', 'f', 0.0, 'horizontal dispersion function derivative [rad]'],
    ['ebm_etayp', 'f', 0.0, 'vertical dispersion function derivative [rad]'],

    #---Undulator
    ['und_bx', 'f', 0.0, 'undulator horizontal peak magnetic field [T]'],
    ['und_by', 'f', 0.955, 'undulator vertical peak magnetic field [T]'],
    [
        'und_phx', 'f', 0.0,
        'initial phase of the horizontal magnetic field [rad]'
    ],
    [
        'und_phy', 'f', 0.0,
        'initial phase of the vertical magnetic field [rad]'
    ],
    [
        'und_b2e', '', '',
        'estimate undulator fundamental photon energy (in [eV]) for the amplitude of sinusoidal magnetic field defined by und_b or und_bx, und_by',
        'store_true'
    ],
    [
        'und_e2b', '', '',
        'estimate undulator field amplitude (in [T]) for the photon energy defined by w_e',
        'store_true'
    ],
    ['und_per', 'f', 0.023, 'undulator period [m]'],
    ['und_len', 'f', 2.7945, 'undulator length [m]'],
    ['und_zc', 'f', 0.6, 'undulator center longitudinal position [m]'],
    [
        'und_sx', 'i', 1,
        'undulator horizontal magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_sy', 'i', -1,
        'undulator vertical magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_g', 'f', 6.72,
        'undulator gap [mm] (assumes availability of magnetic measurement or simulation data)'
    ],
    [
        'und_ph', 'f', 0.0,
        'shift of magnet arrays [mm] for which the field should be set up'
    ],
    ['und_mdir', 's', '', 'name of magnetic measurements sub-folder'],
    [
        'und_mfs', 's', '',
        'name of magnetic measurements for different gaps summary file'
    ],

    #---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    [
        'tr_cti', 'f', 0.0,
        'initial time moment (c*t) for electron trajectory calculation [m]'
    ],
    [
        'tr_ctf', 'f', 0.0,
        'final time moment (c*t) for electron trajectory calculation [m]'
    ],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    [
        'tr_mag', 'i', 1,
        'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'
    ],
    [
        'tr_fn', 's', 'res_trj.dat',
        'file name for saving calculated trajectory data'
    ],
    [
        'tr_pl', 's', '',
        'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'
    ],

    #Single-Electron Spectrum vs Photon Energy
    [
        'ss', '', '', 'calculate single-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'ss_ei', 'f', 20000.0,
        'initial photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ef', 'f', 20400.0,
        'final photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ne', 'i', 10000,
        'number of points vs photon energy for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_x', 'f', 0.0,
        'horizontal position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_y', 'f', 0.0,
        'vertical position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_meth', 'i', 1,
        'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'ss_prec', 'f', 0.01,
        'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'
    ],
    [
        'ss_pol', 'i', 6,
        'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'ss_mag', 'i', 1,
        'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'
    ],
    [
        'ss_ft', 's', 'f',
        'presentation/domain: "f"- frequency (photon energy), "t"- time'
    ],
    [
        'ss_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'ss_fn', 's', 'res_spec_se.dat',
        'file name for saving calculated single-e spectrum vs photon energy'
    ],
    [
        'ss_pl', 's', '',
        'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    [
        'sm', '', '', 'calculate multi-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'sm_ei', 'f', 100.0,
        'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ef', 'f', 20000.0,
        'final photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ne', 'i', 10000,
        'number of points vs photon energy for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_x', 'f', 0.0,
        'horizontal center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_rx', 'f', 0.001,
        'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_nx', 'i', 1,
        'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_y', 'f', 0.0,
        'vertical center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ry', 'f', 0.001,
        'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ny', 'i', 1,
        'number of points vs vertical position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_mag', 'i', 1,
        'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'
    ],
    [
        'sm_hi', 'i', 1,
        'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_hf', 'i', 15,
        'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_prl', 'f', 1.0,
        'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_pra', 'f', 1.0,
        'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_meth', 'i', -1,
        'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'
    ],
    [
        'sm_prec', 'f', 0.01,
        'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'
    ],
    [
        'sm_nm', 'i', 1,
        'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_na', 'i', 5,
        'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'
    ],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    [
        'sm_pol', 'i', 6,
        'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'sm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'sm_fn', 's', 'res_spec_me.dat',
        'file name for saving calculated milti-e spectrum vs photon energy'
    ],
    [
        'sm_pl', 's', '',
        'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    [
        'pw_x', 'f', 0.0,
        'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_rx', 'f', 0.015,
        'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_nx', 'i', 100,
        'number of points vs horizontal position for calculation of power density distribution'
    ],
    [
        'pw_y', 'f', 0.0,
        'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ry', 'f', 0.015,
        'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ny', 'i', 100,
        'number of points vs vertical position for calculation of power density distribution'
    ],
    [
        'pw_pr', 'f', 1.0,
        'precision factor for calculation of power density distribution'
    ],
    [
        'pw_meth', 'i', 1,
        'power density computation method (1- "near field", 2- "far field")'
    ],
    [
        'pw_zst', 'f', 0.,
        'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_zfi', 'f', 0.,
        'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_mag', 'i', 1,
        'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'
    ],
    [
        'pw_fn', 's', 'res_pow.dat',
        'file name for saving calculated power density distribution'
    ],
    [
        'pw_pl', 's', '',
        'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    [
        'si', '', '',
        'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position',
        'store_true'
    ],
    #Single-Electron Wavefront Propagation
    [
        'ws', '', '',
        'calculate single-electron (/ fully coherent) wavefront propagation',
        'store_true'
    ],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    [
        'wm', '', '',
        'calculate multi-electron (/ partially coherent) wavefront propagation',
        'store_true'
    ],
    [
        'w_e', 'f', 20358.0,
        'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ef', 'f', -1.0,
        'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ne', 'i', 1,
        'number of points vs photon energy for calculation of intensity distribution'
    ],
    [
        'w_x', 'f', 0.0,
        'central horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_rx', 'f', 0.0004,
        'range of horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_nx', 'i', 100,
        'number of points vs horizontal position for calculation of intensity distribution'
    ],
    [
        'w_y', 'f', 0.0,
        'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ry', 'f', 0.0004,
        'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ny', 'i', 100,
        'number of points vs vertical position for calculation of intensity distribution'
    ],
    [
        'w_smpf', 'f', 1.5,
        'sampling factor for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_meth', 'i', 1,
        'method to use for calculation of intensity distribution vs horizontal and vertical position: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'w_prec', 'f', 0.01,
        'relative precision for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'si_pol', 'i', 6,
        'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'si_type', 'i', 0,
        'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'
    ],
    [
        'w_mag', 'i', 1,
        'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'
    ],
    [
        'si_fn', 's', 'res_int_se.dat',
        'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'
    ],
    [
        'si_pl', 's', '',
        'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'ws_fni', 's', 'res_int_pr_se.dat',
        'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'
    ],
    [
        'ws_pl', 's', '',
        'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'wm_nm', 'i', 100000,
        'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_na', 'i', 5,
        'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'
    ],
    [
        'wm_ch', 'i', 0,
        'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y; 40- intensity(s0), mutual intensity cuts and degree of coherence vs X & Y'
    ],
    [
        'wm_ap', 'i', 0,
        'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'
    ],
    [
        'wm_x0', 'f', 0,
        'horizontal center position for mutual intensity cut calculation'
    ],
    [
        'wm_y0', 'f', 0,
        'vertical center position for mutual intensity cut calculation'
    ],
    [
        'wm_ei', 'i', 0,
        'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'
    ],
    [
        'wm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'wm_am', 'i', 0,
        'multi-electron integration approximation method: 0- no approximation (use the standard 5D integration method), 1- integrate numerically only over e-beam energy spread and use convolution to treat transverse emittance'
    ],
    [
        'wm_fni', 's', 'res_int_pr_me.dat',
        'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'
    ],

    #to add options
    [
        'op_r', 'f', 20.0,
        'longitudinal position of the first optical element [m]'
    ],

    # Former appParam:
    [
        'rs_type', 's', 'u',
        'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'
    ],

    #---Beamline optics:
    # MOAT_1: crystal
    ['op_MOAT_1_hfn', 's', 'Si_heat204.dat', 'heightProfileFile'],
    ['op_MOAT_1_dim', 's', 'y', 'orientation'],
    ['op_MOAT_1_d_sp', 'f', 3.13557135638, 'dSpacing'],
    ['op_MOAT_1_psi0r', 'f', -2.33400050166e-06, 'psi0r'],
    ['op_MOAT_1_psi0i', 'f', 8.59790386417e-09, 'psi0i'],
    ['op_MOAT_1_psiHr', 'f', -1.22944507993e-06, 'psiHr'],
    ['op_MOAT_1_psiHi', 'f', 6.00282990962e-09, 'psiHi'],
    ['op_MOAT_1_psiHBr', 'f', -1.22944507993e-06, 'psiHBr'],
    ['op_MOAT_1_psiHBi', 'f', 6.00282990962e-09, 'psiHBi'],
    ['op_MOAT_1_tc', 'f', 0.01, 'crystalThickness'],
    ['op_MOAT_1_ang_as', 'f', 0.0, 'asymmetryAngle'],
    ['op_MOAT_1_nvx', 'f', -0.0966554453406, 'nvx'],
    ['op_MOAT_1_nvy', 'f', 0.990567587399, 'nvy'],
    ['op_MOAT_1_nvz', 'f', -0.0971266167475, 'nvz'],
    ['op_MOAT_1_tvx', 'f', -0.00943241252825, 'tvx'],
    ['op_MOAT_1_tvy', 'f', 0.0966675192333, 'tvy'],
    ['op_MOAT_1_ang', 'f', 0.0972799772892, 'grazingAngle'],
    ['op_MOAT_1_amp_coef', 'f', 1.0, 'heightAmplification'],

    # MOAT_1_MOAT_2: drift
    ['op_MOAT_1_MOAT_2_L', 'f', 0.05, 'length'],

    # MOAT_2: crystal
    ['op_MOAT_2_hfn', 's', 'None', 'heightProfileFile'],
    ['op_MOAT_2_dim', 's', 'x', 'orientation'],
    ['op_MOAT_2_d_sp', 'f', 3.13557135638, 'dSpacing'],
    ['op_MOAT_2_psi0r', 'f', -2.33400050166e-06, 'psi0r'],
    ['op_MOAT_2_psi0i', 'f', 8.59790386417e-09, 'psi0i'],
    ['op_MOAT_2_psiHr', 'f', -1.22944507993e-06, 'psiHr'],
    ['op_MOAT_2_psiHi', 'f', 6.00282990962e-09, 'psiHi'],
    ['op_MOAT_2_psiHBr', 'f', -1.22944507993e-06, 'psiHBr'],
    ['op_MOAT_2_psiHBi', 'f', 6.00282990962e-09, 'psiHBi'],
    ['op_MOAT_2_tc', 'f', 0.01, 'crystalThickness'],
    ['op_MOAT_2_ang_as', 'f', 0.0, 'asymmetryAngle'],
    ['op_MOAT_2_nvx', 'f', 0.0966554453406, 'nvx'],
    ['op_MOAT_2_nvy', 'f', 0.990567587399, 'nvy'],
    ['op_MOAT_2_nvz', 'f', -0.0971266167475, 'nvz'],
    ['op_MOAT_2_tvx', 'f', 0.00943241252825, 'tvx'],
    ['op_MOAT_2_tvy', 'f', 0.0966675192333, 'tvy'],
    ['op_MOAT_2_ang', 'f', 0.0972799772892, 'grazingAngle'],
    ['op_MOAT_2_amp_coef', 'f', 1.0, 'heightAmplification'],

    # MOAT_2_HFM: drift
    ['op_MOAT_2_HFM_L', 'f', 2.89244, 'length'],

    # HFM: sphericalMirror
    ['op_HFM_hfn', 's', 'HFM_Rh7.6km.dat', 'heightProfileFile'],
    ['op_HFM_dim', 's', 'x', 'orientation'],
    ['op_HFM_r', 'f', 7100.0, 'radius'],
    ['op_HFM_size_tang', 'f', 0.5, 'tangentialSize'],
    ['op_HFM_size_sag', 'f', 0.04, 'sagittalSize'],
    ['op_HFM_ang', 'f', 0.003141592654, 'grazingAngle'],
    ['op_HFM_nvx', 'f', 0.999995065202, 'normalVectorX'],
    ['op_HFM_nvy', 'f', 0.0, 'normalVectorY'],
    ['op_HFM_nvz', 'f', -0.00314158748629, 'normalVectorZ'],
    ['op_HFM_tvx', 'f', 0.00314158748629, 'tangentialVectorX'],
    ['op_HFM_tvy', 'f', 0.0, 'tangentialVectorY'],
    ['op_HFM_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_HFM_x', 'f', 0.0, 'horizontalOffset'],
    ['op_HFM_y', 'f', 0.0, 'verticalOffset'],

    # HFM_VFM: drift
    ['op_HFM_VFM_L', 'f', 3.42, 'length'],

    # VFM: sphericalMirror
    ['op_VFM_hfn', 's', 'VFM_Rh5.4km.dat', 'heightProfileFile'],
    ['op_VFM_dim', 's', 'y', 'orientation'],
    ['op_VFM_r', 'f', 6100.0, 'radius'],
    ['op_VFM_size_tang', 'f', 0.4, 'tangentialSize'],
    ['op_VFM_size_sag', 'f', 0.04, 'sagittalSize'],
    ['op_VFM_ang', 'f', 0.003141592654, 'grazingAngle'],
    ['op_VFM_nvx', 'f', 0.0, 'normalVectorX'],
    ['op_VFM_nvy', 'f', 0.999995065202, 'normalVectorY'],
    ['op_VFM_nvz', 'f', -0.00314158748629, 'normalVectorZ'],
    ['op_VFM_tvx', 'f', 0.0, 'tangentialVectorX'],
    ['op_VFM_tvy', 'f', 0.00314158748629, 'tangentialVectorY'],
    ['op_VFM_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_VFM_x', 'f', 0.0, 'horizontalOffset'],
    ['op_VFM_y', 'f', 0.0, 'verticalOffset'],

    # VFM_VDM: drift
    ['op_VFM_VDM_L', 'f', 0.69756, 'length'],

    # VDM: sphericalMirror
    ['op_VDM_hfn', 's', 'VDM.dat', 'heightProfileFile'],
    ['op_VDM_dim', 's', 'y', 'orientation'],
    ['op_VDM_r', 'f', 300000.0, 'radius'],
    ['op_VDM_size_tang', 'f', 0.4, 'tangentialSize'],
    ['op_VDM_size_sag', 'f', 0.04, 'sagittalSize'],
    ['op_VDM_ang', 'f', 0.0031415926, 'grazingAngle'],
    ['op_VDM_nvx', 'f', 0.0, 'normalVectorX'],
    ['op_VDM_nvy', 'f', 0.999995065202, 'normalVectorY'],
    ['op_VDM_nvz', 'f', -0.00314158743229, 'normalVectorZ'],
    ['op_VDM_tvx', 'f', 0.0, 'tangentialVectorX'],
    ['op_VDM_tvy', 'f', 0.00314158743229, 'tangentialVectorY'],
    ['op_VDM_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_VDM_x', 'f', 0.0, 'horizontalOffset'],
    ['op_VDM_y', 'f', 0.0, 'verticalOffset'],

    # VDM_SSA: drift
    ['op_VDM_SSA_L', 'f', 8.00244, 'length'],

    # SSA: aperture
    ['op_SSA_shape', 's', 'r', 'shape'],
    ['op_SSA_Dx', 'f', 0.0004, 'horizontalSize'],
    ['op_SSA_Dy', 'f', 0.0004, 'verticalSize'],
    ['op_SSA_x', 'f', 0.0, 'horizontalOffset'],
    ['op_SSA_y', 'f', 0.0, 'verticalOffset'],

    # SSA_ES1: drift
    ['op_SSA_ES1_L', 'f', 3.89756, 'length'],

    # ES1_CRL: drift
    ['op_ES1_CRL_L', 'f', 6.435, 'length'],

    # CRL: crl
    ['op_CRL_foc_plane', 'f', 3, 'focalPlane'],
    ['op_CRL_delta', 'f', 8.211821e-07, 'refractiveIndex'],
    ['op_CRL_atten_len', 'f', 0.028541, 'attenuationLength'],
    ['op_CRL_shape', 'f', 1, 'shape'],
    ['op_CRL_apert_h', 'f', 0.001, 'horizontalApertureSize'],
    ['op_CRL_apert_v', 'f', 0.001, 'verticalApertureSize'],
    ['op_CRL_r_min', 'f', 5e-05, 'tipRadius'],
    ['op_CRL_wall_thick', 'f', 3.24e-05, 'tipWallThickness'],
    ['op_CRL_x', 'f', 0.0, 'horizontalOffset'],
    ['op_CRL_y', 'f', 0.0, 'verticalOffset'],
    ['op_CRL_n', 'i', 23, 'numberOfLenses'],

    # CRL_ES2: drift
    ['op_CRL_ES2_L', 'f', 1.665, 'length'],

    #---Propagation parameters
    [
        'op_MOAT_1_pp', 'f',
        [
            0, 0, 1.0, 0, 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
        ], 'MOAT_1'
    ],
    [
        'op_MOAT_1_MOAT_2_pp', 'f',
        [
            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
        ], 'MOAT_1_MOAT_2'
    ],
    [
        'op_MOAT_2_pp', 'f',
        [
            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
        ], 'MOAT_2'
    ],
    [
        'op_MOAT_2_HFM_pp', 'f',
        [
            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
        ], 'MOAT_2_HFM'
    ],
    [
        'op_HFM_pp', 'f',
        [
            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
        ], 'HFM'
    ],
    [
        'op_HFM_VFM_pp', 'f',
        [
            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
        ], 'HFM_VFM'
    ],
    [
        'op_VFM_pp', 'f',
        [
            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
        ], 'VFM'
    ],
    [
        'op_VFM_VDM_pp', 'f',
        [
            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
        ], 'VFM_VDM'
    ],
    [
        'op_VDM_pp', 'f',
        [
            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
        ], 'VDM'
    ],
    [
        'op_VDM_SSA_pp', 'f',
        [
            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
        ], 'VDM_SSA'
    ],
    [
        'op_SSA_pp', 'f',
        [
            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
        ], 'SSA'
    ],
    [
        'op_SSA_ES1_pp', 'f',
        [
            0, 0, 1.0, 1, 0, 0.5, 5.0, 0.5, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0
        ], 'SSA_ES1'
    ],
    [
        'op_ES1_CRL_pp', 'f',
        [
            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
        ], 'ES1_CRL'
    ],
    [
        'op_CRL_pp', 'f',
        [
            0, 0, 1.0, 2, 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
        ], 'CRL'
    ],
    [
        'op_CRL_ES2_pp', 'f',
        [
            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
        ], 'CRL_ES2'
    ],
    [
        'op_fin_pp', 'f',
        [
            0, 0, 1.0, 0, 0, 0.4, 3.0, 0.4, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0
        ], 'final post-propagation (resize) parameters'
    ],

    #[ 0]: Auto-Resize (1) or not (0) Before propagation
    #[ 1]: Auto-Resize (1) or not (0) After propagation
    #[ 2]: Relative Precision for propagation with Auto-Resizing (1. is nominal)
    #[ 3]: Allow (1) or not (0) for semi-analytical treatment of the quadratic (leading) phase terms at the propagation
    #[ 4]: Do any Resizing on Fourier side, using FFT, (1) or not (0)
    #[ 5]: Horizontal Range modification factor at Resizing (1. means no modification)
    #[ 6]: Horizontal Resolution modification factor at Resizing
    #[ 7]: Vertical Range modification factor at Resizing
    #[ 8]: Vertical Resolution modification factor at Resizing
    #[ 9]: Type of wavefront Shift before Resizing (not yet implemented)
    #[10]: New Horizontal wavefront Center position after Shift (not yet implemented)
    #[11]: New Vertical wavefront Center position after Shift (not yet implemented)
    #[12]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Horizontal Coordinate
    #[13]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Vertical Coordinate
    #[14]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Longitudinal Coordinate
    #[15]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Horizontal Coordinate
    #[16]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Vertical Coordinate
])
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'Tabulated Undulator Example', 'simulation name'],

#---Data Folder
    ['fdir', 's', 'multielectron_test', 'folder (directory) name for reading-in input and saving output data files'],

#---Electron Beam
    ['ebm_nm', 's', '', 'standard electron beam name'],
    ['ebm_nms', 's', '', 'standard electron beam name suffix: e.g. can be Day1, Final'],
    ['ebm_i', 'f', 0.5, 'electron beam current [A]'],
    ['ebm_e', 'f', 3.0, 'electron beam avarage energy [GeV]'],
    ['ebm_de', 'f', 0.0, 'electron beam average energy deviation [GeV]'],
    ['ebm_x', 'f', 0.0, 'electron beam initial average horizontal position [m]'],
    ['ebm_y', 'f', 0.0, 'electron beam initial average vertical position [m]'],
    ['ebm_xp', 'f', 0., 'electron beam initial average horizontal angle [rad]'],
    ['ebm_yp', 'f', 0., 'electron beam initial average vertical angle [rad]'],
    ['ebm_z', 'f', 0., 'electron beam initial average longitudinal position [m]'],
    ['ebm_dr', 'f', 0.0, 'electron beam longitudinal drift [m] to be performed before a required calculation'],
    ['ebm_ens', 'f', 0.0007, 'electron beam relative energy spread'],
    ['ebm_emx', 'f', 1.5e-09, 'electron beam horizontal emittance [m]'],
    ['ebm_emy', 'f', 8e-12, 'electron beam vertical emittance [m]'],
    # Definition of the beam through Twiss:
    ['ebm_betax', 'f', 1.84, 'horizontal beta-function [m]'],
    ['ebm_betay', 'f', 1.17, 'vertical beta-function [m]'],
    ['ebm_alphax', 'f', 0.0, 'horizontal alpha-function [rad]'],
    ['ebm_alphay', 'f', 0.0, 'vertical alpha-function [rad]'],
    ['ebm_etax', 'f', 0.0, 'horizontal dispersion function [m]'],
    ['ebm_etay', 'f', 0.0, 'vertical dispersion function [m]'],
    ['ebm_etaxp', 'f', 0.0, 'horizontal dispersion function derivative [rad]'],
    ['ebm_etayp', 'f', 0.0, 'vertical dispersion function derivative [rad]'],
    # Definition of the beam through Moments:
    ['ebm_sigx', 'f', 5.253570215e-05, 'horizontal RMS size of electron beam [m]'],
    ['ebm_sigy', 'f', 3.05941171e-06, 'vertical RMS size of electron beam [m]'],
    ['ebm_sigxp', 'f', 2.855201204e-05, 'horizontal RMS angular divergence of electron beam [rad]'],
    ['ebm_sigyp', 'f', 2.6148818e-06, 'vertical RMS angular divergence of electron beam [rad]'],
    ['ebm_mxxp', 'f', 0.0, 'horizontal position-angle mixed 2nd order moment of electron beam [m]'],
    ['ebm_myyp', 'f', 0.0, 'vertical position-angle mixed 2nd order moment of electron beam [m]'],

#---Undulator
    ['und_bx', 'f', 0.0, 'undulator horizontal peak magnetic field [T]'],
    ['und_by', 'f', 1.01997572, 'undulator vertical peak magnetic field [T]'],
    ['und_phx', 'f', 0.0, 'initial phase of the horizontal magnetic field [rad]'],
    ['und_phy', 'f', 0.0, 'initial phase of the vertical magnetic field [rad]'],
    ['und_b2e', '', '', 'estimate undulator fundamental photon energy (in [eV]) for the amplitude of sinusoidal magnetic field defined by und_b or und_bx, und_by', 'store_true'],
    ['und_e2b', '', '', 'estimate undulator field amplitude (in [T]) for the photon energy defined by w_e', 'store_true'],
    ['und_per', 'f', 0.021, 'undulator period [m]'],
    ['und_len', 'f', 2.500648, 'undulator length [m]'],
    ['und_zc', 'f', 1.305, 'undulator center longitudinal position [m]'],
    ['und_sx', 'i', 1, 'undulator horizontal magnetic field symmetry vs longitudinal position'],
    ['und_sy', 'i', -1, 'undulator vertical magnetic field symmetry vs longitudinal position'],
    ['und_g', 'f', 6.72, 'undulator gap [mm] (assumes availability of magnetic measurement or simulation data)'],
    ['und_ph', 'f', 0.0, 'shift of magnet arrays [mm] for which the field should be set up'],
    ['und_mdir', 's', '', 'name of magnetic measurements sub-folder'],
    ['und_mfs', 's', 'ivu21_srx_sum.txt', 'name of magnetic measurements for different gaps summary file'],


#---Calculation Types

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    ['sm', '', '1', 'calculate multi-e spectrum vs photon energy', 'store_true'],
    ['sm_ei', 'f', 10000.0, 'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'],
    ['sm_ef', 'f', 20000.0, 'final photon energy [eV] for multi-e spectrum vs photon energy calculation'],
    ['sm_ne', 'i', 1000, 'number of points vs photon energy for multi-e spectrum vs photon energy calculation'],
    ['sm_x', 'f', 0.0, 'horizontal center position [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_rx', 'f', 0.001, 'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_nx', 'i', 1, 'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'],
    ['sm_y', 'f', 0.0, 'vertical center position [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_ry', 'f', 0.001, 'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_ny', 'i', 1, 'number of points vs vertical position for multi-e spectrum vs photon energy calculation'],
    ['sm_mag', 'i', 1, 'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'],
    ['sm_hi', 'i', 1, 'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'],
    ['sm_hf', 'i', 15, 'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'],
    ['sm_prl', 'f', 1.0, 'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'],
    ['sm_pra', 'f', 1.0, 'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'],
    ['sm_meth', 'i', 1, 'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'],
    ['sm_prec', 'f', 0.01, 'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'],
    ['sm_nm', 'i', 10, 'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'],
    ['sm_ns', 'i', 5, 'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    ['sm_pol', 'i', 6, 'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['sm_rm', 'i', 1, 'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'],
    ['sm_fn', 's', 'res_spec_me.dat', 'file name for saving calculated milti-e spectrum vs photon energy'],
    ['sm_pl', 's', '', 'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'],

    #to add options
    ['op_r', 'f', 20.0, 'longitudinal position of the first optical element [m]'],

    # Former appParam:
    ['source_type', 's', 't', 'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'],
])
Exemple #16
0
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'Sample from Image', 'simulation name'],

#---Data Folder
    ['fdir', 's', '', 'folder (directory) name for reading-in input and saving output data files'],

#---Electron Beam
    ['ebm_nm', 's', 'NSLS-II Low Beta Final', 'standard electron beam name'],
    ['ebm_nms', 's', '', 'standard electron beam name suffix: e.g. can be Day1, Final'],
    ['ebm_i', 'f', 0.5, 'electron beam current [A]'],
    ['ebm_e', 'f', 3.0, 'electron beam avarage energy [GeV]'],
    ['ebm_de', 'f', 0.0, 'electron beam average energy deviation [GeV]'],
    ['ebm_x', 'f', 0.0, 'electron beam initial average horizontal position [m]'],
    ['ebm_y', 'f', 0.0, 'electron beam initial average vertical position [m]'],
    ['ebm_xp', 'f', 0., 'electron beam initial average horizontal angle [rad]'],
    ['ebm_yp', 'f', 0., 'electron beam initial average vertical angle [rad]'],
    ['ebm_z', 'f', 0., 'electron beam initial average longitudinal position [m]'],
    ['ebm_dr', 'f', -1.54, 'electron beam longitudinal drift [m] to be performed before a required calculation'],
    ['ebm_ens', 'f', 0.00089, 'electron beam relative energy spread'],
    ['ebm_emx', 'f', 5.5e-10, 'electron beam horizontal emittance [m]'],
    ['ebm_emy', 'f', 8e-12, 'electron beam vertical emittance [m]'],
    # Definition of the beam through Twiss:
    ['ebm_betax', 'f', 2.02, 'horizontal beta-function [m]'],
    ['ebm_betay', 'f', 1.06, 'vertical beta-function [m]'],
    ['ebm_alphax', 'f', 0.0, 'horizontal alpha-function [rad]'],
    ['ebm_alphay', 'f', 0.0, 'vertical alpha-function [rad]'],
    ['ebm_etax', 'f', 0.0, 'horizontal dispersion function [m]'],
    ['ebm_etay', 'f', 0.0, 'vertical dispersion function [m]'],
    ['ebm_etaxp', 'f', 0.0, 'horizontal dispersion function derivative [rad]'],
    ['ebm_etayp', 'f', 0.0, 'vertical dispersion function derivative [rad]'],
    # Definition of the beam through Moments:
    ['ebm_sigx', 'f', 3.3331666625e-05, 'horizontal RMS size of electron beam [m]'],
    ['ebm_sigy', 'f', 2.91204395571e-06, 'vertical RMS size of electron beam [m]'],
    ['ebm_sigxp', 'f', 1.65008250619e-05, 'horizontal RMS angular divergence of electron beam [rad]'],
    ['ebm_sigyp', 'f', 2.74721127897e-06, 'vertical RMS angular divergence of electron beam [rad]'],
    ['ebm_mxxp', 'f', 0.0, 'horizontal position-angle mixed 2nd order moment of electron beam [m]'],
    ['ebm_myyp', 'f', 0.0, 'vertical position-angle mixed 2nd order moment of electron beam [m]'],

#---Undulator
    ['und_bx', 'f', 0.0, 'undulator horizontal peak magnetic field [T]'],
    ['und_by', 'f', 0.88770981, 'undulator vertical peak magnetic field [T]'],
    ['und_phx', 'f', 0.0, 'initial phase of the horizontal magnetic field [rad]'],
    ['und_phy', 'f', 0.0, 'initial phase of the vertical magnetic field [rad]'],
    ['und_b2e', '', '', 'estimate undulator fundamental photon energy (in [eV]) for the amplitude of sinusoidal magnetic field defined by und_b or und_bx, und_by', 'store_true'],
    ['und_e2b', '', '', 'estimate undulator field amplitude (in [T]) for the photon energy defined by w_e', 'store_true'],
    ['und_per', 'f', 0.02, 'undulator period [m]'],
    ['und_len', 'f', 3.0, 'undulator length [m]'],
    ['und_zc', 'f', 0.0, 'undulator center longitudinal position [m]'],
    ['und_sx', 'i', 1, 'undulator horizontal magnetic field symmetry vs longitudinal position'],
    ['und_sy', 'i', -1, 'undulator vertical magnetic field symmetry vs longitudinal position'],
    ['und_g', 'f', 6.72, 'undulator gap [mm] (assumes availability of magnetic measurement or simulation data)'],
    ['und_ph', 'f', 0.0, 'shift of magnet arrays [mm] for which the field should be set up'],
    ['und_mdir', 's', '', 'name of magnetic measurements sub-folder'],
    ['und_mfs', 's', '', 'name of magnetic measurements for different gaps summary file'],


#---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    ['tr_cti', 'f', 0.0, 'initial time moment (c*t) for electron trajectory calculation [m]'],
    ['tr_ctf', 'f', 0.0, 'final time moment (c*t) for electron trajectory calculation [m]'],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    ['tr_mag', 'i', 1, 'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'],
    ['tr_fn', 's', 'res_trj.dat', 'file name for saving calculated trajectory data'],
    ['tr_pl', 's', '', 'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'],

    #Single-Electron Spectrum vs Photon Energy
    ['ss', '', '', 'calculate single-e spectrum vs photon energy', 'store_true'],
    ['ss_ei', 'f', 100.0, 'initial photon energy [eV] for single-e spectrum vs photon energy calculation'],
    ['ss_ef', 'f', 20000.0, 'final photon energy [eV] for single-e spectrum vs photon energy calculation'],
    ['ss_ne', 'i', 10000, 'number of points vs photon energy for single-e spectrum vs photon energy calculation'],
    ['ss_x', 'f', 0.0, 'horizontal position [m] for single-e spectrum vs photon energy calculation'],
    ['ss_y', 'f', 0.0, 'vertical position [m] for single-e spectrum vs photon energy calculation'],
    ['ss_meth', 'i', 1, 'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'],
    ['ss_prec', 'f', 0.01, 'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'],
    ['ss_pol', 'i', 6, 'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['ss_mag', 'i', 1, 'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'],
    ['ss_ft', 's', 'f', 'presentation/domain: "f"- frequency (photon energy), "t"- time'],
    ['ss_u', 'i', 1, 'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'],
    ['ss_fn', 's', 'res_spec_se.dat', 'file name for saving calculated single-e spectrum vs photon energy'],
    ['ss_pl', 's', '', 'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    ['sm', '', '', 'calculate multi-e spectrum vs photon energy', 'store_true'],
    ['sm_ei', 'f', 100.0, 'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'],
    ['sm_ef', 'f', 20000.0, 'final photon energy [eV] for multi-e spectrum vs photon energy calculation'],
    ['sm_ne', 'i', 10000, 'number of points vs photon energy for multi-e spectrum vs photon energy calculation'],
    ['sm_x', 'f', 0.0, 'horizontal center position [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_rx', 'f', 0.001, 'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_nx', 'i', 1, 'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'],
    ['sm_y', 'f', 0.0, 'vertical center position [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_ry', 'f', 0.001, 'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'],
    ['sm_ny', 'i', 1, 'number of points vs vertical position for multi-e spectrum vs photon energy calculation'],
    ['sm_mag', 'i', 1, 'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'],
    ['sm_hi', 'i', 1, 'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'],
    ['sm_hf', 'i', 15, 'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'],
    ['sm_prl', 'f', 1.0, 'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'],
    ['sm_pra', 'f', 1.0, 'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'],
    ['sm_meth', 'i', -1, 'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'],
    ['sm_prec', 'f', 0.01, 'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'],
    ['sm_nm', 'i', 1, 'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'],
    ['sm_na', 'i', 5, 'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'],
    ['sm_ns', 'i', 5, 'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    ['sm_pol', 'i', 6, 'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['sm_rm', 'i', 1, 'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'],
    ['sm_fn', 's', 'res_spec_me.dat', 'file name for saving calculated milti-e spectrum vs photon energy'],
    ['sm_pl', 's', '', 'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    ['pw_x', 'f', 0.0, 'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_rx', 'f', 0.015, 'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_nx', 'i', 100, 'number of points vs horizontal position for calculation of power density distribution'],
    ['pw_y', 'f', 0.0, 'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_ry', 'f', 0.015, 'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'],
    ['pw_ny', 'i', 100, 'number of points vs vertical position for calculation of power density distribution'],
    ['pw_pr', 'f', 1.0, 'precision factor for calculation of power density distribution'],
    ['pw_meth', 'i', 1, 'power density computation method (1- "near field", 2- "far field")'],
    ['pw_zst', 'f', 0., 'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'],
    ['pw_zfi', 'f', 0., 'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'],
    ['pw_mag', 'i', 1, 'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'],
    ['pw_fn', 's', 'res_pow.dat', 'file name for saving calculated power density distribution'],
    ['pw_pl', 's', '', 'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    ['si', '', '', 'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position', 'store_true'],
    #Single-Electron Wavefront Propagation
    ['ws', '', '', 'calculate single-electron (/ fully coherent) wavefront propagation', 'store_true'],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    ['wm', '', '', 'calculate multi-electron (/ partially coherent) wavefront propagation', 'store_true'],

    ['w_e', 'f', 9000.0, 'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ef', 'f', -1., 'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ne', 'i', 1, 'number of points vs photon energy for calculation of intensity distribution'],
    ['w_x', 'f', 0.0, 'central horizontal position [m] for calculation of intensity distribution'],
    ['w_rx', 'f', 0.0005, 'range of horizontal position [m] for calculation of intensity distribution'],
    ['w_nx', 'i', 100, 'number of points vs horizontal position for calculation of intensity distribution'],
    ['w_y', 'f', 0.0, 'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ry', 'f', 0.0005, 'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_ny', 'i', 100, 'number of points vs vertical position for calculation of intensity distribution'],
    ['w_smpf', 'f', 1.0, 'sampling factor for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_meth', 'i', 1, 'method to use for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_prec', 'f', 0.01, 'relative precision for calculation of intensity distribution vs horizontal and vertical position'],
    ['w_u', 'i', 1, 'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'],
    ['si_pol', 'i', 6, 'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'],
    ['si_type', 'i', 0, 'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'],
    ['w_mag', 'i', 1, 'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'],

    ['si_fn', 's', 'res_int_se.dat', 'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'],
    ['si_pl', 's', '', 'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],
    ['ws_fni', 's', 'res_int_pr_se.dat', 'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'],
    ['ws_pl', 's', '', 'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'],

    ['wm_nm', 'i', 100000, 'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'],
    ['wm_na', 'i', 5, 'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'],
    ['wm_ns', 'i', 5, 'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'],
    ['wm_ch', 'i', 0, 'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y'],
    ['wm_ap', 'i', 0, 'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'],
    ['wm_x0', 'f', 0, 'horizontal center position for mutual intensity cut calculation'],
    ['wm_y0', 'f', 0, 'vertical center position for mutual intensity cut calculation'],
    ['wm_ei', 'i', 0, 'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'],
    ['wm_rm', 'i', 1, 'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'],
    ['wm_fni', 's', 'res_int_pr_me.dat', 'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'],

    # Beamline optics:
    ['op_sample1', 's', 'sample.tif', 'input file of the sample #1'],

    #to add options
    ['op_r', 'f', 20.0, 'longitudinal position of the first optical element [m]'],

    # Former appParam:
    ['source_type', 's', 'u', 'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'],
])
Exemple #17
0
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'Hasan_Mono_CRL', 'simulation name'],

    #---Data Folder
    [
        'fdir', 's', '',
        'folder (directory) name for reading-in input and saving output data files'
    ],
    ['gbm_x', 'f', 0.0, 'average horizontal coordinates of waist [m]'],
    ['gbm_y', 'f', 0.0, 'average vertical coordinates of waist [m]'],
    ['gbm_z', 'f', 0.0, 'average longitudinal coordinate of waist [m]'],
    ['gbm_xp', 'f', 0.0, 'average horizontal angle at waist [rad]'],
    ['gbm_yp', 'f', 0.0, 'average verical angle at waist [rad]'],
    ['gbm_ave', 'f', 4401.0, 'average photon energy [eV]'],
    ['gbm_pen', 'f', 0.001, 'energy per pulse [J]'],
    ['gbm_rep', 'f', 1, 'rep. rate [Hz]'],
    [
        'gbm_pol', 'f', 1,
        'polarization 1- lin. hor., 2- lin. vert., 3- lin. 45 deg., 4- lin.135 deg., 5- circ. right, 6- circ. left'
    ],
    [
        'gbm_sx', 'f', 4e-05,
        'rms beam size vs horizontal position [m] at waist (for intensity)'
    ],
    [
        'gbm_sy', 'f', 4e-05,
        'rms beam size vs vertical position [m] at waist (for intensity)'
    ],
    ['gbm_st', 'f', 1e-16, 'rms pulse duration [s] (for intensity)'],
    [
        'gbm_mx', 'f', 0,
        'transverse Gauss-Hermite mode order in horizontal direction'
    ],
    [
        'gbm_my', 'f', 0,
        'transverse Gauss-Hermite mode order in vertical direction'
    ],
    [
        'gbm_ca', 's', 'c',
        'treat _sigX, _sigY as sizes in [m] in coordinate representation (_presCA="c") or as angular divergences in [rad] in angular representation (_presCA="a")'
    ],
    [
        'gbm_ft', 's', 't',
        'treat _sigT as pulse duration in [s] in time domain/representation (_presFT="t") or as bandwidth in [eV] in frequency domain/representation (_presFT="f")'
    ],

    #---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    [
        'tr_cti', 'f', 0.0,
        'initial time moment (c*t) for electron trajectory calculation [m]'
    ],
    [
        'tr_ctf', 'f', 0.0,
        'final time moment (c*t) for electron trajectory calculation [m]'
    ],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    [
        'tr_mag', 'i', 1,
        'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'
    ],
    [
        'tr_fn', 's', 'res_trj.dat',
        'file name for saving calculated trajectory data'
    ],
    [
        'tr_pl', 's', '',
        'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'
    ],

    #Single-Electron Spectrum vs Photon Energy
    [
        'ss', '', '', 'calculate single-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'ss_ei', 'f', 100.0,
        'initial photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ef', 'f', 20000.0,
        'final photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ne', 'i', 10000,
        'number of points vs photon energy for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_x', 'f', 0.0,
        'horizontal position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_y', 'f', 0.0,
        'vertical position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_meth', 'i', 1,
        'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'ss_prec', 'f', 0.01,
        'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'
    ],
    [
        'ss_pol', 'i', 6,
        'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'ss_mag', 'i', 1,
        'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'
    ],
    [
        'ss_ft', 's', 'f',
        'presentation/domain: "f"- frequency (photon energy), "t"- time'
    ],
    [
        'ss_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'ss_fn', 's', 'res_spec_se.dat',
        'file name for saving calculated single-e spectrum vs photon energy'
    ],
    [
        'ss_pl', 's', '',
        'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    [
        'sm', '', '', 'calculate multi-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'sm_ei', 'f', 100.0,
        'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ef', 'f', 20000.0,
        'final photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ne', 'i', 10000,
        'number of points vs photon energy for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_x', 'f', 0.0,
        'horizontal center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_rx', 'f', 0.001,
        'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_nx', 'i', 1,
        'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_y', 'f', 0.0,
        'vertical center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ry', 'f', 0.001,
        'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ny', 'i', 1,
        'number of points vs vertical position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_mag', 'i', 1,
        'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'
    ],
    [
        'sm_hi', 'i', 1,
        'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_hf', 'i', 15,
        'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_prl', 'f', 1.0,
        'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_pra', 'f', 1.0,
        'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_meth', 'i', -1,
        'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'
    ],
    [
        'sm_prec', 'f', 0.01,
        'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'
    ],
    [
        'sm_nm', 'i', 1,
        'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_na', 'i', 5,
        'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'
    ],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    [
        'sm_pol', 'i', 6,
        'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'sm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'sm_fn', 's', 'res_spec_me.dat',
        'file name for saving calculated milti-e spectrum vs photon energy'
    ],
    [
        'sm_pl', 's', '',
        'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    [
        'pw_x', 'f', 0.0,
        'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_rx', 'f', 0.015,
        'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_nx', 'i', 100,
        'number of points vs horizontal position for calculation of power density distribution'
    ],
    [
        'pw_y', 'f', 0.0,
        'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ry', 'f', 0.015,
        'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ny', 'i', 100,
        'number of points vs vertical position for calculation of power density distribution'
    ],
    [
        'pw_pr', 'f', 1.0,
        'precision factor for calculation of power density distribution'
    ],
    [
        'pw_meth', 'i', 1,
        'power density computation method (1- "near field", 2- "far field")'
    ],
    [
        'pw_zst', 'f', 0.,
        'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_zfi', 'f', 0.,
        'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_mag', 'i', 1,
        'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'
    ],
    [
        'pw_fn', 's', 'res_pow.dat',
        'file name for saving calculated power density distribution'
    ],
    [
        'pw_pl', 's', '',
        'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    [
        'si', '', '',
        'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position',
        'store_true'
    ],
    #Single-Electron Wavefront Propagation
    [
        'ws', '', '',
        'calculate single-electron (/ fully coherent) wavefront propagation',
        'store_true'
    ],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    [
        'wm', '', '',
        'calculate multi-electron (/ partially coherent) wavefront propagation',
        'store_true'
    ],
    [
        'w_e', 'f', 4401.0,
        'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ef', 'f', -1.0,
        'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ne', 'i', 1,
        'number of points vs photon energy for calculation of intensity distribution'
    ],
    [
        'w_x', 'f', 0.0,
        'central horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_rx', 'f', 0.001,
        'range of horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_nx', 'i', 100,
        'number of points vs horizontal position for calculation of intensity distribution'
    ],
    [
        'w_y', 'f', 0.0,
        'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ry', 'f', 0.001,
        'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ny', 'i', 100,
        'number of points vs vertical position for calculation of intensity distribution'
    ],
    [
        'w_smpf', 'f', 0,
        'sampling factor for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_meth', 'i', 2,
        'method to use for calculation of intensity distribution vs horizontal and vertical position: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'w_prec', 'f', 0.01,
        'relative precision for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'si_pol', 'i', 6,
        'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'si_type', 'i', 0,
        'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'
    ],
    [
        'w_mag', 'i', 1,
        'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'
    ],
    [
        'si_fn', 's', 'res_int_se.dat',
        'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'
    ],
    [
        'si_pl', 's', '',
        'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'ws_fni', 's', 'res_int_pr_se.dat',
        'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'
    ],
    [
        'ws_pl', 's', '',
        'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'wm_nm', 'i', 1000,
        'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_na', 'i', 5,
        'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'
    ],
    [
        'wm_ch', 'i', 0,
        'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y; 40- intensity(s0), mutual intensity cuts and degree of coherence vs X & Y'
    ],
    [
        'wm_ap', 'i', 0,
        'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'
    ],
    [
        'wm_x0', 'f', 0,
        'horizontal center position for mutual intensity cut calculation'
    ],
    [
        'wm_y0', 'f', 0,
        'vertical center position for mutual intensity cut calculation'
    ],
    [
        'wm_ei', 'i', 0,
        'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'
    ],
    [
        'wm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'wm_am', 'i', 0,
        'multi-electron integration approximation method: 0- no approximation (use the standard 5D integration method), 1- integrate numerically only over e-beam energy spread and use convolution to treat transverse emittance'
    ],
    [
        'wm_fni', 's', 'res_int_pr_me.dat',
        'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'
    ],

    #to add options
    [
        'op_r', 'f', 140.1,
        'longitudinal position of the first optical element [m]'
    ],

    # Former appParam:
    [
        'rs_type', 's', 'g',
        'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'
    ],

    #---Beamline optics:
    # Crystal: crystal
    ['op_Crystal_hfn', 's', '', 'heightProfileFile'],
    ['op_Crystal_dim', 's', 'x', 'orientation'],
    ['op_Crystal_d_sp', 'f', 3.13557135638, 'dSpacing'],
    ['op_Crystal_psi0r', 'f', -5.11321939903e-05, 'psi0r'],
    ['op_Crystal_psi0i', 'f', 3.58887560736e-06, 'psi0i'],
    ['op_Crystal_psiHr', 'f', -2.71341902391e-05, 'psiHr'],
    ['op_Crystal_psiHi', 'f', 2.50565837652e-06, 'psiHi'],
    ['op_Crystal_psiHBr', 'f', -2.71341902391e-05, 'psiHBr'],
    ['op_Crystal_psiHBi', 'f', 2.50565837652e-06, 'psiHBi'],
    ['op_Crystal_tc', 'f', 0.01, 'crystalThickness'],
    ['op_Crystal_ang_as', 'f', 0.0, 'asymmetryAngle'],
    ['op_Crystal_nvx', 'f', 0.0, 'nvx'],
    ['op_Crystal_nvy', 'f', 0.893336362055, 'nvy'],
    ['op_Crystal_nvz', 'f', -0.449388633846, 'nvz'],
    ['op_Crystal_tvx', 'f', 0.0, 'tvx'],
    ['op_Crystal_tvy', 'f', 0.449388633846, 'tvy'],
    ['op_Crystal_ang', 'f', 0.466080858374, 'grazingAngle'],
    ['op_Crystal_amp_coef', 'f', 1.0, 'heightAmplification'],

    # Crystal_s2_on_2nd_crystal: drift
    ['op_Crystal_s2_on_2nd_crystal_L', 'f', 0.01788537, 'length'],

    # s2_on_2nd_crystal_Crystal2: drift
    ['op_s2_on_2nd_crystal_Crystal2_L', 'f', 9.99997951112e-09, 'length'],

    # Crystal2: crystal
    ['op_Crystal2_hfn', 's', '', 'heightProfileFile'],
    ['op_Crystal2_dim', 's', 'x', 'orientation'],
    ['op_Crystal2_d_sp', 'f', 3.13557135638, 'dSpacing'],
    ['op_Crystal2_psi0r', 'f', -5.11321939903e-05, 'psi0r'],
    ['op_Crystal2_psi0i', 'f', 3.58887560736e-06, 'psi0i'],
    ['op_Crystal2_psiHr', 'f', -2.71341902391e-05, 'psiHr'],
    ['op_Crystal2_psiHi', 'f', 2.50565837652e-06, 'psiHi'],
    ['op_Crystal2_psiHBr', 'f', -2.71341902391e-05, 'psiHBr'],
    ['op_Crystal2_psiHBi', 'f', 2.50565837652e-06, 'psiHBi'],
    ['op_Crystal2_tc', 'f', 0.01, 'crystalThickness'],
    ['op_Crystal2_ang_as', 'f', -0.366519142919, 'asymmetryAngle'],
    ['op_Crystal2_nvx', 'f', -2.4158420418e-09, 'nvx'],
    ['op_Crystal2_nvy', 'f', -0.672975300169, 'nvy'],
    ['op_Crystal2_nvz', 'f', -0.739664954802, 'nvz'],
    ['op_Crystal2_tvx', 'f', -2.65524409917e-09, 'tvx'],
    ['op_Crystal2_tvy', 'f', -0.739664954802, 'tvy'],
    ['op_Crystal2_ang', 'f', 0.83257236543, 'grazingAngle'],
    ['op_Crystal2_amp_coef', 'f', 1.0, 'heightAmplification'],

    # Crystal2_s3_on_1st_mirror: drift
    ['op_Crystal2_s3_on_1st_mirror_L', 'f', 0.01999999, 'length'],

    # s3_on_1st_mirror_Elliptical_Cylinder: drift
    [
        'op_s3_on_1st_mirror_Elliptical_Cylinder_L', 'f', 1.00000079328e-08,
        'length'
    ],

    # CRL: crl
    ['op_CRL_foc_plane', 'f', 2, 'focalPlane'],
    ['op_CRL_delta', 'f', 1.764022e-05, 'refractiveIndex'],
    ['op_CRL_atten_len', 'f', 0.000850124, 'attenuationLength'],
    ['op_CRL_shape', 'f', 1, 'shape'],
    ['op_CRL_apert_h', 'f', 0.001, 'horizontalApertureSize'],
    ['op_CRL_apert_v', 'f', 0.001, 'verticalApertureSize'],
    ['op_CRL_r_min', 'f', 6.35e-05, 'tipRadius'],
    ['op_CRL_wall_thick', 'f', 8e-05, 'tipWallThickness'],
    ['op_CRL_x', 'f', 0.0, 'horizontalOffset'],
    ['op_CRL_y', 'f', 0.0, 'verticalOffset'],
    ['op_CRL_n', 'i', 6, 'numberOfLenses'],

    # CRL_s4_on_slit: drift
    ['op_CRL_s4_on_slit_L', 'f', 0.29997075755, 'length'],

    # s4_on_slit_Aperture: drift
    ['op_s4_on_slit_Aperture_L', 'f', 1.00044417195e-11, 'length'],

    # Aperture: aperture
    ['op_Aperture_shape', 's', 'r', 'shape'],
    ['op_Aperture_Dx', 'f', 0.001, 'horizontalSize'],
    ['op_Aperture_Dy', 'f', 5e-06, 'verticalSize'],
    ['op_Aperture_x', 'f', 0.0, 'horizontalOffset'],
    ['op_Aperture_y', 'f', 0.0, 'verticalOffset'],

    # Aperture_s5_on_2nd_mirror: drift
    ['op_Aperture_s5_on_2nd_mirror_L', 'f', 0.29997075719, 'length'],

    # CRL2: crl
    ['op_CRL2_foc_plane', 'f', 2, 'focalPlane'],
    ['op_CRL2_delta', 'f', 1.764022e-05, 'refractiveIndex'],
    ['op_CRL2_atten_len', 'f', 0.000850124, 'attenuationLength'],
    ['op_CRL2_shape', 'f', 1, 'shape'],
    ['op_CRL2_apert_h', 'f', 0.001, 'horizontalApertureSize'],
    ['op_CRL2_apert_v', 'f', 0.001, 'verticalApertureSize'],
    ['op_CRL2_r_min', 'f', 6.35e-05, 'tipRadius'],
    ['op_CRL2_wall_thick', 'f', 8e-05, 'tipWallThickness'],
    ['op_CRL2_x', 'f', 0.0, 'horizontalOffset'],
    ['op_CRL2_y', 'f', 0.0, 'verticalOffset'],
    ['op_CRL2_n', 'i', 6, 'numberOfLenses'],

    # CRL2_s6_on_3rd_crystal: drift
    ['op_CRL2_s6_on_3rd_crystal_L', 'f', 0.02, 'length'],

    # s6_on_3rd_crystal_Crystal3: drift
    ['op_s6_on_3rd_crystal_Crystal3_L', 'f', 1.00044417195e-11, 'length'],

    # Crystal3: crystal
    ['op_Crystal3_hfn', 's', '', 'heightProfileFile'],
    ['op_Crystal3_dim', 's', 'x', 'orientation'],
    ['op_Crystal3_d_sp', 'f', 3.13557135638, 'dSpacing'],
    ['op_Crystal3_psi0r', 'f', -5.11321939903e-05, 'psi0r'],
    ['op_Crystal3_psi0i', 'f', 3.58887560736e-06, 'psi0i'],
    ['op_Crystal3_psiHr', 'f', -2.71341902391e-05, 'psiHr'],
    ['op_Crystal3_psiHi', 'f', 2.50565837652e-06, 'psiHi'],
    ['op_Crystal3_psiHBr', 'f', -2.71341902391e-05, 'psiHBr'],
    ['op_Crystal3_psiHBi', 'f', 2.50565837652e-06, 'psiHBi'],
    ['op_Crystal3_tc', 'f', 0.01, 'crystalThickness'],
    ['op_Crystal3_ang_as', 'f', 0.0, 'asymmetryAngle'],
    ['op_Crystal3_nvx', 'f', 0.0, 'nvx'],
    ['op_Crystal3_nvy', 'f', -0.893336362055, 'nvy'],
    ['op_Crystal3_nvz', 'f', -0.449388633846, 'nvz'],
    ['op_Crystal3_tvx', 'f', -1.61321218547e-09, 'tvx'],
    ['op_Crystal3_tvy', 'f', -0.449388633846, 'tvy'],
    ['op_Crystal3_ang', 'f', 0.466080858374, 'grazingAngle'],
    ['op_Crystal3_amp_coef', 'f', 1.0, 'heightAmplification'],

    # Crystal3_s7_on_4th_crystal: drift
    ['op_Crystal3_s7_on_4th_crystal_L', 'f', 0.01788538036, 'length'],

    # Crystal4: crystal
    ['op_Crystal4_hfn', 's', '', 'heightProfileFile'],
    ['op_Crystal4_dim', 's', 'x', 'orientation'],
    ['op_Crystal4_d_sp', 'f', 3.13557135638, 'dSpacing'],
    ['op_Crystal4_psi0r', 'f', -5.11321939903e-05, 'psi0r'],
    ['op_Crystal4_psi0i', 'f', 3.58887560736e-06, 'psi0i'],
    ['op_Crystal4_psiHr', 'f', -2.71341902391e-05, 'psiHr'],
    ['op_Crystal4_psiHi', 'f', 2.50565837652e-06, 'psiHi'],
    ['op_Crystal4_psiHBr', 'f', -2.71341902391e-05, 'psiHBr'],
    ['op_Crystal4_psiHBi', 'f', 2.50565837652e-06, 'psiHBi'],
    ['op_Crystal4_tc', 'f', 0.01, 'crystalThickness'],
    ['op_Crystal4_ang_as', 'f', 0.366519142919, 'asymmetryAngle'],
    ['op_Crystal4_nvx', 'f', 0.0, 'nvx'],
    ['op_Crystal4_nvy', 'f', 0.995027350408, 'nvy'],
    ['op_Crystal4_nvz', 'f', -0.0996020679548, 'nvz'],
    ['op_Crystal4_tvx', 'f', 0.0, 'tvx'],
    ['op_Crystal4_tvy', 'f', 0.0996020679548, 'tvy'],
    ['op_Crystal4_ang', 'f', 0.099767492435, 'grazingAngle'],
    ['op_Crystal4_amp_coef', 'f', 1.0, 'heightAmplification'],

    # Crystal4_on_detector: drift
    ['op_Crystal4_on_detector_L', 'f', 9.22428772488, 'length'],

    #---Propagation parameters
    [
        'op_Crystal_pp', 'f',
        [
            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
        ], 'Crystal'
    ],
    [
        'op_Crystal_s2_on_2nd_crystal_pp', 'f',
        [
            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
        ], 'Crystal_s2_on_2nd_crystal'
    ],
    [
        'op_s2_on_2nd_crystal_Crystal2_pp', 'f',
        [
            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
        ], 's2_on_2nd_crystal_Crystal2'
    ],
    [
        'op_Crystal2_pp', 'f',
        [
            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
        ], 'Crystal2'
    ],
    [
        'op_Crystal2_s3_on_1st_mirror_pp', 'f',
        [
            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
        ], 'Crystal2_s3_on_1st_mirror'
    ],
    [
        'op_s3_on_1st_mirror_Elliptical_Cylinder_pp', 'f',
        [
            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
        ], 's3_on_1st_mirror_Elliptical_Cylinder'
    ],
    [
        'op_CRL_pp', 'f',
        [
            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
        ], 'CRL'
    ],
    [
        'op_CRL_s4_on_slit_pp', 'f',
        [
            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
        ], 'CRL_s4_on_slit'
    ],
    [
        'op_s4_on_slit_Aperture_pp', 'f',
        [
            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
        ], 's4_on_slit_Aperture'
    ],
    [
        'op_Aperture_pp', 'f',
        [
            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
        ], 'Aperture'
    ],
    [
        'op_Aperture_s5_on_2nd_mirror_pp', 'f',
        [
            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
        ], 'Aperture_s5_on_2nd_mirror'
    ],
    [
        'op_CRL2_pp', 'f',
        [
            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
        ], 'CRL2'
    ],
    [
        'op_CRL2_s6_on_3rd_crystal_pp', 'f',
        [
            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
        ], 'CRL2_s6_on_3rd_crystal'
    ],
    [
        'op_s6_on_3rd_crystal_Crystal3_pp', 'f',
        [
            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
        ], 's6_on_3rd_crystal_Crystal3'
    ],
    [
        'op_Crystal3_pp', 'f',
        [
            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
        ], 'Crystal3'
    ],
    [
        'op_Crystal3_s7_on_4th_crystal_pp', 'f',
        [
            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
        ], 'Crystal3_s7_on_4th_crystal'
    ],
    [
        'op_Crystal4_pp', 'f',
        [
            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
        ], 'Crystal4'
    ],
    [
        'op_Crystal4_on_detector_pp', 'f',
        [
            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
        ], 'Crystal4_on_detector'
    ],
    [
        'op_fin_pp', 'f',
        [
            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
        ], 'final post-propagation (resize) parameters'
    ],

    #[ 0]: Auto-Resize (1) or not (0) Before propagation
    #[ 1]: Auto-Resize (1) or not (0) After propagation
    #[ 2]: Relative Precision for propagation with Auto-Resizing (1. is nominal)
    #[ 3]: Allow (1) or not (0) for semi-analytical treatment of the quadratic (leading) phase terms at the propagation
    #[ 4]: Do any Resizing on Fourier side, using FFT, (1) or not (0)
    #[ 5]: Horizontal Range modification factor at Resizing (1. means no modification)
    #[ 6]: Horizontal Resolution modification factor at Resizing
    #[ 7]: Vertical Range modification factor at Resizing
    #[ 8]: Vertical Resolution modification factor at Resizing
    #[ 9]: Type of wavefront Shift before Resizing (not yet implemented)
    #[10]: New Horizontal wavefront Center position after Shift (not yet implemented)
    #[11]: New Vertical wavefront Center position after Shift (not yet implemented)
    #[12]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Horizontal Coordinate
    #[13]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Vertical Coordinate
    #[14]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Longitudinal Coordinate
    #[15]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Horizontal Coordinate
    #[16]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Vertical Coordinate
])
Exemple #18
0
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'NSLS-II CSX-1 beamline', 'simulation name'],

    #---Data Folder
    [
        'fdir', 's', '',
        'folder (directory) name for reading-in input and saving output data files'
    ],

    #---Electron Beam
    ['ebm_nm', 's', '', 'standard electron beam name'],
    [
        'ebm_nms', 's', '',
        'standard electron beam name suffix: e.g. can be Day1, Final'
    ],
    ['ebm_i', 'f', 0.5, 'electron beam current [A]'],
    ['ebm_e', 'f', 3.0, 'electron beam avarage energy [GeV]'],
    ['ebm_de', 'f', 0.0, 'electron beam average energy deviation [GeV]'],
    [
        'ebm_x', 'f', 0.0,
        'electron beam initial average horizontal position [m]'
    ],
    ['ebm_y', 'f', 0.0, 'electron beam initial average vertical position [m]'],
    [
        'ebm_xp', 'f', 0.0,
        'electron beam initial average horizontal angle [rad]'
    ],
    ['ebm_yp', 'f', 0.0, 'electron beam initial average vertical angle [rad]'],
    [
        'ebm_z', 'f', 0.,
        'electron beam initial average longitudinal position [m]'
    ],
    [
        'ebm_dr', 'f', 0.0,
        'electron beam longitudinal drift [m] to be performed before a required calculation'
    ],
    ['ebm_ens', 'f', 0.00089, 'electron beam relative energy spread'],
    ['ebm_emx', 'f', 7.6e-10, 'electron beam horizontal emittance [m]'],
    ['ebm_emy', 'f', 8e-12, 'electron beam vertical emittance [m]'],
    # Definition of the beam through Twiss:
    ['ebm_betax', 'f', 1.84, 'horizontal beta-function [m]'],
    ['ebm_betay', 'f', 1.17, 'vertical beta-function [m]'],
    ['ebm_alphax', 'f', 0.0, 'horizontal alpha-function [rad]'],
    ['ebm_alphay', 'f', 0.0, 'vertical alpha-function [rad]'],
    ['ebm_etax', 'f', 0.0, 'horizontal dispersion function [m]'],
    ['ebm_etay', 'f', 0.0, 'vertical dispersion function [m]'],
    ['ebm_etaxp', 'f', 0.0, 'horizontal dispersion function derivative [rad]'],
    ['ebm_etayp', 'f', 0.0, 'vertical dispersion function derivative [rad]'],

    #---Undulator
    ['und_bx', 'f', 0.0, 'undulator horizontal peak magnetic field [T]'],
    ['und_by', 'f', 0.3513, 'undulator vertical peak magnetic field [T]'],
    [
        'und_phx', 'f', 0.0,
        'initial phase of the horizontal magnetic field [rad]'
    ],
    [
        'und_phy', 'f', 0.0,
        'initial phase of the vertical magnetic field [rad]'
    ],
    [
        'und_b2e', '', '',
        'estimate undulator fundamental photon energy (in [eV]) for the amplitude of sinusoidal magnetic field defined by und_b or und_bx, und_by',
        'store_true'
    ],
    [
        'und_e2b', '', '',
        'estimate undulator field amplitude (in [T]) for the photon energy defined by w_e',
        'store_true'
    ],
    ['und_per', 'f', 0.0492, 'undulator period [m]'],
    ['und_len', 'f', 1.85, 'undulator length [m]'],
    ['und_zc', 'f', 1.25, 'undulator center longitudinal position [m]'],
    [
        'und_sx', 'i', -1,
        'undulator horizontal magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_sy', 'i', 1,
        'undulator vertical magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_g', 'f', 6.72,
        'undulator gap [mm] (assumes availability of magnetic measurement or simulation data)'
    ],
    [
        'und_ph', 'f', 0.0,
        'shift of magnet arrays [mm] for which the field should be set up'
    ],
    ['und_mdir', 's', '', 'name of magnetic measurements sub-folder'],
    [
        'und_mfs', 's', '',
        'name of magnetic measurements for different gaps summary file'
    ],

    #---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    [
        'tr_cti', 'f', 0.0,
        'initial time moment (c*t) for electron trajectory calculation [m]'
    ],
    [
        'tr_ctf', 'f', 0.0,
        'final time moment (c*t) for electron trajectory calculation [m]'
    ],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    [
        'tr_mag', 'i', 1,
        'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'
    ],
    [
        'tr_fn', 's', 'res_trj.dat',
        'file name for saving calculated trajectory data'
    ],
    [
        'tr_pl', 's', '',
        'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'
    ],

    #Single-Electron Spectrum vs Photon Energy
    [
        'ss', '', '', 'calculate single-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'ss_ei', 'f', 10.0,
        'initial photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ef', 'f', 2000.0,
        'final photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ne', 'i', 2000,
        'number of points vs photon energy for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_x', 'f', 0.0,
        'horizontal position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_y', 'f', 0.0,
        'vertical position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_meth', 'i', 1,
        'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'ss_prec', 'f', 0.01,
        'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'
    ],
    [
        'ss_pol', 'i', 6,
        'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'ss_mag', 'i', 1,
        'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'
    ],
    [
        'ss_ft', 's', 'f',
        'presentation/domain: "f"- frequency (photon energy), "t"- time'
    ],
    [
        'ss_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'ss_fn', 's', 'res_spec_se.dat',
        'file name for saving calculated single-e spectrum vs photon energy'
    ],
    [
        'ss_pl', 's', '',
        'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    [
        'sm', '', '', 'calculate multi-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'sm_ei', 'f', 10.0,
        'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ef', 'f', 2000.0,
        'final photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ne', 'i', 2000,
        'number of points vs photon energy for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_x', 'f', 0.0,
        'horizontal center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_rx', 'f', 0.003,
        'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_nx', 'i', 1,
        'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_y', 'f', 0.0,
        'vertical center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ry', 'f', 0.003,
        'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ny', 'i', 1,
        'number of points vs vertical position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_mag', 'i', 1,
        'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'
    ],
    [
        'sm_hi', 'i', 1,
        'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_hf', 'i', 15,
        'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_prl', 'f', 1.0,
        'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_pra', 'f', 1.0,
        'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_meth', 'i', -1,
        'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'
    ],
    [
        'sm_prec', 'f', 0.01,
        'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'
    ],
    [
        'sm_nm', 'i', 1,
        'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_na', 'i', 5,
        'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'
    ],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    [
        'sm_pol', 'i', 6,
        'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'sm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'sm_fn', 's', 'res_spec_me.dat',
        'file name for saving calculated milti-e spectrum vs photon energy'
    ],
    [
        'sm_pl', 's', '',
        'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    [
        'pw_x', 'f', 0.0,
        'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_rx', 'f', 0.03,
        'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_nx', 'i', 100,
        'number of points vs horizontal position for calculation of power density distribution'
    ],
    [
        'pw_y', 'f', 0.0,
        'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ry', 'f', 0.03,
        'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ny', 'i', 100,
        'number of points vs vertical position for calculation of power density distribution'
    ],
    [
        'pw_pr', 'f', 1.0,
        'precision factor for calculation of power density distribution'
    ],
    [
        'pw_meth', 'i', 1,
        'power density computation method (1- "near field", 2- "far field")'
    ],
    [
        'pw_zst', 'f', 0.,
        'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_zfi', 'f', 0.,
        'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_mag', 'i', 1,
        'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'
    ],
    [
        'pw_fn', 's', 'res_pow.dat',
        'file name for saving calculated power density distribution'
    ],
    [
        'pw_pl', 's', '',
        'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    [
        'si', '', '',
        'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position',
        'store_true'
    ],
    #Single-Electron Wavefront Propagation
    [
        'ws', '', '',
        'calculate single-electron (/ fully coherent) wavefront propagation',
        'store_true'
    ],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    [
        'wm', '', '',
        'calculate multi-electron (/ partially coherent) wavefront propagation',
        'store_true'
    ],
    [
        'w_e', 'f', 750.0,
        'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ef', 'f', -1.0,
        'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ne', 'i', 1,
        'number of points vs photon energy for calculation of intensity distribution'
    ],
    [
        'w_x', 'f', 0.0,
        'central horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_rx', 'f', 0.004,
        'range of horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_nx', 'i', 100,
        'number of points vs horizontal position for calculation of intensity distribution'
    ],
    [
        'w_y', 'f', 0.0,
        'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ry', 'f', 0.004,
        'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ny', 'i', 100,
        'number of points vs vertical position for calculation of intensity distribution'
    ],
    [
        'w_smpf', 'f', 0.3,
        'sampling factor for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_meth', 'i', 1,
        'method to use for calculation of intensity distribution vs horizontal and vertical position: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'w_prec', 'f', 0.01,
        'relative precision for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'si_pol', 'i', 6,
        'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'si_type', 'i', 0,
        'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'
    ],
    [
        'w_mag', 'i', 1,
        'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'
    ],
    [
        'si_fn', 's', 'res_int_se.dat',
        'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'
    ],
    [
        'si_pl', 's', '',
        'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'ws_fni', 's', 'res_int_pr_se.dat',
        'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'
    ],
    [
        'ws_pl', 's', '',
        'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'wm_nm', 'i', 30000,
        'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_na', 'i', 5,
        'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'
    ],
    [
        'wm_ch', 'i', 0,
        'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y; 40- intensity(s0), mutual intensity cuts and degree of coherence vs X & Y'
    ],
    [
        'wm_ap', 'i', 0,
        'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'
    ],
    [
        'wm_x0', 'f', 0,
        'horizontal center position for mutual intensity cut calculation'
    ],
    [
        'wm_y0', 'f', 0,
        'vertical center position for mutual intensity cut calculation'
    ],
    [
        'wm_ei', 'i', 0,
        'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'
    ],
    [
        'wm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'wm_am', 'i', 0,
        'multi-electron integration approximation method: 0- no approximation (use the standard 5D integration method), 1- integrate numerically only over e-beam energy spread and use convolution to treat transverse emittance'
    ],
    [
        'wm_fni', 's', 'res_int_pr_me.dat',
        'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'
    ],

    #to add options
    [
        'op_r', 'f', 26.2,
        'longitudinal position of the first optical element [m]'
    ],

    # Former appParam:
    [
        'rs_type', 's', 'u',
        'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'
    ],

    #---Beamline optics:
    # Fixed_Mask: aperture
    ['op_Fixed_Mask_shape', 's', 'r', 'shape'],
    ['op_Fixed_Mask_Dx', 'f', 0.005, 'horizontalSize'],
    ['op_Fixed_Mask_Dy', 'f', 0.005, 'verticalSize'],
    ['op_Fixed_Mask_x', 'f', 0.0, 'horizontalOffset'],
    ['op_Fixed_Mask_y', 'f', 0.0, 'verticalOffset'],

    # Fixed_Mask_M1A: drift
    ['op_Fixed_Mask_M1A_L', 'f', 1.0, 'length'],

    # M1A: mirror
    ['op_M1A_hfn', 's', 'mirror_1d.dat', 'heightProfileFile'],
    ['op_M1A_dim', 's', 'x', 'orientation'],
    ['op_M1A_ang', 'f', 0.0218166, 'grazingAngle'],
    ['op_M1A_amp_coef', 'f', 0.01, 'heightAmplification'],
    ['op_M1A_size_x', 'f', 0.00545, 'horizontalTransverseSize'],
    ['op_M1A_size_y', 'f', 0.025, 'verticalTransverseSize'],

    # M1A_Watchpoint: drift
    ['op_M1A_Watchpoint_L', 'f', 13.2, 'length'],

    # M2A_VDM: mirror
    ['op_M2A_VDM_hfn', 's', 'mirror_1d.dat', 'heightProfileFile'],
    ['op_M2A_VDM_dim', 's', 'y', 'orientation'],
    ['op_M2A_VDM_ang', 'f', 0.0290353, 'grazingAngle'],
    ['op_M2A_VDM_amp_coef', 'f', 0.01, 'heightAmplification'],
    ['op_M2A_VDM_size_x', 'f', 0.025, 'horizontalTransverseSize'],
    ['op_M2A_VDM_size_y', 'f', 0.1, 'verticalTransverseSize'],

    # M2A_VDM_Grating: drift
    ['op_M2A_VDM_Grating_L', 'f', 0.06, 'length'],

    # Grating: grating
    ['op_Grating_size_tang', 'f', 0.3, 'tangentialSize'],
    ['op_Grating_size_sag', 'f', 0.015, 'sagittalSize'],
    ['op_Grating_nvx', 'f', 0.0, 'normalVectorX'],
    ['op_Grating_nvy', 'f', 0.999657108688, 'normalVectorY'],
    ['op_Grating_nvz', 'f', -0.0261852066962, 'normalVectorZ'],
    ['op_Grating_tvx', 'f', 0.0, 'tangentialVectorX'],
    ['op_Grating_tvy', 'f', 0.0261852066962, 'tangentialVectorY'],
    ['op_Grating_x', 'f', 0.0, 'horizontalOffset'],
    ['op_Grating_y', 'f', 0.0, 'verticalOffset'],
    ['op_Grating_m', 'f', 1.0, 'diffractionOrder'],
    ['op_Grating_grDen', 'f', 100.0, 'grooveDensity0'],
    ['op_Grating_grDen1', 'f', 0.0548, 'grooveDensity1'],
    ['op_Grating_grDen2', 'f', 3.9e-06, 'grooveDensity2'],
    ['op_Grating_grDen3', 'f', 0.0, 'grooveDensity3'],
    ['op_Grating_grDen4', 'f', 0.0, 'grooveDensity4'],

    # Grating_Aperture: drift
    ['op_Grating_Aperture_L', 'f', 2.0, 'length'],

    # Aperture: aperture
    ['op_Aperture_shape', 's', 'r', 'shape'],
    ['op_Aperture_Dx', 'f', 0.001, 'horizontalSize'],
    ['op_Aperture_Dy', 'f', 0.001, 'verticalSize'],
    ['op_Aperture_x', 'f', 0.0, 'horizontalOffset'],
    ['op_Aperture_y', 'f', 0.0, 'verticalOffset'],

    # M3A_HFM: sphericalMirror
    ['op_M3A_HFM_hfn', 's', '', 'heightProfileFile'],
    ['op_M3A_HFM_dim', 's', 'x', 'orientation'],
    ['op_M3A_HFM_r', 'f', 846.5455704, 'radius'],
    ['op_M3A_HFM_size_tang', 'f', 0.3, 'tangentialSize'],
    ['op_M3A_HFM_size_sag', 'f', 0.1, 'sagittalSize'],
    ['op_M3A_HFM_ang', 'f', 0.0218166, 'grazingAngle'],
    ['op_M3A_HFM_nvx', 'f', 0.999762027421, 'normalVectorX'],
    ['op_M3A_HFM_nvy', 'f', 0.0, 'normalVectorY'],
    ['op_M3A_HFM_nvz', 'f', -0.0218148693884, 'normalVectorZ'],
    ['op_M3A_HFM_tvx', 'f', 0.0218148693884, 'tangentialVectorX'],
    ['op_M3A_HFM_tvy', 'f', 0.0, 'tangentialVectorY'],
    ['op_M3A_HFM_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_M3A_HFM_x', 'f', 0.0, 'horizontalOffset'],
    ['op_M3A_HFM_y', 'f', 0.0, 'verticalOffset'],

    # M3A_HFM_Watchpoint3: drift
    ['op_M3A_HFM_Watchpoint3_L', 'f', 11.9, 'length'],

    # Pinhole: aperture
    ['op_Pinhole_shape', 's', 'c', 'shape'],
    ['op_Pinhole_Dx', 'f', 1e-05, 'horizontalSize'],
    ['op_Pinhole_Dy', 'f', 1e-05, 'verticalSize'],
    ['op_Pinhole_x', 'f', 0.0, 'horizontalOffset'],
    ['op_Pinhole_y', 'f', 0.0, 'verticalOffset'],

    # Watchpoint4_Sample: drift
    ['op_Watchpoint4_Sample_L', 'f', 1.14, 'length'],

    #---Propagation parameters
    [
        'op_Fixed_Mask_pp', 'f',
        [
            0, 0, 1.0, 0, 0, 1.3, 1.0, 1.3, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0
        ], 'Fixed_Mask'
    ],
    [
        'op_Fixed_Mask_M1A_pp', 'f',
        [
            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
        ], 'Fixed_Mask_M1A'
    ],
    [
        'op_M1A_pp', 'f',
        [
            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
        ], 'M1A'
    ],
    [
        'op_M1A_Watchpoint_pp', 'f',
        [
            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
        ], 'M1A_Watchpoint'
    ],
    [
        'op_M2A_VDM_pp', 'f',
        [
            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
        ], 'M2A_VDM'
    ],
    [
        'op_M2A_VDM_Grating_pp', 'f',
        [
            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
        ], 'M2A_VDM_Grating'
    ],
    [
        'op_Grating_pp', 'f',
        [
            0, 0, 1.0, 0, 0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0580381,
            0.998314, 1.0, 0.0
        ], 'Grating'
    ],
    [
        'op_Grating_Aperture_pp', 'f',
        [
            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
        ], 'Grating_Aperture'
    ],
    [
        'op_Aperture_pp', 'f',
        [
            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
        ], 'Aperture'
    ],
    [
        'op_M3A_HFM_pp', 'f',
        [
            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
        ], 'M3A_HFM'
    ],
    [
        'op_M3A_HFM_Watchpoint3_pp', 'f',
        [
            0, 0, 1.0, 1, 0, 1.0, 8.0, 1.0, 16.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0
        ], 'M3A_HFM_Watchpoint3'
    ],
    [
        'op_Pinhole_pp', 'f',
        [
            0, 0, 1.0, 0, 0, 0.1, 20.0, 0.1, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0
        ], 'Pinhole'
    ],
    [
        'op_Watchpoint4_Sample_pp', 'f',
        [
            0, 0, 1.0, 3, 0, 0.3, 1.0, 0.3, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0
        ], 'Watchpoint4_Sample'
    ],
    [
        'op_fin_pp', 'f',
        [
            0, 0, 1.0, 0, 0, 0.2, 1.0, 0.35, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0
        ], 'final post-propagation (resize) parameters'
    ],

    #[ 0]: Auto-Resize (1) or not (0) Before propagation
    #[ 1]: Auto-Resize (1) or not (0) After propagation
    #[ 2]: Relative Precision for propagation with Auto-Resizing (1. is nominal)
    #[ 3]: Allow (1) or not (0) for semi-analytical treatment of the quadratic (leading) phase terms at the propagation
    #[ 4]: Do any Resizing on Fourier side, using FFT, (1) or not (0)
    #[ 5]: Horizontal Range modification factor at Resizing (1. means no modification)
    #[ 6]: Horizontal Resolution modification factor at Resizing
    #[ 7]: Vertical Range modification factor at Resizing
    #[ 8]: Vertical Resolution modification factor at Resizing
    #[ 9]: Type of wavefront Shift before Resizing (not yet implemented)
    #[10]: New Horizontal wavefront Center position after Shift (not yet implemented)
    #[11]: New Vertical wavefront Center position after Shift (not yet implemented)
    #[12]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Horizontal Coordinate
    #[13]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Vertical Coordinate
    #[14]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Longitudinal Coordinate
    #[15]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Horizontal Coordinate
    #[16]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Vertical Coordinate
])
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'NSLS-II SRX beamline', 'simulation name'],

    #---Data Folder
    [
        'fdir', 's', '',
        'folder (directory) name for reading-in input and saving output data files'
    ],

    #---Electron Beam
    ['ebm_nm', 's', 'NSLS-II Low Beta Day 1', 'standard electron beam name'],
    [
        'ebm_nms', 's', '',
        'standard electron beam name suffix: e.g. can be Day1, Final'
    ],
    ['ebm_i', 'f', 0.5, 'electron beam current [A]'],
    ['ebm_e', 'f', 3.0, 'electron beam avarage energy [GeV]'],
    ['ebm_de', 'f', 0.0, 'electron beam average energy deviation [GeV]'],
    [
        'ebm_x', 'f', 0.0,
        'electron beam initial average horizontal position [m]'
    ],
    ['ebm_y', 'f', 0.0, 'electron beam initial average vertical position [m]'],
    [
        'ebm_xp', 'f', 0.0,
        'electron beam initial average horizontal angle [rad]'
    ],
    ['ebm_yp', 'f', 0.0, 'electron beam initial average vertical angle [rad]'],
    [
        'ebm_z', 'f', 0.,
        'electron beam initial average longitudinal position [m]'
    ],
    [
        'ebm_dr', 'f', 0.0,
        'electron beam longitudinal drift [m] to be performed before a required calculation'
    ],
    ['ebm_ens', 'f', 0.00089, 'electron beam relative energy spread'],
    ['ebm_emx', 'f', 9e-10, 'electron beam horizontal emittance [m]'],
    ['ebm_emy', 'f', 8e-12, 'electron beam vertical emittance [m]'],
    # Definition of the beam through Twiss:
    ['ebm_betax', 'f', 1.84, 'horizontal beta-function [m]'],
    ['ebm_betay', 'f', 1.17, 'vertical beta-function [m]'],
    ['ebm_alphax', 'f', 0.0, 'horizontal alpha-function [rad]'],
    ['ebm_alphay', 'f', 0.0, 'vertical alpha-function [rad]'],
    ['ebm_etax', 'f', 0.0, 'horizontal dispersion function [m]'],
    ['ebm_etay', 'f', 0.0, 'vertical dispersion function [m]'],
    ['ebm_etaxp', 'f', 0.0, 'horizontal dispersion function derivative [rad]'],
    ['ebm_etayp', 'f', 0.0, 'vertical dispersion function derivative [rad]'],
    # Definition of the beam through Moments:
    [
        'ebm_sigx', 'f', 4.06939799e-05,
        'horizontal RMS size of electron beam [m]'
    ],
    [
        'ebm_sigy', 'f', 3.05941171e-06,
        'vertical RMS size of electron beam [m]'
    ],
    [
        'ebm_sigxp', 'f', 2.211629342e-05,
        'horizontal RMS angular divergence of electron beam [rad]'
    ],
    [
        'ebm_sigyp', 'f', 2.6148818e-06,
        'vertical RMS angular divergence of electron beam [rad]'
    ],
    [
        'ebm_mxxp', 'f', 0.0,
        'horizontal position-angle mixed 2nd order moment of electron beam [m]'
    ],
    [
        'ebm_myyp', 'f', 0.0,
        'vertical position-angle mixed 2nd order moment of electron beam [m]'
    ],

    #---Undulator
    ['und_bx', 'f', 0.0, 'undulator horizontal peak magnetic field [T]'],
    ['und_by', 'f', 0.88770981, 'undulator vertical peak magnetic field [T]'],
    [
        'und_phx', 'f', 0.0,
        'initial phase of the horizontal magnetic field [rad]'
    ],
    [
        'und_phy', 'f', 0.0,
        'initial phase of the vertical magnetic field [rad]'
    ],
    [
        'und_b2e', '', '',
        'estimate undulator fundamental photon energy (in [eV]) for the amplitude of sinusoidal magnetic field defined by und_b or und_bx, und_by',
        'store_true'
    ],
    [
        'und_e2b', '', '',
        'estimate undulator field amplitude (in [T]) for the photon energy defined by w_e',
        'store_true'
    ],
    ['und_per', 'f', 0.02, 'undulator period [m]'],
    ['und_len', 'f', 3.0, 'undulator length [m]'],
    ['und_zc', 'f', -1.25, 'undulator center longitudinal position [m]'],
    [
        'und_sx', 'i', 1,
        'undulator horizontal magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_sy', 'i', -1,
        'undulator vertical magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_g', 'f', 6.715,
        'undulator gap [mm] (assumes availability of magnetic measurement or simulation data)'
    ],
    [
        'und_ph', 'f', 0.0,
        'shift of magnet arrays [mm] for which the field should be set up'
    ],
    ['und_mdir', 's', '', 'name of magnetic measurements sub-folder'],
    [
        'und_mfs', 's', '',
        'name of magnetic measurements for different gaps summary file'
    ],

    #---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    [
        'tr_cti', 'f', 0.0,
        'initial time moment (c*t) for electron trajectory calculation [m]'
    ],
    [
        'tr_ctf', 'f', 0.0,
        'final time moment (c*t) for electron trajectory calculation [m]'
    ],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    [
        'tr_mag', 'i', 2,
        'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'
    ],
    [
        'tr_fn', 's', 'res_trj.dat',
        'file name for saving calculated trajectory data'
    ],
    [
        'tr_pl', 's', '',
        'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'
    ],

    #Single-Electron Spectrum vs Photon Energy
    [
        'ss', '', '', 'calculate single-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'ss_ei', 'f', 100.0,
        'initial photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ef', 'f', 20000.0,
        'final photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ne', 'i', 10000,
        'number of points vs photon energy for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_x', 'f', 0.0,
        'horizontal position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_y', 'f', 0.0,
        'vertical position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_meth', 'i', 1,
        'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'ss_prec', 'f', 0.01,
        'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'
    ],
    [
        'ss_pol', 'i', 6,
        'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'ss_mag', 'i', 2,
        'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'
    ],
    [
        'ss_ft', 's', 'f',
        'presentation/domain: "f"- frequency (photon energy), "t"- time'
    ],
    [
        'ss_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'ss_fn', 's', 'res_spec_se.dat',
        'file name for saving calculated single-e spectrum vs photon energy'
    ],
    [
        'ss_pl', 's', '',
        'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    [
        'sm', '', '', 'calculate multi-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'sm_ei', 'f', 100.0,
        'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ef', 'f', 20000.0,
        'final photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ne', 'i', 10000,
        'number of points vs photon energy for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_x', 'f', 0.0,
        'horizontal center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_rx', 'f', 0.001,
        'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_nx', 'i', 1,
        'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_y', 'f', 0.0,
        'vertical center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ry', 'f', 0.001,
        'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ny', 'i', 1,
        'number of points vs vertical position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_mag', 'i', 1,
        'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'
    ],
    [
        'sm_hi', 'i', 1,
        'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_hf', 'i', 15,
        'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_prl', 'f', 1.0,
        'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_pra', 'f', 1.0,
        'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_meth', 'i', -1,
        'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'
    ],
    [
        'sm_prec', 'f', 0.01,
        'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'
    ],
    [
        'sm_nm', 'i', 1,
        'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_na', 'i', 5,
        'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'
    ],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    [
        'sm_pol', 'i', 6,
        'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'sm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'sm_fn', 's', 'res_spec_me.dat',
        'file name for saving calculated milti-e spectrum vs photon energy'
    ],
    [
        'sm_pl', 's', '',
        'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    [
        'pw_x', 'f', 0.0,
        'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_rx', 'f', 0.025,
        'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_nx', 'i', 100,
        'number of points vs horizontal position for calculation of power density distribution'
    ],
    [
        'pw_y', 'f', 0.0,
        'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ry', 'f', 0.025,
        'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ny', 'i', 100,
        'number of points vs vertical position for calculation of power density distribution'
    ],
    [
        'pw_pr', 'f', 1.0,
        'precision factor for calculation of power density distribution'
    ],
    [
        'pw_meth', 'i', 1,
        'power density computation method (1- "near field", 2- "far field")'
    ],
    [
        'pw_zst', 'f', 0.,
        'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_zfi', 'f', 0.,
        'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_mag', 'i', 1,
        'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'
    ],
    [
        'pw_fn', 's', 'res_pow.dat',
        'file name for saving calculated power density distribution'
    ],
    [
        'pw_pl', 's', '',
        'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    [
        'si', '', '',
        'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position',
        'store_true'
    ],
    #Single-Electron Wavefront Propagation
    [
        'ws', '', '',
        'calculate single-electron (/ fully coherent) wavefront propagation',
        'store_true'
    ],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    [
        'wm', '', '',
        'calculate multi-electron (/ partially coherent) wavefront propagation',
        'store_true'
    ],
    [
        'w_e', 'f', 8000.0,
        'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ef', 'f', -1.0,
        'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ne', 'i', 1,
        'number of points vs photon energy for calculation of intensity distribution'
    ],
    [
        'w_x', 'f', 0.0,
        'central horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_rx', 'f', 0.0025,
        'range of horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_nx', 'i', 100,
        'number of points vs horizontal position for calculation of intensity distribution'
    ],
    [
        'w_y', 'f', 0.0,
        'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ry', 'f', 0.0013,
        'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ny', 'i', 100,
        'number of points vs vertical position for calculation of intensity distribution'
    ],
    [
        'w_smpf', 'f', 0.1,
        'sampling factor for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_meth', 'i', 1,
        'method to use for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_prec', 'f', 0.01,
        'relative precision for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'si_pol', 'i', 6,
        'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'si_type', 'i', 0,
        'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'
    ],
    [
        'w_mag', 'i', 2,
        'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'
    ],
    [
        'si_fn', 's', 'res_int_se.dat',
        'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'
    ],
    [
        'si_pl', 's', '',
        'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'ws_fni', 's', 'res_int_pr_se.dat',
        'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'
    ],
    [
        'ws_pl', 's', '',
        'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'wm_nm', 'i', 100000,
        'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_na', 'i', 5,
        'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'
    ],
    [
        'wm_ch', 'i', 0,
        'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y'
    ],
    [
        'wm_ap', 'i', 0,
        'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'
    ],
    [
        'wm_x0', 'f', 0,
        'horizontal center position for mutual intensity cut calculation'
    ],
    [
        'wm_y0', 'f', 0,
        'vertical center position for mutual intensity cut calculation'
    ],
    [
        'wm_ei', 'i', 0,
        'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'
    ],
    [
        'wm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'wm_am', 'i', 0,
        'multi-electron integration approximation method: 0- no approximation (use the standard 5D integration method), 1- integrate numerically only over e-beam energy spread and use convolution to treat transverse emittance'
    ],
    [
        'wm_fni', 's', 'res_int_pr_me.dat',
        'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'
    ],

    #to add options
    [
        'op_r', 'f', 20.0,
        'longitudinal position of the first optical element [m]'
    ],

    # Former appParam:
    [
        'source_type', 's', 't',
        'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'
    ],

    #---Beamline optics:
    # S0: aperture
    ['op_S0_shape', 's', 'r', 'shape'],
    ['op_S0_Dx', 'f', 0.002, 'horizontalSize'],
    ['op_S0_Dy', 'f', 0.001, 'verticalSize'],
    ['op_S0_x', 'f', 0.0, 'horizontalOffset'],
    ['op_S0_y', 'f', 0.0, 'verticalOffset'],

    # S0_HFM: drift
    ['op_S0_HFM_L', 'f', 1.081, 'length'],

    # HFM: sphericalMirror
    ['op_HFM_hfn', 's', 'None', 'heightProfileFile'],
    ['op_HFM_dim', 's', 'x', 'orientation'],
    ['op_HFM_r', 'f', 8871.45, 'radius'],
    ['op_HFM_size_tang', 'f', 0.95, 'tangentialSize'],
    ['op_HFM_size_sag', 'f', 0.005, 'sagittalSize'],
    ['op_HFM_ang', 'f', 0.0025, 'grazingAngle'],
    ['op_HFM_nvx', 'f', 0.999996875002, 'normalVectorX'],
    ['op_HFM_nvy', 'f', 0.0, 'normalVectorY'],
    ['op_HFM_nvz', 'f', -0.00249999739583, 'normalVectorZ'],
    ['op_HFM_tvx', 'f', 0.00249999739583, 'tangentialVectorX'],
    ['op_HFM_tvy', 'f', 0.0, 'tangentialVectorY'],
    ['op_HFM_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_HFM_x', 'f', 0.0, 'horizontalOffset'],
    ['op_HFM_y', 'f', 0.0, 'verticalOffset'],

    # HFM_S1: drift
    ['op_HFM_S1_L', 'f', 1.407, 'length'],

    # S1: aperture
    ['op_S1_shape', 's', 'r', 'shape'],
    ['op_S1_Dx', 'f', 0.0024, 'horizontalSize'],
    ['op_S1_Dy', 'f', 0.0015, 'verticalSize'],
    ['op_S1_x', 'f', 0.0, 'horizontalOffset'],
    ['op_S1_y', 'f', 0.0, 'verticalOffset'],

    # S1_DCM_C1: drift
    ['op_S1_DCM_C1_L', 'f', 0.781, 'length'],

    # DCM_C1: crystal
    ['op_DCM_C1_hfn', 's', '', 'heightProfileFile'],
    ['op_DCM_C1_dim', 's', 'x', 'orientation'],
    ['op_DCM_C1_d_sp', 'f', 3.13557135638, 'dSpacing'],
    ['op_DCM_C1_psi0r', 'f', -1.53227839905e-05, 'psi0r'],
    ['op_DCM_C1_psi0i', 'f', 3.59410775406e-07, 'psi0i'],
    ['op_DCM_C1_psiHr', 'f', -8.10706354484e-06, 'psiHr'],
    ['op_DCM_C1_psiHi', 'f', 2.50931132347e-07, 'psiHi'],
    ['op_DCM_C1_psiHBr', 'f', -8.10706354484e-06, 'psiHBr'],
    ['op_DCM_C1_psiHBi', 'f', 2.50931132347e-07, 'psiHBi'],
    ['op_DCM_C1_tc', 'f', 0.01, 'crystalThickness'],
    ['op_DCM_C1_ang_as', 'f', 0.0, 'asymmetryAngle'],
    ['op_DCM_C1_nvx', 'f', -0.968973817886, 'nvx'],
    ['op_DCM_C1_nvy', 'f', 2.59635532439e-08, 'nvy'],
    ['op_DCM_C1_nvz', 'f', -0.247163387763, 'nvz'],
    ['op_DCM_C1_tvx', 'f', -0.247163387763, 'tvx'],
    ['op_DCM_C1_tvy', 'f', 6.62271741473e-09, 'tvy'],
    ['op_DCM_C1_ang', 'f', 1.57079632, 'grazingAngle'],
    ['op_DCM_C1_amp_coef', 'f', 1.0, 'heightAmplification'],

    # DCM_C2: crystal
    ['op_DCM_C2_hfn', 's', '', 'heightProfileFile'],
    ['op_DCM_C2_dim', 's', 'x', 'orientation'],
    ['op_DCM_C2_d_sp', 'f', 3.13557135638, 'dSpacing'],
    ['op_DCM_C2_psi0r', 'f', -1.53227839905e-05, 'psi0r'],
    ['op_DCM_C2_psi0i', 'f', 3.59410775406e-07, 'psi0i'],
    ['op_DCM_C2_psiHr', 'f', -8.10706354484e-06, 'psiHr'],
    ['op_DCM_C2_psiHi', 'f', 2.50931132347e-07, 'psiHi'],
    ['op_DCM_C2_psiHBr', 'f', -8.10706354484e-06, 'psiHBr'],
    ['op_DCM_C2_psiHBi', 'f', 2.50931132347e-07, 'psiHBi'],
    ['op_DCM_C2_tc', 'f', 0.01, 'crystalThickness'],
    ['op_DCM_C2_ang_as', 'f', 0.0, 'asymmetryAngle'],
    ['op_DCM_C2_nvx', 'f', 0.968973817886, 'nvx'],
    ['op_DCM_C2_nvy', 'f', 0.0, 'nvy'],
    ['op_DCM_C2_nvz', 'f', -0.247163387763, 'nvz'],
    ['op_DCM_C2_tvx', 'f', 0.247163387763, 'tvx'],
    ['op_DCM_C2_tvy', 'f', 0.0, 'tvy'],
    ['op_DCM_C2_ang', 'f', -1.57079632, 'grazingAngle'],
    ['op_DCM_C2_amp_coef', 'f', 1.0, 'heightAmplification'],

    # DCM_C2_At_BPM1: drift
    ['op_DCM_C2_At_BPM1_L', 'f', 2.2416, 'length'],

    # At_BPM1_Before_SSA: drift
    ['op_At_BPM1_Before_SSA_L', 'f', 11.9668, 'length'],

    # SSA: aperture
    ['op_SSA_shape', 's', 'r', 'shape'],
    ['op_SSA_Dx', 'f', 5e-05, 'horizontalSize'],
    ['op_SSA_Dy', 'f', 0.003, 'verticalSize'],
    ['op_SSA_x', 'f', 0.0, 'horizontalOffset'],
    ['op_SSA_y', 'f', 0.0, 'verticalOffset'],

    # SSA_AKB: drift
    ['op_SSA_AKB_L', 'f', 11.8308, 'length'],

    # AKB: aperture
    ['op_AKB_shape', 's', 'r', 'shape'],
    ['op_AKB_Dx', 'f', 0.003, 'horizontalSize'],
    ['op_AKB_Dy', 'f', 0.000875, 'verticalSize'],
    ['op_AKB_x', 'f', 0.0, 'horizontalOffset'],
    ['op_AKB_y', 'f', 0.0, 'verticalOffset'],

    # AKB_KBV: drift
    ['op_AKB_KBV_L', 'f', 0.175, 'length'],

    # KBV: ellipsoidMirror
    ['op_KBV_hfn', 's', '', 'heightProfileFile'],
    ['op_KBV_dim', 's', 'x', 'orientation'],
    ['op_KBV_p', 'f', 63.913, 'firstFocusLength'],
    ['op_KBV_q', 'f', 0.637, 'focalLength'],
    ['op_KBV_ang', 'f', 0.0025, 'grazingAngle'],
    ['op_KBV_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_KBV_size_tang', 'f', 0.35, 'tangentialSize'],
    ['op_KBV_size_sag', 'f', 0.003, 'sagittalSize'],
    ['op_KBV_nvx', 'f', 0.0, 'normalVectorX'],
    ['op_KBV_nvy', 'f', 0.999996875002, 'normalVectorY'],
    ['op_KBV_nvz', 'f', -0.00249999739583, 'normalVectorZ'],
    ['op_KBV_tvx', 'f', 0.0, 'tangentialVectorX'],
    ['op_KBV_tvy', 'f', -0.00249999739583, 'tangentialVectorY'],
    ['op_KBV_x', 'f', 0.0, 'horizontalOffset'],
    ['op_KBV_y', 'f', 0.0, 'verticalOffset'],

    # KBV_KBH: drift
    ['op_KBV_KBH_L', 'f', 0.337, 'length'],

    # KBH: ellipsoidMirror
    ['op_KBH_hfn', 's', '', 'heightProfileFile'],
    ['op_KBH_dim', 's', 'x', 'orientation'],
    ['op_KBH_p', 'f', 12.3428, 'firstFocusLength'],
    ['op_KBH_q', 'f', 0.3, 'focalLength'],
    ['op_KBH_ang', 'f', 0.0025, 'grazingAngle'],
    ['op_KBH_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_KBH_size_tang', 'f', 0.3, 'tangentialSize'],
    ['op_KBH_size_sag', 'f', 0.003, 'sagittalSize'],
    ['op_KBH_nvx', 'f', 0.999996875002, 'normalVectorX'],
    ['op_KBH_nvy', 'f', 0.0, 'normalVectorY'],
    ['op_KBH_nvz', 'f', -0.00249999739583, 'normalVectorZ'],
    ['op_KBH_tvx', 'f', -0.00249999739583, 'tangentialVectorX'],
    ['op_KBH_tvy', 'f', 0.0, 'tangentialVectorY'],
    ['op_KBH_x', 'f', 0.0, 'horizontalOffset'],
    ['op_KBH_y', 'f', 0.0, 'verticalOffset'],

    # KBH_At_Sample: drift
    ['op_KBH_At_Sample_L', 'f', 0.3, 'length'],

    #---Propagation parameters
    [
        'op_S0_pp', 'f',
        [
            0, 0, 1.0, 0, 0, 1.1, 7.0, 1.3, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0
        ], 'S0'
    ],
    [
        'op_S0_HFM_pp', 'f',
        [
            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
        ], 'S0_HFM'
    ],
    [
        'op_HFM_pp', 'f',
        [
            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
        ], 'HFM'
    ],
    [
        'op_HFM_S1_pp', 'f',
        [
            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
        ], 'HFM_S1'
    ],
    [
        'op_S1_pp', 'f',
        [
            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
        ], 'S1'
    ],
    [
        'op_S1_DCM_C1_pp', 'f',
        [
            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
        ], 'S1_DCM_C1'
    ],
    [
        'op_DCM_C1_pp', 'f',
        [
            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
        ], 'DCM_C1'
    ],
    [
        'op_DCM_C2_pp', 'f',
        [
            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
        ], 'DCM_C2'
    ],
    [
        'op_DCM_C2_At_BPM1_pp', 'f',
        [
            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
        ], 'DCM_C2_At_BPM1'
    ],
    [
        'op_At_BPM1_Before_SSA_pp', 'f',
        [
            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
        ], 'At_BPM1_Before_SSA'
    ],
    [
        'op_SSA_pp', 'f',
        [
            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
        ], 'SSA'
    ],
    [
        'op_SSA_AKB_pp', 'f',
        [
            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
        ], 'SSA_AKB'
    ],
    [
        'op_AKB_pp', 'f',
        [
            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
        ], 'AKB'
    ],
    [
        'op_AKB_KBV_pp', 'f',
        [
            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
        ], 'AKB_KBV'
    ],
    [
        'op_KBV_pp', 'f',
        [
            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
        ], 'KBV'
    ],
    [
        'op_KBV_KBH_pp', 'f',
        [
            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
        ], 'KBV_KBH'
    ],
    [
        'op_KBH_pp', 'f',
        [
            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'
    ],
    [
        'op_KBH_At_Sample_pp', 'f',
        [
            0, 0, 1.0, 4, 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_At_Sample'
    ],
    [
        'op_fin_pp', 'f',
        [
            0, 0, 1.0, 0, 1, 0.5, 1.0, 0.2, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0
        ], 'final post-propagation (resize) parameters'
    ],

    #[ 0]: Auto-Resize (1) or not (0) Before propagation
    #[ 1]: Auto-Resize (1) or not (0) After propagation
    #[ 2]: Relative Precision for propagation with Auto-Resizing (1. is nominal)
    #[ 3]: Allow (1) or not (0) for semi-analytical treatment of the quadratic (leading) phase terms at the propagation
    #[ 4]: Do any Resizing on Fourier side, using FFT, (1) or not (0)
    #[ 5]: Horizontal Range modification factor at Resizing (1. means no modification)
    #[ 6]: Horizontal Resolution modification factor at Resizing
    #[ 7]: Vertical Range modification factor at Resizing
    #[ 8]: Vertical Resolution modification factor at Resizing
    #[ 9]: Type of wavefront Shift before Resizing (not yet implemented)
    #[10]: New Horizontal wavefront Center position after Shift (not yet implemented)
    #[11]: New Vertical wavefront Center position after Shift (not yet implemented)
    #[12]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Horizontal Coordinate
    #[13]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Vertical Coordinate
    #[14]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Longitudinal Coordinate
    #[15]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Horizontal Coordinate
    #[16]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Vertical Coordinate
])
Exemple #20
0
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'Mask example', 'simulation name'],

    #---Data Folder
    [
        'fdir', 's', '',
        'folder (directory) name for reading-in input and saving output data files'
    ],
    ['gbm_x', 'f', 0.0, 'average horizontal coordinates of waist [m]'],
    ['gbm_y', 'f', 0.0, 'average vertical coordinates of waist [m]'],
    ['gbm_z', 'f', 0.0, 'average longitudinal coordinate of waist [m]'],
    ['gbm_xp', 'f', 0.0, 'average horizontal angle at waist [rad]'],
    ['gbm_yp', 'f', 0.0, 'average verical angle at waist [rad]'],
    ['gbm_ave', 'f', 9000.0, 'average photon energy [eV]'],
    ['gbm_pen', 'f', 0.001, 'energy per pulse [J]'],
    ['gbm_rep', 'f', 1, 'rep. rate [Hz]'],
    [
        'gbm_pol', 'f', 1,
        'polarization 1- lin. hor., 2- lin. vert., 3- lin. 45 deg., 4- lin.135 deg., 5- circ. right, 6- circ. left'
    ],
    [
        'gbm_sx', 'f', 3e-06,
        'rms beam size vs horizontal position [m] at waist (for intensity)'
    ],
    [
        'gbm_sy', 'f', 3e-06,
        'rms beam size vs vertical position [m] at waist (for intensity)'
    ],
    ['gbm_st', 'f', 1e-13, 'rms pulse duration [s] (for intensity)'],
    [
        'gbm_mx', 'f', 0,
        'transverse Gauss-Hermite mode order in horizontal direction'
    ],
    [
        'gbm_my', 'f', 0,
        'transverse Gauss-Hermite mode order in vertical direction'
    ],
    [
        'gbm_ca', 's', 'c',
        'treat _sigX, _sigY as sizes in [m] in coordinate representation (_presCA="c") or as angular divergences in [rad] in angular representation (_presCA="a")'
    ],
    [
        'gbm_ft', 's', 't',
        'treat _sigT as pulse duration in [s] in time domain/representation (_presFT="t") or as bandwidth in [eV] in frequency domain/representation (_presFT="f")'
    ],

    #---Calculation Types
    # Electron Trajectory
    ['tr', '', '', 'calculate electron trajectory', 'store_true'],
    [
        'tr_cti', 'f', 0.0,
        'initial time moment (c*t) for electron trajectory calculation [m]'
    ],
    [
        'tr_ctf', 'f', 0.0,
        'final time moment (c*t) for electron trajectory calculation [m]'
    ],
    ['tr_np', 'f', 10000, 'number of points for trajectory calculation'],
    [
        'tr_mag', 'i', 1,
        'magnetic field to be used for trajectory calculation: 1- approximate, 2- accurate'
    ],
    [
        'tr_fn', 's', 'res_trj.dat',
        'file name for saving calculated trajectory data'
    ],
    [
        'tr_pl', 's', '',
        'plot the resulting trajectiry in graph(s): ""- dont plot, otherwise the string should list the trajectory components to plot'
    ],

    #Single-Electron Spectrum vs Photon Energy
    [
        'ss', '', '', 'calculate single-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'ss_ei', 'f', 100.0,
        'initial photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ef', 'f', 20000.0,
        'final photon energy [eV] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_ne', 'i', 10000,
        'number of points vs photon energy for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_x', 'f', 0.0,
        'horizontal position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_y', 'f', 0.0,
        'vertical position [m] for single-e spectrum vs photon energy calculation'
    ],
    [
        'ss_meth', 'i', 1,
        'method to use for single-e spectrum vs photon energy calculation: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'ss_prec', 'f', 0.01,
        'relative precision for single-e spectrum vs photon energy calculation (nominal value is 0.01)'
    ],
    [
        'ss_pol', 'i', 6,
        'polarization component to extract after spectrum vs photon energy calculation: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'ss_mag', 'i', 1,
        'magnetic field to be used for single-e spectrum vs photon energy calculation: 1- approximate, 2- accurate'
    ],
    [
        'ss_ft', 's', 'f',
        'presentation/domain: "f"- frequency (photon energy), "t"- time'
    ],
    [
        'ss_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'ss_fn', 's', 'res_spec_se.dat',
        'file name for saving calculated single-e spectrum vs photon energy'
    ],
    [
        'ss_pl', 's', '',
        'plot the resulting single-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    [
        'sm', '', '', 'calculate multi-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'sm_ei', 'f', 100.0,
        'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ef', 'f', 20000.0,
        'final photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ne', 'i', 10000,
        'number of points vs photon energy for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_x', 'f', 0.0,
        'horizontal center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_rx', 'f', 0.001,
        'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_nx', 'i', 1,
        'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_y', 'f', 0.0,
        'vertical center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ry', 'f', 0.001,
        'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ny', 'i', 1,
        'number of points vs vertical position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_mag', 'i', 1,
        'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'
    ],
    [
        'sm_hi', 'i', 1,
        'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_hf', 'i', 15,
        'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_prl', 'f', 1.0,
        'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_pra', 'f', 1.0,
        'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_meth', 'i', -1,
        'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'
    ],
    [
        'sm_prec', 'f', 0.01,
        'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'
    ],
    [
        'sm_nm', 'i', 1,
        'number of macro-electrons for calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_na', 'i', 5,
        'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'
    ],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    [
        'sm_pol', 'i', 6,
        'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'sm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'sm_fn', 's', 'res_spec_me.dat',
        'file name for saving calculated milti-e spectrum vs photon energy'
    ],
    [
        'sm_pl', 's', '',
        'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],
    #to add options for the multi-e calculation from "accurate" magnetic field

    #Power Density Distribution vs horizontal and vertical position
    ['pw', '', '', 'calculate SR power density distribution', 'store_true'],
    [
        'pw_x', 'f', 0.0,
        'central horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_rx', 'f', 0.015,
        'range of horizontal position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_nx', 'i', 100,
        'number of points vs horizontal position for calculation of power density distribution'
    ],
    [
        'pw_y', 'f', 0.0,
        'central vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ry', 'f', 0.015,
        'range of vertical position [m] for calculation of power density distribution vs horizontal and vertical position'
    ],
    [
        'pw_ny', 'i', 100,
        'number of points vs vertical position for calculation of power density distribution'
    ],
    [
        'pw_pr', 'f', 1.0,
        'precision factor for calculation of power density distribution'
    ],
    [
        'pw_meth', 'i', 1,
        'power density computation method (1- "near field", 2- "far field")'
    ],
    [
        'pw_zst', 'f', 0.,
        'initial longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_zfi', 'f', 0.,
        'final longitudinal position along electron trajectory of power density distribution (effective if pow_sst < pow_sfi)'
    ],
    [
        'pw_mag', 'i', 1,
        'magnetic field to be used for power density calculation: 1- approximate, 2- accurate'
    ],
    [
        'pw_fn', 's', 'res_pow.dat',
        'file name for saving calculated power density distribution'
    ],
    [
        'pw_pl', 's', '',
        'plot the resulting power density distribution in a graph: ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],

    #Single-Electron Intensity distribution vs horizontal and vertical position
    [
        'si', '', '',
        'calculate single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position',
        'store_true'
    ],
    #Single-Electron Wavefront Propagation
    [
        'ws', '', '',
        'calculate single-electron (/ fully coherent) wavefront propagation',
        'store_true'
    ],
    #Multi-Electron (partially-coherent) Wavefront Propagation
    [
        'wm', '', '',
        'calculate multi-electron (/ partially coherent) wavefront propagation',
        'store_true'
    ],
    [
        'w_e', 'f', 9000.0,
        'photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ef', 'f', -1.0,
        'final photon energy [eV] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ne', 'i', 1,
        'number of points vs photon energy for calculation of intensity distribution'
    ],
    [
        'w_x', 'f', 0.0,
        'central horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_rx', 'f', 0.002,
        'range of horizontal position [m] for calculation of intensity distribution'
    ],
    [
        'w_nx', 'i', 2048,
        'number of points vs horizontal position for calculation of intensity distribution'
    ],
    [
        'w_y', 'f', 0.0,
        'central vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ry', 'f', 0.002,
        'range of vertical position [m] for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_ny', 'i', 2048,
        'number of points vs vertical position for calculation of intensity distribution'
    ],
    [
        'w_smpf', 'f', 0,
        'sampling factor for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_meth', 'i', 2,
        'method to use for calculation of intensity distribution vs horizontal and vertical position: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler"'
    ],
    [
        'w_prec', 'f', 0.01,
        'relative precision for calculation of intensity distribution vs horizontal and vertical position'
    ],
    [
        'w_u', 'i', 1,
        'electric field units: 0- arbitrary, 1- sqrt(Phot/s/0.1%bw/mm^2), 2- sqrt(J/eV/mm^2) or sqrt(W/mm^2), depending on representation (freq. or time)'
    ],
    [
        'si_pol', 'i', 6,
        'polarization component to extract after calculation of intensity distribution: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'si_type', 'i', 0,
        'type of a characteristic to be extracted after calculation of intensity distribution: 0- Single-Electron Intensity, 1- Multi-Electron Intensity, 2- Single-Electron Flux, 3- Multi-Electron Flux, 4- Single-Electron Radiation Phase, 5- Re(E): Real part of Single-Electron Electric Field, 6- Im(E): Imaginary part of Single-Electron Electric Field, 7- Single-Electron Intensity, integrated over Time or Photon Energy'
    ],
    [
        'w_mag', 'i', 1,
        'magnetic field to be used for calculation of intensity distribution vs horizontal and vertical position: 1- approximate, 2- accurate'
    ],
    [
        'si_fn', 's', 'res_int_se.dat',
        'file name for saving calculated single-e intensity distribution (without wavefront propagation through a beamline) vs horizontal and vertical position'
    ],
    [
        'si_pl', 's', '',
        'plot the input intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'ws_fni', 's', 'res_int_pr_se.dat',
        'file name for saving propagated single-e intensity distribution vs horizontal and vertical position'
    ],
    [
        'ws_pl', 's', '',
        'plot the resulting intensity distributions in graph(s): ""- dont plot, "x"- vs horizontal position, "y"- vs vertical position, "xy"- vs horizontal and vertical position'
    ],
    [
        'wm_nm', 'i', 100000,
        'number of macro-electrons (coherent wavefronts) for calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_na', 'i', 5,
        'number of macro-electrons (coherent wavefronts) to average on each node for parallel (MPI-based) calculation of multi-electron wavefront propagation'
    ],
    [
        'wm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons / coherent wavefronts) for intermediate intensity at multi-electron wavefront propagation calculation'
    ],
    [
        'wm_ch', 'i', 0,
        'type of a characteristic to be extracted after calculation of multi-electron wavefront propagation: #0- intensity (s0); 1- four Stokes components; 2- mutual intensity cut vs x; 3- mutual intensity cut vs y'
    ],
    [
        'wm_ap', 'i', 0,
        'switch specifying representation of the resulting Stokes parameters: coordinate (0) or angular (1)'
    ],
    [
        'wm_x0', 'f', 0,
        'horizontal center position for mutual intensity cut calculation'
    ],
    [
        'wm_y0', 'f', 0,
        'vertical center position for mutual intensity cut calculation'
    ],
    [
        'wm_ei', 'i', 0,
        'integration over photon energy is required (1) or not (0); if the integration is required, the limits are taken from w_e, w_ef'
    ],
    [
        'wm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'wm_am', 'i', 0,
        'multi-electron integration approximation method: 0- no approximation (use the standard 5D integration method), 1- integrate numerically only over e-beam energy spread and use convolution to treat transverse emittance'
    ],
    [
        'wm_fni', 's', 'res_int_pr_me.dat',
        'file name for saving propagated multi-e intensity distribution vs horizontal and vertical position'
    ],

    #to add options
    [
        'op_r', 'f', 20.0,
        'longitudinal position of the first optical element [m]'
    ],

    # Former appParam:
    [
        'rs_type', 's', 'g',
        'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'
    ],

    #---Beamline optics:
    # VFM: ellipsoidMirror
    ['op_VFM_hfn', 's', 'None', 'heightProfileFile'],
    ['op_VFM_dim', 's', 'x', 'orientation'],
    ['op_VFM_p', 'f', 50.0, 'firstFocusLength'],
    ['op_VFM_q', 'f', 0.4, 'focalLength'],
    ['op_VFM_ang', 'f', 0.003, 'grazingAngle'],
    ['op_VFM_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_VFM_size_tang', 'f', 0.2, 'tangentialSize'],
    ['op_VFM_size_sag', 'f', 0.01, 'sagittalSize'],
    ['op_VFM_nvx', 'f', 0.0, 'normalVectorX'],
    ['op_VFM_nvy', 'f', 0.999995500003, 'normalVectorY'],
    ['op_VFM_nvz', 'f', -0.0029999955, 'normalVectorZ'],
    ['op_VFM_tvx', 'f', 0.0, 'tangentialVectorX'],
    ['op_VFM_tvy', 'f', -0.0029999955, 'tangentialVectorY'],
    ['op_VFM_x', 'f', 0.0, 'horizontalOffset'],
    ['op_VFM_y', 'f', 0.0, 'verticalOffset'],

    # VFM_HFM: drift
    ['op_VFM_HFM_L', 'f', 0.2, 'length'],

    # HFM: ellipsoidMirror
    ['op_HFM_hfn', 's', 'None', 'heightProfileFile'],
    ['op_HFM_dim', 's', 'x', 'orientation'],
    ['op_HFM_p', 'f', 50.0, 'firstFocusLength'],
    ['op_HFM_q', 'f', 0.2, 'focalLength'],
    ['op_HFM_ang', 'f', 0.003, 'grazingAngle'],
    ['op_HFM_amp_coef', 'f', 1.0, 'heightAmplification'],
    ['op_HFM_size_tang', 'f', 0.2, 'tangentialSize'],
    ['op_HFM_size_sag', 'f', 0.01, 'sagittalSize'],
    ['op_HFM_nvx', 'f', 0.999995500003, 'normalVectorX'],
    ['op_HFM_nvy', 'f', 0.0, 'normalVectorY'],
    ['op_HFM_nvz', 'f', -0.0029999955, 'normalVectorZ'],
    ['op_HFM_tvx', 'f', -0.0029999955, 'tangentialVectorX'],
    ['op_HFM_tvy', 'f', 0.0, 'tangentialVectorY'],
    ['op_HFM_x', 'f', 0.0, 'horizontalOffset'],
    ['op_HFM_y', 'f', 0.0, 'verticalOffset'],

    # HFM_Watchpoint: drift
    ['op_HFM_Watchpoint_L', 'f', 0.2, 'length'],

    # Watchpoint_Mask: drift
    ['op_Watchpoint_Mask_L', 'f', 0.2, 'length'],

    # Mask: mask
    ['op_Mask_delta', 'f', 1.0, 'refractiveIndex'],
    ['op_Mask_atten_len', 'f', 1.0, 'attenuationLength'],
    ['op_Mask_thick', 'f', 1.0, 'maskThickness'],
    ['op_Mask_grid_sh', 'f', 0, 'gridShape'],
    ['op_Mask_grid_dx', 'f', 5e-06, 'horizontalGridDimension'],
    ['op_Mask_grid_dy', 'f', 5e-06, 'verticalGridDimension'],
    ['op_Mask_pitch_x', 'f', 2e-05, 'horizontalGridPitch'],
    ['op_Mask_pitch_y', 'f', 2e-05, 'verticalGridPitch'],
    ['op_Mask_gridTiltAngle', 'f', 0.436332312999, 'gridTiltAngle'],
    ['op_Mask_hx', 'f', 7.32e-07, 'horizontalSamplingInterval'],
    ['op_Mask_hy', 'f', 7.32e-07, 'verticalSamplingInterval'],
    ['op_Mask_mask_x0', 'f', 0.0, 'horizontalMaskCoordinate'],
    ['op_Mask_mask_y0', 'f', 0.0, 'verticalMaskCoordinate'],
    ['op_Mask_mask_Nx', 'i', 1024, 'horizontalPixelsNumber'],
    ['op_Mask_mask_Ny', 'i', 1024, 'verticalPixelsNumber'],
    ['op_Mask_grid_nx', 'i', 21, 'horizontalGridsNumber'],
    ['op_Mask_grid_ny', 'i', 21, 'verticalGridsNumber'],

    #---Propagation parameters
    [
        'op_VFM_pp', 'f',
        [
            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
        ], 'VFM'
    ],
    [
        'op_VFM_HFM_pp', 'f',
        [
            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
        ], 'VFM_HFM'
    ],
    [
        'op_HFM_pp', 'f',
        [
            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
        ], 'HFM'
    ],
    [
        'op_HFM_Watchpoint_pp', 'f',
        [
            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
        ], 'HFM_Watchpoint'
    ],
    [
        'op_Watchpoint_Mask_pp', 'f',
        [
            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
        ], 'Watchpoint_Mask'
    ],
    [
        'op_Mask_pp', 'f',
        [
            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
        ], 'Mask'
    ],
    [
        'op_fin_pp', 'f',
        [
            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
        ], 'final post-propagation (resize) parameters'
    ],

    #[ 0]: Auto-Resize (1) or not (0) Before propagation
    #[ 1]: Auto-Resize (1) or not (0) After propagation
    #[ 2]: Relative Precision for propagation with Auto-Resizing (1. is nominal)
    #[ 3]: Allow (1) or not (0) for semi-analytical treatment of the quadratic (leading) phase terms at the propagation
    #[ 4]: Do any Resizing on Fourier side, using FFT, (1) or not (0)
    #[ 5]: Horizontal Range modification factor at Resizing (1. means no modification)
    #[ 6]: Horizontal Resolution modification factor at Resizing
    #[ 7]: Vertical Range modification factor at Resizing
    #[ 8]: Vertical Resolution modification factor at Resizing
    #[ 9]: Type of wavefront Shift before Resizing (not yet implemented)
    #[10]: New Horizontal wavefront Center position after Shift (not yet implemented)
    #[11]: New Vertical wavefront Center position after Shift (not yet implemented)
    #[12]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Horizontal Coordinate
    #[13]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Vertical Coordinate
    #[14]: Optional: Orientation of the Output Optical Axis vector in the Incident Beam Frame: Longitudinal Coordinate
    #[15]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Horizontal Coordinate
    #[16]: Optional: Orientation of the Horizontal Base vector of the Output Frame in the Incident Beam Frame: Vertical Coordinate
])
varParam = srwl_bl.srwl_uti_ext_options([
    ['name', 's', 'Tabulated Undulator Example', 'simulation name'],

    #---Data Folder
    [
        'fdir', 's', 'multielectron_test',
        'folder (directory) name for reading-in input and saving output data files'
    ],

    #---Electron Beam
    ['ebm_nm', 's', '', 'standard electron beam name'],
    [
        'ebm_nms', 's', '',
        'standard electron beam name suffix: e.g. can be Day1, Final'
    ],
    ['ebm_i', 'f', 0.5, 'electron beam current [A]'],
    ['ebm_e', 'f', 3.0, 'electron beam avarage energy [GeV]'],
    ['ebm_de', 'f', 0.0, 'electron beam average energy deviation [GeV]'],
    [
        'ebm_x', 'f', 0.0,
        'electron beam initial average horizontal position [m]'
    ],
    ['ebm_y', 'f', 0.0, 'electron beam initial average vertical position [m]'],
    [
        'ebm_xp', 'f', 0.,
        'electron beam initial average horizontal angle [rad]'
    ],
    ['ebm_yp', 'f', 0., 'electron beam initial average vertical angle [rad]'],
    [
        'ebm_z', 'f', 0.,
        'electron beam initial average longitudinal position [m]'
    ],
    [
        'ebm_dr', 'f', 0.0,
        'electron beam longitudinal drift [m] to be performed before a required calculation'
    ],
    ['ebm_ens', 'f', 0.0007, 'electron beam relative energy spread'],
    ['ebm_emx', 'f', 1.5e-09, 'electron beam horizontal emittance [m]'],
    ['ebm_emy', 'f', 8e-12, 'electron beam vertical emittance [m]'],
    # Definition of the beam through Twiss:
    ['ebm_betax', 'f', 1.84, 'horizontal beta-function [m]'],
    ['ebm_betay', 'f', 1.17, 'vertical beta-function [m]'],
    ['ebm_alphax', 'f', 0.0, 'horizontal alpha-function [rad]'],
    ['ebm_alphay', 'f', 0.0, 'vertical alpha-function [rad]'],
    ['ebm_etax', 'f', 0.0, 'horizontal dispersion function [m]'],
    ['ebm_etay', 'f', 0.0, 'vertical dispersion function [m]'],
    ['ebm_etaxp', 'f', 0.0, 'horizontal dispersion function derivative [rad]'],
    ['ebm_etayp', 'f', 0.0, 'vertical dispersion function derivative [rad]'],
    # Definition of the beam through Moments:
    [
        'ebm_sigx', 'f', 5.253570215e-05,
        'horizontal RMS size of electron beam [m]'
    ],
    [
        'ebm_sigy', 'f', 3.05941171e-06,
        'vertical RMS size of electron beam [m]'
    ],
    [
        'ebm_sigxp', 'f', 2.855201204e-05,
        'horizontal RMS angular divergence of electron beam [rad]'
    ],
    [
        'ebm_sigyp', 'f', 2.6148818e-06,
        'vertical RMS angular divergence of electron beam [rad]'
    ],
    [
        'ebm_mxxp', 'f', 0.0,
        'horizontal position-angle mixed 2nd order moment of electron beam [m]'
    ],
    [
        'ebm_myyp', 'f', 0.0,
        'vertical position-angle mixed 2nd order moment of electron beam [m]'
    ],

    #---Undulator
    ['und_bx', 'f', 0.0, 'undulator horizontal peak magnetic field [T]'],
    ['und_by', 'f', 1.01997572, 'undulator vertical peak magnetic field [T]'],
    [
        'und_phx', 'f', 0.0,
        'initial phase of the horizontal magnetic field [rad]'
    ],
    [
        'und_phy', 'f', 0.0,
        'initial phase of the vertical magnetic field [rad]'
    ],
    [
        'und_b2e', '', '',
        'estimate undulator fundamental photon energy (in [eV]) for the amplitude of sinusoidal magnetic field defined by und_b or und_bx, und_by',
        'store_true'
    ],
    [
        'und_e2b', '', '',
        'estimate undulator field amplitude (in [T]) for the photon energy defined by w_e',
        'store_true'
    ],
    ['und_per', 'f', 0.021, 'undulator period [m]'],
    ['und_len', 'f', 2.500648, 'undulator length [m]'],
    ['und_zc', 'f', 1.305, 'undulator center longitudinal position [m]'],
    [
        'und_sx', 'i', 1,
        'undulator horizontal magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_sy', 'i', -1,
        'undulator vertical magnetic field symmetry vs longitudinal position'
    ],
    [
        'und_g', 'f', 6.72,
        'undulator gap [mm] (assumes availability of magnetic measurement or simulation data)'
    ],
    [
        'und_ph', 'f', 0.0,
        'shift of magnet arrays [mm] for which the field should be set up'
    ],
    ['und_mdir', 's', '', 'name of magnetic measurements sub-folder'],
    [
        'und_mfs', 's', 'ivu21_srx_sum.txt',
        'name of magnetic measurements for different gaps summary file'
    ],

    #---Calculation Types

    #Multi-Electron Spectrum vs Photon Energy (taking into account e-beam emittance, energy spread and collection aperture size)
    [
        'sm', '', '1', 'calculate multi-e spectrum vs photon energy',
        'store_true'
    ],
    [
        'sm_ei', 'f', 10000.0,
        'initial photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ef', 'f', 20000.0,
        'final photon energy [eV] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ne', 'i', 1000,
        'number of points vs photon energy for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_x', 'f', 0.0,
        'horizontal center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_rx', 'f', 0.001,
        'range of horizontal position / horizontal aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_nx', 'i', 1,
        'number of points vs horizontal position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_y', 'f', 0.0,
        'vertical center position [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ry', 'f', 0.001,
        'range of vertical position / vertical aperture size [m] for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_ny', 'i', 1,
        'number of points vs vertical position for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_mag', 'i', 1,
        'magnetic field to be used for calculation of multi-e spectrum spectrum or intensity distribution: 1- approximate, 2- accurate'
    ],
    [
        'sm_hi', 'i', 1,
        'initial UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_hf', 'i', 15,
        'final UR spectral harmonic to be taken into account for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_prl', 'f', 1.0,
        'longitudinal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_pra', 'f', 1.0,
        'azimuthal integration precision parameter for multi-e spectrum vs photon energy calculation'
    ],
    [
        'sm_meth', 'i', 1,
        'method to use for spectrum vs photon energy calculation in case of arbitrary input magnetic field: 0- "manual", 1- "auto-undulator", 2- "auto-wiggler", -1- dont use this accurate integration method (rather use approximate if possible)'
    ],
    [
        'sm_prec', 'f', 0.01,
        'relative precision for spectrum vs photon energy calculation in case of arbitrary input magnetic field (nominal value is 0.01)'
    ],
    [
        'sm_nm', 'i', 10,
        'number of macro-electrons to average on each node at parallel (MPI-based) calculation of spectrum in case of arbitrary input magnetic field'
    ],
    [
        'sm_ns', 'i', 5,
        'saving periodicity (in terms of macro-electrons) for intermediate intensity at calculation of multi-electron spectrum in case of arbitrary input magnetic field'
    ],
    ['sm_type', 'i', 1, 'calculate flux (=1) or flux per unit surface (=2)'],
    [
        'sm_pol', 'i', 6,
        'polarization component to extract after calculation of multi-e flux or intensity: 0- Linear Horizontal, 1- Linear Vertical, 2- Linear 45 degrees, 3- Linear 135 degrees, 4- Circular Right, 5- Circular Left, 6- Total'
    ],
    [
        'sm_rm', 'i', 1,
        'method for generation of pseudo-random numbers for e-beam phase-space integration: 1- standard pseudo-random number generator, 2- Halton sequences, 3- LPtau sequences (to be implemented)'
    ],
    [
        'sm_fn', 's', 'res_spec_me.dat',
        'file name for saving calculated milti-e spectrum vs photon energy'
    ],
    [
        'sm_pl', 's', '',
        'plot the resulting spectrum-e spectrum in a graph: ""- dont plot, "e"- show plot vs photon energy'
    ],

    #to add options
    [
        'op_r', 'f', 20.0,
        'longitudinal position of the first optical element [m]'
    ],

    # Former appParam:
    [
        'source_type', 's', 't',
        'source type, (u) idealized undulator, (t), tabulated undulator, (m) multipole, (g) gaussian beam'
    ],
])