pace-neutrons / Horace

Horace is a suite of programs for the visualization and analysis of large datasets from time-of-flight neutron inelastic scattering spectrometers.
https://pace-neutrons.github.io/Horace/stable/
GNU General Public License v3.0
7 stars 4 forks source link

Bunch of issues, identified while replicating numerous nxspe files in parallel. #1630

Closed abuts closed 3 months ago

abuts commented 5 months ago

User was trying to build background replicating single nxspe file. This have revealed the numerous issues which should or should not be sorted.

1) Horace parallel framework can not generate tmp files reading single nxspe source. Something to do with Matlab way of opening hdf files. Horace-3 generates clear error messages but Horace-4 fails with very obscure error messages. The issue hacked by generating a copy of replicated file for each worker. Better solution should probably be developed. Now separate ticket #1705 so closing this 2) Tools to analyse runs (run_inspector) does not work for replicated runs in Horace-3. Operational in Horace-4. CM: 6/6: DONE (Alex) 3) User was producing very strange and inconsistent cuts (In Horace-3). It suggests errors either in Horace-3 or in background generation which should be investigated: cM: 6/6 (DONE Alex) In the E-k cut, he found that the signal is below about 23 meV. But in the constant-E plot, we can get the signal at 30 meV. This is incorrect apparently. By comparing the cuts with our sample cuts, constant-E cut is correct: 1712056175761(1) 1712056193429(1) The script, producing original file is:

data_path='/home/k1117646/RB2220406/';%directory where data files are

par_file='';
sqw_file=[data_path,'bkg/bkg_50meV_60degV4.sqw'];
efix=50;%Ei
psi=-110:0.5:70;%values of sample orientation psi for each run

% runno=[15052:15097];%array of run numbers - must be array same size as psi
emode=1;%direct geometry spectrometer
alatt=[6.6973,6.6973,18.5548];%lattice parameters
angdeg=[90,90,120];%lattice angles
u=[1,1,0]; v=[-1,1,0];%scattering plane (u//ki when psi=0, v perp ki)
omega=0; dpsi=0.4548; gl=-1.4296; gs=-0.6002;
in ='abcdefgh';
for i=1:6
    targ = fullfile(data_path,['MER64727_bkg_',in(i),'.nxspe']);
    if ~isfile(targ)
        copyfile(fullfile(data_path,'MER64727_50meV_1to1.nxspe'),targ,'f')
    end
end
spefile = cell(1,numel(psi));
chunk = ceil(numel(psi)/6);
for j=1:6
    for i=1:chunk
        idx = i+(j-1)*chunk;
        if idx>numel(psi)
            break;
        end
        spefile{idx}=fullfile(data_path,['MER64727_bkg_',in(j),'.nxspe']);%construct cell array of nxspe file names
    end
end

gen_sqw (spefile, par_file, sqw_file, efix, emode, alatt, angdeg,...
    u, v, psi, omega, dpsi, gl, gs,'replicate');%make the sqw file

4) As run_inspector does not work for this task in Horace-3, I have generated your background file in Horace 4 and can not reproduce your result. Script below produces correct results for Horace4:

data_path='/home/k1117646/RB2220406/'
qw_file=fullfile(data_path,'bkg','bkg_50meV_60degV4.sqw']; % (361 contributing file)
proj.u=[-1,1,0]; proj.v=[1,1,0]; proj.uoffset=[0,0,0,0]; proj.type='rrr';
qe_cut=cut_sqw(sqw_file,proj,[-5,0.03,5],[-0.1,0.1],[-8,8],[0,0.25,40]);
plot(qe_cut);
qq_cut=cut_sqw(sqw_file,proj,[-8,0.03,8],[-2,0.05,4],[-8,8],[29.75,30.25]);
plot(qq_cut);
cmarooney-stfc commented 3 months ago

remaining issue now #1705, so closing