Skip to content
Snippets Groups Projects
Commit e3b19fde authored by Laura Nervo's avatar Laura Nervo
Browse files

Formatting and commenting a bit...


Signed-off-by: default avatarLaura Nervo <laura.nervo@esrf.fr>
parent 692837e8
No related branches found
No related tags found
No related merge requests found
function results = gtSymmetricReflections(cryst,energy)
function results = gtSymmetricReflections(cryst, energy)
% GTSYMMETRICREFLECTIONS Gets all the hkl signed reflections and calculate
% properly d-spacing and twotheta-type
% results = gtSymmetricReflections(cryst,energy)
% ----------------------------------------------
% results = gtSymmetricReflections(cryst, energy)
% -----------------------------------------------
%
% INPUT:
% cryst.hkl = row vector of Miller indices;
% cryst.hkl = column vector of Miller indices
% size 3xn or 4xn for hexagonal
% cryst.crystal_system = crystal system of lattice
% size nx3 or nx4 for hexagonal
% cryst.latticepar = lattice parameters
% cryst.spacegroup = spacegroup
% cryst.hermann_mauguin = Hermann-Mauguin symbol
......
......@@ -6,7 +6,7 @@ function grainsout=gtIndexUniquePlaneNormals(grainsinp,ACM)
if ~exist('ACM','var')
load parameters.mat
%ACM=gtAngConsMat(parameters.acq.spacegroup);
%ACM=gtAngConsMat(parameters.cryst.spacegroup);
ACM = gtIndexAngularConsMatrix(hkltypes,parameters);
end
......
......@@ -6,7 +6,8 @@ function list = build_list_v2()
% ----------------------
%
% OUTPUT:
% list = structure with each field <cell> (N,3)
% list = <cell> structure with each field (N,4)
%
%
% Version 006 01-08-2013 by LNervo
% Added 'opsym' and 'symm' fields to 'cryst' for FABLE calculations of
......@@ -27,7 +28,7 @@ function list = build_list_v2()
%
% Version 002 08-03-2012 by PReischig
% parameters version 2 (from March 2012)
% added : version, labgeo, samgeo, fsim
% added : version, labgeo, samgeo, fsim
% modified : acq, xop, cryst, seg, match, rec
%
% The list.mat has the same fields as parameters.mat, except for:
......
function structure = build_structure(list, sep, debug)
% BUILD_STRUCTURE_V0 Build some structure starting from a list template in 'list'
% structure = build_structure(list, sep, debug)
% -------------------------------------------
function structure = build_structure(list, separator, debug)
% BUILD_STRUCTURE Builds some structure starting from a list template in 'list'
% structure = build_structure(list, separator, debug)
% -----------------------------------------------------
%
% INPUT:
% list = list of fields contents in template_list##.mat <cell Nx3>
% sep = separator for sub-structures in list struct {'__'}
% i.e. list.index---strategy --> sep = '---' if 'strategy' is a
% sub-structure of 'index'.
% PS. list.match_calib --> 'match_calib' is a field of
% 'list'. 'calib' is a sub-structure of 'match'.
% list = <struct> cell structure with names, description,
% classes and usertypes columns
% separator = <string> separator for sub-structures in list struct {'__'}
% i.e. list.index__strategy --> parameters.index.strategy
% 'strategy' is a sub-structure of 'index'.
% PS. list.match_calib --> 'match_calib' is a field of
% 'list'. 'calib' is not a sub-structure of 'match'.
%
% OUTPUT:
% structure = structure built from 'list' <struct>
% substructures = array of sub-structures found in each field of
% 'structure' <char>
% structure = <struct> structure built from 'list'
% substructures = <string> array of sub-structures found in each field of
% 'structure'
%
%
% Version 001 18-11-2011 by LNervo
% For each sub-structure an empty structure is created properly and
% the name is given in the output 'substructures'
% default separator is '__'
if ~exist('sep', 'var') || isempty(sep)
sep = '__';
if ~exist('separator', 'var') || isempty(separator)
separator = '__';
end
if ~exist('debug', 'var') || isempty(debug)
debug = false;
......@@ -33,33 +36,33 @@ out = GtConditionalOutput(debug);
structure = [];
field = struct();
if isstruct(list)
names = fieldnames(list);
names = fieldnames(list);
newnames = fieldnames(list);
for ll = 1:length(names)
if ~isempty(strfind(names{ll}, sep))
if ~isempty(strfind(names{ll}, separator))
tmp = names{ll};
tmp = strrep(tmp, sep, '.'); % default separator is '__'
tmp = strrep(tmp, separator, '.'); % default separator is '__'
newnames{ll} = tmp;
end
end
for ii = 1:length(names)
out.odisp(['### structure ' names{ii} ' ###'])
if ~isstruct(list.(names{ii}))
for jj = 1:size(list.(names{ii}), 1)
%list.(names{i}){j, 1}
if strcmpi(list.(names{ii}){jj, 3}, 'char')
field.(names{ii}).(list.(names{ii}){jj, 1}) = char([]);
%out.odisp('Found char...')
elseif strcmpi(list.(names{ii}){jj, 3}, 'double')
field.(names{ii}).(list.(names{ii}){jj, 1}) = double([]);
%out.odisp('Found double...')
elseif strcmpi(list.(names{ii}){jj, 3}, 'single')
field.(names{ii}).(list.(names{ii}){jj, 1}) = single([]);
%out.odisp('Found single...')
elseif strcmpi(list.(names{ii}){jj, 3}, 'double')
field.(names{ii}).(list.(names{ii}){jj, 1}) = double([]);
%out.odisp('Found double...')
elseif strcmpi(list.(names{ii}){jj, 3}, 'int8')
field.(names{ii}).(list.(names{ii}){jj, 1}) = int8([]);
%out.odisp('Found int8...')
......@@ -69,8 +72,26 @@ if isstruct(list)
elseif strcmpi(list.(names{ii}){jj, 3}, 'int32')
field.(names{ii}).(list.(names{ii}){jj, 1}) = int32([]);
%out.odisp('Found int32...')
elseif strcmpi(list.(names{ii}){jj, 3}, 'int64')
field.(names{ii}).(list.(names{ii}){jj, 1}) = int64([]);
%out.odisp('Found int64...')
elseif strcmpi(list.(names{ii}){jj, 3}, 'uint')
field.(names{ii}).(list.(names{ii}){jj, 1}) = uint([]);
%out.odisp('Found uint...')
elseif strcmpi(list.(names{ii}){jj, 3}, 'uint8')
field.(names{ii}).(list.(names{ii}){jj, 1}) = uint8([]);
%out.odisp('Found uint8...')
elseif strcmpi(list.(names{ii}){jj, 3}, 'uint16')
field.(names{ii}).(list.(names{ii}){jj, 1}) = uint16([]);
%out.odisp('Found uint16...')
elseif strcmpi(list.(names{ii}){jj, 3}, 'uint32')
field.(names{ii}).(list.(names{ii}){jj, 1}) = uint32([]);
%out.odisp('Found uint32...')
elseif strcmpi(list.(names{ii}){jj, 3}, 'uint64')
field.(names{ii}).(list.(names{ii}){jj, 1}) = uint64([]);
%out.odisp('Found uint64...')
elseif strcmpi(list.(names{ii}){jj, 3}, 'logical')
field.(names{ii}).(list.(names{ii}){jj, 1}) = false;
field.(names{ii}).(list.(names{ii}){jj, 1}) = false();
%out.odisp('Found logical...')
elseif strcmpi(list.(names{ii}){jj, 3}, 'cell')
field.(names{ii}).(list.(names{ii}){jj, 1}) = cell(1, 1);
......@@ -82,13 +103,15 @@ if isstruct(list)
field.(names{ii}).(list.(names{ii}){jj, 1}) = NaN;
end
end % end for j
end % end for loop jj
else
out.odisp(['Found structure... Run again the function with input the structure <oldinput>.' names{ii}])
end % end isstruct
end % end for i
end % end isstruct(list.(names{ii}))
end % end for loop ii
for ii = 1:length(names)
if ~strcmp(names{ii}, newnames{ii})
newname = textscan(newnames{ii}, '%s', 'delimiter', '.');
newname = newname{1};
......@@ -106,12 +129,13 @@ if isstruct(list)
end
field = rmfield(field, names{ii});
end
end
end % end for loop ii
structure = field;
else
disp('Please give as input a structure');
return;
end
end % end for loop isstruct(list)
end % end function
end % end of function
function [parameters, list] = make_parameters(version)
% MAKE_PARAMETERS Create a parameters.mat file with empty fields
% MAKE_PARAMETERS Creates a parameters.mat file with empty fields
% [parameters, list] = make_parameters(version)
% ---------------------------------------------
%
% INPUT:
% version = -1 (load a specific parameters.mat file)
% 0 (old parameters (<2011))
% 1 (single phase / old matching parameters)
% 2 (multiple phases parameters)
% version = <double> -1 (loads a specific parameters.mat file)
% 0 (old parameters (<2011))
% 1 (single phase / old matching parameters)
% 2 (multiple phases parameters)
%
% OUTPUT:
% parameters = parameters file
% list = structure with fieldnames, fields descriptions and fields classes
% parameters = <struct> parameters file
% list = <struct> cell structure with field names,
% descriptions, classes and usertypes columns
%
%
% Version 001 18-11-2011 by LNervo
% Creates a template of parameters, then with gtSetup it is filled properly
% Creates a .mat file with description for each field in the parameters.mat
disp('Getting the field list of parameters...')
fprintf('Getting the field list of parameters...')
switch (version)
case -1
filename = inputwdefault('Insert filepath of the mat file to load', ...
......@@ -38,4 +42,6 @@ switch (version)
parameters.version.number = 2;
end
fprintf('...Done!\n')
end % end of function
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