documentation:script
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
documentation:script [2012/08/30 22:08] – macke | documentation:script [2014/10/08 17:16] (current) – macke | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | The script window uses the scripting language LUA (see: [[http:// | ||
+ | |||
+ | The script in the register " | ||
+ | - The script is executed manually. Either in the menu in the main window or the execute button in the script window. The altered variables are written back to the graphical user interface. Error Messages and Debug Messages appear in the Debug Window. The script is executed even if the script function is disabled. | ||
+ | - A const-energy reflectivity calculation is performed. The script is executed only one time before the simulation starts. The altered variables are not written back to the graphical user interface. Error messages as well as debug messages are suppressed. | ||
+ | - Plotting the optical profiles as function of z. The script is executed only one time before the simulation starts. The altered variables are not written back to the graphical user interface. Error messages as well as debug messages are suppressed | ||
+ | - An energy scan calculation is performed (the same holds for the map calculation). The script is executed individually for every data point. The altered variables are not written back to the graphical user interface. Error messages as well as debug messages are suppressed. | ||
+ | - Plotting the scattering factors f1 and f2 as function of energy. The script is executed individually for every data point. The altered variables are not written back to the graphical user interface. Error messages as well as debug messages are suppressed. | ||
+ | - Plotting delta and beta as function of energy. The script is executed individually for every data point. The altered variables are not written back to the graphical user interface. Error messages as well as debug messages are suppressed. | ||
+ | - Plotting deltam and betam as function of energy. The script is executed individually for every data point. The altered variables are not written back to the graphical user interface. Error messages as well as debug messages are suppressed. | ||
+ | |||
+ | The script execution can be disabled in the preferences window. | ||
+ | If the option " | ||
+ | |||
+ | |||
+ | ==Currently defined common variables== | ||
+ | |||
+ | |||
+ | ^ Variable | ||
+ | | thickness[i] | ||
+ | | delta[i] | ||
+ | | beta[i] | ||
+ | | sigma[i] | ||
+ | | deltam[i] | ||
+ | | betam[i] | ||
+ | | density[i] | ||
+ | | gauss_delta[i] | ||
+ | | gauss_delta[i] | ||
+ | | gauss_variance[i]| Variance of Gaussian i | Array of Decimals | | ||
+ | | gauss_z[i] | ||
+ | | exx_r[i] | ||
+ | | exx_i[i] | ||
+ | | exy_r[i] | ||
+ | | exy_i[i] | ||
+ | | exz_r[i] | ||
+ | | exz_i[i] | ||
+ | | eyx_r[i] | ||
+ | | eyx_i[i] | ||
+ | | eyy_r[i] | ||
+ | | eyy_i[i] | ||
+ | | eyz_r[i] | ||
+ | | eyz_i[i] | ||
+ | | ezx_r[i] | ||
+ | | ezx_i[i] | ||
+ | | ezy_r[i] | ||
+ | | ezy_i[i] | ||
+ | | ezz_r[i] | ||
+ | | ezz_i[i] | ||
+ | | par[i] | ||
+ | | energy | ||
+ | | resolution | ||
+ | | epsilon | ||
+ | | write(...) | ||
+ | | print(...) | ||
+ | | SetDeltaBeta(i, | ||
+ | | FillTensors() | ||
+ | |||
+ | |||
+ | Note: the index i is the layer index according to the layer input table. ([0] := substrate, [1] := first layer after substrate) | ||
+ | |||
+ | (*1)Before the script is executed the optical 3x3 tensors are filled with default values given by the parameters in the layer list. | ||
+ | That means in compound mode, that the tensor is filled with the contents of delta, beta, deltam and betam at the appropriate tensor entries. | ||
+ | In element mode, the scattering tensor is filled with the contents of f1, f2, f1m and f2m. | ||
+ | Any change to delta, beta, deltam, betam in compound mode or f1, f2, f1m, f2m in element mode in the script is therefore meaningless. | ||
+ | But if these parameters are changed, the tensor can be renewed by executing the " | ||
+ | |||
+ | |||
+ | ==Currently defined element specific variables== | ||
+ | |||
+ | The functions are accessed by putting the element label before the function.\\ | ||
+ | Example: | ||
+ | < | ||
+ | -- element Lanthanum | ||
+ | La:getf1() | ||
+ | La:getf2() | ||
+ | La: | ||
+ | </ | ||
+ | |||
+ | ^ Variable | ||
+ | | getf1() | ||
+ | | getf2() | ||
+ | | setf1(x) | ||
+ | | setf2(x) | ||
+ | | getf1m() | ||
+ | | getf2m() | ||
+ | | setf1m(x) | ||
+ | | setf2m(x) | ||
+ | | getsigma(i) | ||
+ | | setsigma(i, x) | set roughness of layer i | Function | | ||
+ | | getthickness(i) | ||
+ | | setthickness(i, | ||
+ | | getdensity(i) | ||
+ | | setdensity(i, | ||
+ | | setf(energy) | ||
+ | |||
+ | The index i is the layer index according to the layer input table. ([0] := substrate, [1] := first layer after substrate) | ||
+ | |||
+ | |||
+ | ==Currently defined variables but unsupported== | ||
+ | |||
+ | Following commands are not officially supported. Use these commands in the register " | ||
+ | |||
+ | ^ Variable | ||
+ | | ShowMatrixEigenvalues | ||
+ | | ShowEScanEigenvalues(i) | ||
+ | | GetError() | ||
+ | | CalculateReflectivity() | ||
+ | | CalculateDicReflectivity()| not working | ||
+ | | CalculateEnergyscan() | ||
+ | | solution_qz[i] | ||
+ | | solution_R[i] | ||
+ | | solution_Rp[i] | ||
+ | | solution_Rm[i] | ||
+ | | solution_energy[i] | ||
+ | | nlayers | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==Examples== | ||
+ | |||
+ | Imagine you want to fit a multilayer sample where every second layer has the same thickness…select thickness[1] for fitting (on the layer input table) and then define the following script in the script window: | ||
+ | |||
+ | < | ||
+ | for i = 3, 7, 2 do | ||
+ | thickness[i] = thickness[1] | ||
+ | end | ||
+ | </ | ||
+ | |||
+ | …the script window defines the thickness[3], | ||
+ | < | ||
+ | sigma[3] = sigma[1]; | ||
+ | sigma[5] = sigma[1]; | ||
+ | sigma[7] = sigma[6]; | ||
+ | </ | ||
+ | |||