ResLibCal: compute and display the neutron TAS resolution function To start the application and open the main GUI window, use ResLibCal To compute directly the resolution function, sending an EXP ResLib-like configuration structure, use: out = ResLibCal(EXP); To convolve an iFunc model with a 4D resolution function, use: out = ResLibCal(model); To use ResLibCal from the command line, use: out = ReslibCal(command, arguments...); where 'command' is one of: open open a configuration file (par, cfg, res, ini, m): ResLibCal('open','file') save save the configuration in the Preference directory (ini format) saveas save the configuration into a specified file/format: ResLibCal('saveas','file') export dump the main ResLibCal window into a file exit close all active views, and save current configuration reset re-load the default configuration print generate an HTML document to be printed create open the main GUI (start interface), and read last saved configuration compute only compute the matrix (no plotting/printing) update compute, and then update open views, or send result to the console view2 display the 2D view (resolution projections) view3 display the 3D view (resolution) tas display the spectrometer geometry default same as create, but does not read last configuration (using reset configuration) quit same as exit, but does not save the configuration close close the 2D, 3D and TAS view windows resol print-out the resolution matrix a la RESCAL bragg print-out the Bragg widths a la RESCAL list print-out the RESCAL parameter list config return the current configuration (ResLib EXP) hkle return the current HKLE location. Set it back with ResLibCal(hkle{:}); silent use silent computation (no plot/display) for further arguments <PAR>=<VALUE> sets a parameter value, e.g. 'DM=3.355' To compute the resolution at a given HKLW location, using the current settings resolution = ResLibCal(QH,QK,QL,W) where QH,QK,QL,W can be vectors, or empty to use current settings. To only compute the resolution function, use: ResLibCal('close'); out=ResLibCal('compute'); which will close the 2D,3D and TAS views, then compute the resolution function, returned in out.resolution The application contains a main interface with: * Menu, Method, Scan and Instrument parameters (main) * Resolution function plot (2D) * Resolution function plot (3D) * Instrument view when changing any value in the main GUI: * Method and Scan parameters, Instrument parameters any opened view is updated after a re-computation of the resolution. The 2D and 3D views can be closed without ending the application. When the main window is closed, or Exit is selected all views are closed Convolution in 4D for TAS ---------------------------------------------------- The 4D convolution syntax allow to simulate a TAS scan from a parametrised dispersion. In the following example, we simulate a scan through a cubic crystal dispersion, and show the ideal S(q,w) as well as the measured, broadened measurement. Then, the simulated scan is inserted in a representation of the S(q,w), to visualise the scan trajectory and simulated signal. To use this tool, you need to input a 2D or 4D dispersion model (iFunc). The dispersion is either a 2D model S(|q|,w) or a 4D model S(qh,qk,ql,w). The axes of the dispersion are in the lattice reciprocal space, in r.l.u. s=sqw_cubic_monoatomic; % create a 4D S(q,w) for a cubic pure material t=ResLibCal(s); % convolute it with a TAS resolution, and open ResLibCal. w=linspace(0.01,20,50); qh=0.3*ones(size(w)); qk=0*qh; ql=qk; % a scan signal1=iData(t, [], qh,qk,ql,w); signal0=iData(s, [], qh,qk,ql,w); figure; plot(squeeze([signal1 signal0*100])); % plot the dispersion and simulated measurement % now plot the 4D dispersion with the scan in it, for fun qh=linspace(0.01,.5,50);qk=qh; ql=qh; w=linspace(0.01,10,51); % a 4D grid f=iData(s,[],qh,qk,ql,w); % evaluate the model on the 4D grid figure; surf(log(f(:,:,1,:)),'half'); hold on; % plot dispersion, and scan scatter3(log(signal1(:,:,1,:)),'filled'); input: any combination of: command: string among those listed above, which can be followed by any other allowed parameter. qh,qk,ql,w: 4 vectors or 4D matrices which delimit a region in the reciprocal space where the TAS resolution function should be computed. model: an iFunc model which is to be convolved with the TAS response. EXP: a structure holding a ResLibCal, ResCal or ResLib configuration. output: a ResLibCal configuration with e.g. 'resolution' field, or a 4D convoluted model. Version: Nov. 27, 2018 (c) E.Farhi, ILL. License: EUPL. See also iFunc/conv