Skip to content

Commit

Permalink
Re #1 better range estimation for header comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Feb 25, 2022
1 parent 6bdbfbc commit fe1a2dd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions horace_core/algorithms/gen_sqw.m
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ function report_nothing_to_do(spe_only,spe_exist)
tmp_file=gen_tmp_filenames(spe_file,sqw_file);
tmp_generated = tmp_file;
if gen_tmp_files_only
% ind = num2cell(1:numel(tmp_file));
[f_valid_exist,pix_ranges] = cellfun(@(fn)(check_tmp_files_range(fn,pix_db_range,grid_size_in)),...
tmp_file,'UniformOutput',false);
f_valid_exist = [f_valid_exist{:}];
Expand Down Expand Up @@ -896,8 +897,10 @@ function verify_pix_range_est(pix_range,pix_range_est,log_level)
warning('gen_sqw:runtime_logic',...
['\nEstimated range of contributed pixels differs from the actual calculated range,\n',...
'Est min: %+6.4g %+6.4g %+6.4g %+6.4g | Max: %+6.4g %+6.4g %+6.4g %+6.4g\n',...
'Calc min: %+6.4g %+6.4g %+6.4g %+6.4g | Max: %+6.4g %+6.4g %+6.4g %+6.4g\n'],...
args{:});
'Calc min: %+6.4g %+6.4g %+6.4g %+6.4g | Max: %+6.4g %+6.4g %+6.4g %+6.4g\n',...
'%s\n'],...
args{:},...
'Estimated range is used for binning pixels so all pixels outside the range are lost');
end
%
function [present_and_valid,pix_range] = check_tmp_files_range(tmp_file,pix_db_range,grid_size_in)
Expand All @@ -910,7 +913,8 @@ function verify_pix_range_est(pix_range,pix_range_est,log_level)
pix_range = [];
return;
end
toll = 1.e-7;
toll = 4*eps(single(pix_db_range));
%
ldr = sqw_formats_factory.instance().get_loader(tmp_file);
head = ldr.get_data('-head');
pix_range = ldr.get_pix_range;
Expand Down

0 comments on commit fe1a2dd

Please sign in to comment.