Contents
% ----------------------------------------------------------%% create_17K_2p0A%% ---------------------------------------------------------- horace_on() clear, close all
!==================================================================! ! HORACE ! !------------------------------------------------------------------! ! Visualisation of multi-dimensional neutron spectroscopy data ! ! ! ! T.G.Perring, J van Duijn, R.A.Ewings November 2008 ! !------------------------------------------------------------------! ! Matlab code: $Revision:: 558 $ ($Date:: 2011-07-19 11:06:05 $) ! ! Mex code: Disabled or not supported on this platform ! !------------------------------------------------------------------!
Define working directories
% ----------------------------------------------------------% Define working directories% ----------------------------------------------------------% Windows% dirroot = '\\serdon-nv\illdata\133\in5\exp_4-01-1230\';% dirfinal = [dirroot,'processed\spe\'];% dirraw = [dirroot,'rawdata\'];% linux dirroot = '/usr/illdata/133/in5/exp_4-01-1230/'; dirfinal = [dirroot,'processed/spe/']; dirraw = [dirroot,'rawdata/']; indir = dirfinal; % directory of spe files par_file = [dirfinal,'in5psd_318_384_240.par']; % detector parameter file sqw_file = [dirfinal,'tmo_2p0A_17K.sqw']; % output sqw file
Initial parameters
Lambda = 2.0; % Wavelenght [A] efix = 81.805/Lambda^2 ; % Ei [meV] emode = 1; % Direct geometry (2: inverse) alatt = [5.297, 5.831, 7.403]; % Crystal parameters (from literature) angdeg = [90.0,90.0,90.0]; u = [0,1,0]; % 1st reference axis: u=// to incident beam v = [0,0,1]; % 2nd reference axis: v=perp to incident beam omega=0;dpsi=0; % Unuseful (?) gl=2.37; % Estimated from the Braggs at level gs=1.003; % --"--% Or left to zero and orientation corrected on .SQW files later% (see horace_rotation_corrections).
Sample rotation offset
Omega = Omega_0 when Ki is parallel to the first reference axis (u)
% ----------------------------------------------------------% Sample rotation offset (determined from Braggs positions)% ---------------------------------------------------------- Offset = 250.32 - 180.0;
Proceed
Give all sample rotation angles (as measured) and corresponding .spe files (generated in Lamp at present). Sort them (not compulsory), check Omega with the angle recorded in the raw datafiles and proceed to the projection in crystal reciprocal space (generate .sqw file).
% Sample rotation angles as given from the measurements Omega = [240:-2:234,232:-2:120,121:2:139,141:2:233]'; % Run numbers corresponding to the sample rotation irun = [110017:110020,110023:110079,110080:110089,110091:110137]'; [Omega, ind] = sort(Omega); % Sample rotation without offset psi = Offset - Omega; irun = irun(ind); nfiles = numel(irun); spe_file = cell(1,nfiles); % Cell matrix of spe files to usefor k=1:nfiles spe_file{k}=[indir,'sqw_',num2str(irun(k,1)),'_',num2str(irun(k,1)),'_318_384_240.spe']; end% Check consistency (compare the sample rotation angle with the value in each file)for k = 1:nfiles rawFile = [dirraw,num2str(irun(k,1)),'.nxs']; SROT=0; SRot = hdf5read(rawFile, '/entry0/instrument/SRot/value'); fprintf('%d)\tPsi = %5.2f ( Om = %5.2f / SRot = %5.2f) -> %s \n',k, psi(k),Omega(k),SRot,spe_file{k}); end
1) Psi = -49.68 ( Om = 120.00 / SRot = 120.01) -> /usr/illdata/133/in5/exp_4-01-1230/processed/spe/sqw_110079_110079_318_384_240.spe 2) Psi = -50.68 ( Om = 121.00 / SRot = 120.99) -> /usr/illdata/133/in5/exp_4-01-1230/processed/spe/sqw_110080_110080_318_384_240.spe 3) Psi = -51.68 ( Om = 122.00 / SRot = 122.01) -> /usr/illdata/133/in5/exp_4-01-1230/processed/spe/sqw_110078_110078_318_384_240.spe 4) Psi = -52.68 ( Om = 123.00 / SRot = 122.99) -> /usr/illdata/133/in5/exp_4-01-1230/processed/spe/sqw_110081_110081_318_384_240.spe
...
116) Psi = -165.68 ( Om = 236.00 / SRot = 236.01) -> /usr/illdata/133/in5/exp_4-01-1230/processed/spe/sqw_110019_110019_318_384_240.spe 117) Psi = -167.68 ( Om = 238.00 / SRot = 238.01) -> /usr/illdata/133/in5/exp_4-01-1230/processed/spe/sqw_110018_110018_318_384_240.spe 118) Psi = -169.68 ( Om = 240.00 / SRot = 239.99) -> /usr/illdata/133/in5/exp_4-01-1230/processed/spe/sqw_110017_110017_318_384_240.spe
% Generate the .SQW file
gen_sqw (spe_file, par_file, sqw_file, efix, emode, alatt, angdeg, u, v, ...
psi , omega, dpsi, gl, gs);