Skip to content
Snippets Groups Projects
Commit 758bccd3 authored by Yoann Guilhem's avatar Yoann Guilhem
Browse files

Code formatting.

parent a51a6d44
No related branches found
No related tags found
No related merge requests found
......@@ -34,7 +34,8 @@ function parameters = gtFillCrystFields(parameters, phase_ndx)
% theta from dspacing and energy
%
disp([' ~~~~~~~~~~~~~ Get crystallography information for phase ' num2str(phase_ndx) ' ~~~~~~~~~~~~~ '])
disp([' ~~~~~~~~~~~~~ Get crystallography information for phase ' ...
num2str(phase_ndx) ' ~~~~~~~~~~~~~ '])
% now fill in this information for this phase
p = make_parameters(2);
......@@ -42,11 +43,12 @@ phase_ok = false;
while (~phase_ok)
% is this part of a series of measurements? In this case we can simply
% copy from another parameters file
disp(['If you have already measured this material with same geometry and conditions, ' ...
'you can copy from another parameters file. If the experimental geometry is different, '...
'it may be safer to load from a data file prepared for the specific conditions'])
disp(['If you have aly measured this material with same geometry and conditions, ' ...
'you can copy from another parameters file.']);
disp(['If the experimental geometry is different, '...
'it may be safer to load from a data file prepared for the specific conditions.']);
test = input('Do this? [y/n] ', 's');
test = inputwdefault('Do you want to load a parameters file? [y/n]', 'n');
if (ismember(lower(test), {'y', 'yes'}))
%%%% get complete information from another parameters file %%%%%
parameters = sfGetInfoFromParameters(parameters, phase_ndx);
......@@ -64,7 +66,7 @@ while (~phase_ok)
end
% this is a "new" experiment, set up the names and read from the datafile
fprintf('Please give a description for this phase (%d)\n', phase_ndx)
fprintf('Please give a description for this phase (%d)\n', phase_ndx);
parameters.cryst(phase_ndx) = modifyMaterialDescription(parameters.cryst(phase_ndx), phase_ndx);
% create the xop directory in which to save the files used
......@@ -73,8 +75,8 @@ while (~phase_ok)
%%%% get information from files or user %%%%%
% Get reflection data
disp('Do you want to load reflection data from .csv or .dat files?')
test = input('Do this? [y/n] ', 's');
query = 'Do you want to load reflection data from .csv or .dat files? [y/n]';
test = inputwdefault(query, 'n');
if (ismember(lower(test), {'y', 'yes'}))
parameters = sfGetReflectionInfoFromDataFiles(parameters, phase_ndx, xop_dir);
else
......@@ -82,8 +84,9 @@ while (~phase_ok)
end
% Get crystallographic data
disp('Do you want to load crystallographic info (lattice pars, symmetry) from a .cif file?')
test = input('Do this? [y/n] ', 's');
disp('You can either load crystallographic info (lattice pars, symmetry) from a file or enter it manually.');
query = 'Do you want to load it from a .cif file? [y/n]';
test = inputwdefault(query, 'n');
if (ismember(lower(test), {'y', 'yes'}))
parameters = sfGetCrystInfoFromDataFiles(parameters, phase_ndx);
else
......@@ -95,7 +98,8 @@ while (~phase_ok)
end
% Check things look okay
test = input('Do you want to look at the contents of cryst for this phase? [y/n] ', 's');
query = 'Do you want to look at the contents of cryst for this phase? [y/n]';
test = inputwdefault(query, 'y');
if (ismember(lower(test), {'y', 'yes'}))
parameters = sfCheckWithUser(parameters, phase_ndx);
end
......@@ -104,12 +108,13 @@ while (~phase_ok)
test = input('Is this phase OK? [y/n] ', 's');
if (ismember(lower(test), {'y', 'yes'}))
phase_ok = true;
disp('')
disp('');
disp('Saving parameters.mat in the analysis directory...')
parameters_name = fullfile(parameters.acq.dir,'parameters.mat');
save(parameters_name, 'parameters')
disp([' ~~~~~~~~~~~~~ Finished getting crystallography information for phase ' num2str(phase_ndx) ' ~~~~~~~~~~~~~ '])
disp([' ~~~~~~~~~~~~~ Finished getting crystallography information for phase ' ...
num2str(phase_ndx) ' ~~~~~~~~~~~~~ '])
end
end % end while loop
......@@ -119,7 +124,7 @@ end % end of the main function
function parameters = sfCheckWithUser(parameters, ii)
% show the user the cryst field so they can decide if it looks ok
parameters.cryst(ii)
disp(parameters.cryst(ii));
end
%%%%%%% COPY FROM A PARAMETERS.MAT FILE %%%%%%%%%%%%%%
......@@ -168,7 +173,7 @@ function cryst = modifyMaterialDescription(cryst, phase_id)
% get this stuff via gtModfiyStructure
biglist = build_list_v2();
descr = biglist.cryst;
listndx = find( ismember(descr(:, 1), {'name', 'composition', 'material'}));
listndx = ismember(descr(:, 1), {'name', 'composition', 'material'});
descr = descr(listndx, 1:2);
title = sprintf('Manual input of crystallographic parameters for phase %d', phase_id);
cryst = gtModifyStructure(cryst, descr, title);
......@@ -179,7 +184,7 @@ end
function parameters = sfGetReflectionInfoFromDataFiles(parameters, phase_id, xop_dir)
% get a data file to try
disp('Please select a data file from which to load powder diffraction data')
disp('Please select a data file from which to load powder diffraction data');
% pick a suitable datafile
[datafile, datapath] = uigetfile('*.csv; *.dat', ...
'Select a powder diffraction data file', '/data/id11/graintracking/');
......@@ -187,12 +192,12 @@ function parameters = sfGetReflectionInfoFromDataFiles(parameters, phase_id, xop
try
xop = gtLoadReflectionsFromFile(fullfile(datapath, datafile));
parameters.xop(phase_id) = gtAddMatFile(parameters.xop(phase_id), xop, true, false, false);
clear xop
clear xop;
% add this data to parameters.cryst
catch mexc
gtPrintException(mexc, 'Did not manage to read from the selected file!')
disp('keep trying - possibly with a different datafile or manual input')
return
gtPrintException(mexc, 'Did not manage to read from the selected file!');
disp('Keep trying - possibly with a different datafile or manual input.');
return;
end
try
......@@ -200,10 +205,10 @@ function parameters = sfGetReflectionInfoFromDataFiles(parameters, phase_id, xop
copyfile(fullfile(datapath, datafile), fullfile(xop_dir, datafile))
parameters.xop(phase_id).xop_dir = xop_dir;
parameters.xop(phase_id).filename = datafile;
disp('read some powder diffraction data')
disp('Read some powder diffraction data');
catch mexc
gtPrintException(mexc, ...
'Did not manage to copy the file to the shared directory! This is not a big issue...')
'Did not manage to copy the file to the shared directory! This is not a big issue...');
end
end % end sfGetReflectionInfoFromDataFiles
......@@ -215,9 +220,9 @@ function parameters = sfGetCrystInfoFromDataFiles(parameters, ii)
'Select a suitable crystallography file', '/data/id11/graintracking/');
cif = gtCrystCifInitialize(fullfile(cifpath, ciffile));
parameters.cryst(ii) = gtAddMatFile(parameters.cryst(ii), cif, true, true, false);
clear cif
clear cif;
% copy the file that we used to the xop_dir
copyfile(fullfile(cifpath, ciffile), fullfile(parameters.xop(ii).xop_dir, ciffile))
copyfile(fullfile(cifpath, ciffile), fullfile(parameters.xop(ii).xop_dir, ciffile));
end % read of sfGetCrystInfoFromDataFiles
function parameters = sfGetReflectionInfoFromUser(parameters, ii)
......@@ -235,7 +240,7 @@ function parameters = sfGetReflectionInfoFromUser(parameters, ii)
% in parameters .xop
hkl = input('Manually input the hkl families as an nx3 matrix: [h1 k1 l1; h2 k2 l2; etc]');
parameters.xop(ii).hkl = hkl;
disp('filling parameters.xop.int and mult with ones')
disp('Filling parameters.xop.int and mult with ones');
parameters.xop(ii).int = ones(size(hkl));
parameters.xop(ii).mult = ones(size(hkl));
end
......@@ -249,7 +254,7 @@ function parameters = sfGetCrystInfoFromUser(parameters, ii)
% in parameters.cryst
biglist = build_list_v2();
list = biglist.cryst;
listndx = find( ismember(list(:, 1), {'latticepar', 'spacegroup'}));
listndx = ismember(list(:, 1), {'latticepar', 'spacegroup'});
list = list(listndx, 1:2);
parameters.cryst(ii) = gtModifyStructure(parameters.cryst(ii), list, ...
sprintf('Manual input of crystallographic parameters for phase %d', ii));
......@@ -266,7 +271,7 @@ function parameters = sfExpandData(parameters, ii)
parameters.cryst(ii).lattice_system = lattice_system;
parameters.cryst(ii).crystal_system = crystal_system;
parameters.cryst(ii).hermann_mauguin = herm_symbol;
clear lattice_system crystal_system herm_symbol
clear lattice_system crystal_system herm_symbol;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% getting reflection on the detector, basing on theta max and min
......@@ -278,7 +283,7 @@ function parameters = sfExpandData(parameters, ii)
% this info goes into the parameters.cryst field
detector = gtDetectorTwotheta(parameters, ii);
parameters.cryst(ii) = gtAddMatFile(parameters.cryst(ii), detector, true, true, false);
clear detector
clear detector;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Using symmetry operators getting all the possible reflections
......@@ -286,7 +291,7 @@ function parameters = sfExpandData(parameters, ii)
% this expands the hkl families in parameters.cryst
hklsymmetry = gtSymmetricReflections(parameters.cryst(ii), parameters.acq.energy);
parameters.cryst(ii) = gtAddMatFile(parameters.cryst(ii), hklsymmetry, true, true, false);
clear hklsymmetry
clear hklsymmetry;
% Transpose arrays to have rows
parameters.cryst(ii).hkl = parameters.cryst(ii).hkl';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment