diff --git a/_test/test_multifit/test_multifit_horace_1.m b/_test/test_multifit/test_multifit_horace_1.m index ddda79818e..22b73ea261 100644 --- a/_test/test_multifit/test_multifit_horace_1.m +++ b/_test/test_multifit/test_multifit_horace_1.m @@ -23,25 +23,29 @@ end methods - function this = test_multifit_horace_1(name) + function obj = test_multifit_horace_1(name) if nargin == 0 name = 'test_multifit_horace_1'; end % Construct object output_file = 'test_multifit_horace_1_output.mat'; - this = this@TestCaseWithSave(name, output_file); + obj = obj@TestCaseWithSave(name, output_file); % Read in data data_dir = fileparts(mfilename('fullpath')); - this.w1data = read_sqw(fullfile(data_dir,'w1data.sqw')); - this.w2data = read_sqw(fullfile(data_dir,'w2data.sqw')); + obj.w1data = read_sqw(fullfile(data_dir,'w1data.sqw')); + obj.w2data = read_sqw(fullfile(data_dir,'w2data.sqw')); hp = horace_paths; - this.w4ddata = read_sqw(fullfile(hp.test_common,'sqw_4d.sqw')); - this.win=[this.w1data,this.w2data]; % combine the two cuts into an array of sqw objects and fit + obj.w4ddata = read_sqw(fullfile(hp.test_common,'sqw_4d.sqw')); + disp("*********************************************************") + disp('Re #1790 identifying issues present on Jenkins only') + disp(obj.w4ddata.experiment_info.detector_arrays) + disp("*********************************************************") + obj.win=[obj.w1data,obj.w2data]; % combine the two cuts into an array of sqw objects and fit % Save reference results, if '-save' option is requested - this.save(); + obj.save(); end % ------------------------------------------------------------------------------------------------ @@ -105,9 +109,12 @@ % ------------------------------------------------------------------------------------------------ function obj = test_fit_multidimensional_dataset(obj) % Example of simultaneously fitting more than one sqw object - % + % + disp("*********************************************************") disp('Re #1790 identifying issues present on Jenkins only') + disp(obj.w4ddata.experiment_info.detector_arrays) disp(obj.w4ddata.detpar.unique_objects.unique_objects) + disp("*********************************************************") mss = multifit_sqw_sqw(obj.w4ddata); mss = mss.set_fun(@sqw_bcc_hfm, [75,5,2.7,10,-75]); % set foreground function(s) mss = mss.set_free([1,1,1,1,0]); % set which parameters are floating diff --git a/herbert_core/utilities/classes/@unique_references_container/unique_references_container.m b/herbert_core/utilities/classes/@unique_references_container/unique_references_container.m index 001c3579bc..8ebeda4f1f 100644 --- a/herbert_core/utilities/classes/@unique_references_container/unique_references_container.m +++ b/herbert_core/utilities/classes/@unique_references_container/unique_references_container.m @@ -122,7 +122,7 @@ % instruments and samples unique_objects; % returns unique_objects_container. Hidden not to - % expose expensive operation to view + % expose expensive operation to view but widely used in access/save/load operations end methods % property (and method) set/get diff --git a/horace_core/Tobyfit/detector_array.m b/horace_core/Tobyfit/detector_array.m index 0e5ba0073b..181d844a44 100644 --- a/horace_core/Tobyfit/detector_array.m +++ b/horace_core/Tobyfit/detector_array.m @@ -33,7 +33,7 @@ if isempty(det) || det.n_runs == 0 % no detector info was available when the sqw was populated; as detpar % is no longer available this is an error - error('HORACE:tobyfit-detector_array:invalid_argument', ... + error('HORACE:detector_array:invalid_argument', ... 'trying to make detectors from a detpar but it doesnt exist any more'); else % make a new detector object based on value of use_tubes and insert diff --git a/horace_core/algorithms/resolution_plot.m b/horace_core/algorithms/resolution_plot.m index 89fb0c5352..eda64fbca3 100644 --- a/horace_core/algorithms/resolution_plot.m +++ b/horace_core/algorithms/resolution_plot.m @@ -213,9 +213,6 @@ sample.alatt = lat.alatt; sample.angdeg = lat.angdeg; end -exper = Experiment([],instrument,sample,expdata); - -wres.experiment_info = exper; % Check detector @@ -231,8 +228,8 @@ if ~isfield(detpar,'filepath'), detpar.filepath = ''; end if ~isfield(detpar,'group'), detpar.group = 1; end -wres.detpar = detpar; - +detpar = IX_detector_array(detpar); +wres.experiment_info = Experiment(detpar,instrument,sample,expdata); % Make data structure ax = line_axes('nbins_all_dims',[3,3,1,1],'img_range',range_add_border(zeros(2,4))); diff --git a/horace_core/sqw/@sqw/private/set_from_old_struct_.m b/horace_core/sqw/@sqw/private/set_from_old_struct_.m index 3934b0e03b..53fe25b6b8 100644 --- a/horace_core/sqw/@sqw/private/set_from_old_struct_.m +++ b/horace_core/sqw/@sqw/private/set_from_old_struct_.m @@ -36,6 +36,10 @@ if isfield(ss,'experiment_info') && isstruct(ss.experiment_info) ss.experiment_info = Experiment.loadobj(ss.experiment_info); end + if isfield(ss,'detpar') + detpar = IX_detector_array(ss.detpar); + ss.experiment_info.detector_arrays = detpar; + end % the detpar value will be put in further down in from_bare_struct. % NB reminder that this will require experiment_info having an empty % detector_arrays rather than being preconstructed @@ -119,3 +123,10 @@ obj.pix.alignment_matr = al_info.rotmat; end end +if S.version == 5 + % may contain detpar stored in their own field and not present within + % the experiment_info + if obj.experiment_info.detector_arrays.n_objects == 0 + obj.detpar = S.detpar; % use setter for old array format + end +end diff --git a/horace_core/sqw/@sqw/sqw.m b/horace_core/sqw/@sqw/sqw.m index 76774fc0cc..0870c73153 100644 --- a/horace_core/sqw/@sqw/sqw.m +++ b/horace_core/sqw/@sqw/sqw.m @@ -67,7 +67,6 @@ experiment_info_ = []; %Experiment(); now at start of constructor; % detectors array - detpar_ = struct([]); % holder for image data, e.g. appropriate dnd object data_; @@ -529,7 +528,7 @@ function save_xye(obj,varargin) %====================================================================== % SERIALIZABLE INTERFACE properties(Constant,Access=protected) - fields_to_save_ = {'main_header','experiment_info','detpar','data','pix'}; + fields_to_save_ = {'main_header','experiment_info','data','pix'}; end % methods @@ -538,7 +537,8 @@ function save_xye(obj,varargin) % and nxsqw data format. Each new version would presumably read % the older version, so version substitution is based on this % number - ver = 5; + ver = 6; + % version 6 detpar is saved/lodaded through experiment_info % version 5 -- support for loading previous version % data in case if the data were realigned end