Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DCT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
graintracking
DCT
Commits
758bccd3
Commit
758bccd3
authored
11 years ago
by
Yoann Guilhem
Browse files
Options
Downloads
Patches
Plain Diff
Code formatting.
Signed-off-by:
Yoann Guilhem
<
yoann.guilhem@esrf.fr
>
parent
a51a6d44
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
1_preprocessing/gtFillCrystFields.m
+34
-29
34 additions, 29 deletions
1_preprocessing/gtFillCrystFields.m
with
34 additions
and
29 deletions
1_preprocessing/gtFillCrystFields.m
+
34
−
29
View file @
758bccd3
...
...
@@ -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
=
input
wdefault
(
'
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
=
input
wdefault
(
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('
k
eep trying - possibly with a different datafile or manual input')
return
gtPrintException(mexc, 'Did not manage to read from the selected file!')
;
disp('
K
eep 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('
r
ead some powder diffraction data')
disp('
R
ead 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('
f
illing parameters.xop.int and mult with ones')
disp('
F
illing 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';
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment