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
4d72fb18
Commit
4d72fb18
authored
2 years ago
by
Nicola Vigano
Browse files
Options
Downloads
Patches
Plain Diff
Shape-functions: updated NW sf to use diffractometer
Signed-off-by:
Nicola Vigano
<
nicola.vigano@esrf.fr
>
parent
dbecee25
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
zUtil_Deformation/gtDefFwdProjGvdm2NW.m
+53
-15
53 additions, 15 deletions
zUtil_Deformation/gtDefFwdProjGvdm2NW.m
zUtil_Deformation/gtDefFwdProjGvdm2W.m
+1
-1
1 addition, 1 deletion
zUtil_Deformation/gtDefFwdProjGvdm2W.m
with
54 additions
and
16 deletions
zUtil_Deformation/gtDefFwdProjGvdm2NW.m
+
53
−
15
View file @
4d72fb18
...
@@ -11,25 +11,47 @@ function bl = gtDefFwdProjGvdm2NW(grain, ref_sel, gv, fedpars, parameters, eta_s
...
@@ -11,25 +11,47 @@ function bl = gtDefFwdProjGvdm2NW(grain, ref_sel, gv, fedpars, parameters, eta_s
o
.
fprintf
(
'Forward projection (%s):\n'
,
mfilename
)
o
.
fprintf
(
'Forward projection (%s):\n'
,
mfilename
)
om_step
=
gtAcqGetOmegaStep
(
parameters
,
det_ind
);
nbl
=
numel
(
ref_sel
);
nbl
=
numel
(
ref_sel
);
uinds
=
gv
.
used_ind
;
uinds
=
gv
.
used_ind
;
nv
=
numel
(
uinds
);
nv
=
numel
(
uinds
);
use_diffractometer
=
(
isfield
(
parameters
,
'diffractometer'
)
...
&&
numel
(
parameters
.
diffractometer
)
>=
det_ind
...
&&
det_ind
>
1
);
labgeo
=
parameters
.
labgeo
;
labgeo
=
parameters
.
labgeo
;
samgeo
=
parameters
.
samgeo
;
samgeo
=
parameters
.
samgeo
;
om_step
=
gtAcqGetOmegaStep
(
parameters
,
det_ind
);
if
(
use_diffractometer
)
diff_acq
=
parameters
.
diffractometer
(
det_ind
);
diff_ref
=
parameters
.
diffractometer
(
1
);
g
=
gtMathsRod2OriMat
(
grain
.
R_vector
);
rotcomp
=
gtMathsRotationMatrixComp
(
diff_acq
.
axes_rotation
', '
col
'
);
rotdir
=
diff_acq
.
axes_rotation
'
;
instr_t
=
gtGeoDiffractometerTensor
(
diff_acq
,
'sam2lab'
,
...
'reference_diffractometer'
,
diff_ref
);
else
rotcomp
=
gtMathsRotationMatrixComp
(
labgeo
.
rotdir
', '
col
'
);
rotdir
=
labgeo
.
rotdir
'
;
end
if
(
strcmpi
(
fedpars
.
defmethod
,
'rod_rightstretch'
))
if
(
strcmpi
(
fedpars
.
defmethod
,
'rod_rightstretch'
))
% In this case, the deformation is relative to [0, 0, 0], so we
% need crystal plane normals
if
(
isfield
(
grain
.
allblobs
,
'plcry'
))
if
(
isfield
(
grain
.
allblobs
,
'plcry'
))
pls_orig
=
grain
.
allblobs
(
det_ind
)
.
plcry
(
ref_sel
,
:);
pls_orig
=
grain
.
allblobs
(
det_ind
)
.
plcry
(
ref_sel
,
:);
else
else
% We bring the plane normals back to the status of pl_cry
% We bring the plane normals back to the status of pl_cry
pls_orig
=
grain
.
allblobs
(
det_ind
)
.
plorig
(
ref_sel
,
:);
pls_orig
=
grain
.
allblobs
(
det_ind
)
.
plorig
(
ref_sel
,
:);
g
=
gtMathsRod2OriMat
(
grain
.
R_vector
);
pls_orig
=
gtVectorLab2Cryst
(
pls_orig
,
g
);
pls_orig
=
gtVectorLab2Cryst
(
pls_orig
,
g
);
end
end
else
else
% Here the deformation is relative to the average oriantion, so we
% need the undeformed sample plane normals
pls_orig
=
grain
.
allblobs
(
det_ind
)
.
plorig
(
ref_sel
,
:);
pls_orig
=
grain
.
allblobs
(
det_ind
)
.
plorig
(
ref_sel
,
:);
end
end
...
@@ -38,7 +60,7 @@ function bl = gtDefFwdProjGvdm2NW(grain, ref_sel, gv, fedpars, parameters, eta_s
...
@@ -38,7 +60,7 @@ function bl = gtDefFwdProjGvdm2NW(grain, ref_sel, gv, fedpars, parameters, eta_s
&&
~
isempty
(
fedpars
.
detector
(
det_ind
)
.
blobs_w_interp
))
&&
~
isempty
(
fedpars
.
detector
(
det_ind
)
.
blobs_w_interp
))
blobs_w_interp
=
fedpars
.
detector
(
det_ind
)
.
blobs_w_interp
;
blobs_w_interp
=
fedpars
.
detector
(
det_ind
)
.
blobs_w_interp
;
if
(
numel
(
blobs_w_interp
)
~=
nbl
)
if
(
numel
(
blobs_w_interp
)
~=
nbl
)
error
(
'gtDefFwdProjGvdm2W
:wrong_argument'
,
...
error
(
[
mfilename
'
:wrong_argument'
]
,
...
'Number of "blobs_w_interp" (%d) doesn
''
t match with the number of blobs (%d)'
,
...
'Number of "blobs_w_interp" (%d) doesn
''
t match with the number of blobs (%d)'
,
...
numel
(
blobs_w_interp
),
nbl
)
numel
(
blobs_w_interp
),
nbl
)
end
end
...
@@ -49,11 +71,20 @@ function bl = gtDefFwdProjGvdm2NW(grain, ref_sel, gv, fedpars, parameters, eta_s
...
@@ -49,11 +71,20 @@ function bl = gtDefFwdProjGvdm2NW(grain, ref_sel, gv, fedpars, parameters, eta_s
sinths
=
grain
.
allblobs
(
det_ind
)
.
sintheta
(
ref_sel
);
sinths
=
grain
.
allblobs
(
det_ind
)
.
sintheta
(
ref_sel
);
ominds
=
grain
.
allblobs
(
det_ind
)
.
omind
(
ref_sel
);
ominds
=
grain
.
allblobs
(
det_ind
)
.
omind
(
ref_sel
);
if
(
~
use_diffractometer
)
% The plane normals need to be brought in the Lab reference where the
% beam direction and rotation axis are defined.
% Use the Sample -> Lab orientation transformation assuming omega=0;
% (vector length preserved for free vectors)
pls_orig
=
gtGeoSam2Lab
(
pls_orig
,
eye
(
3
),
labgeo
,
samgeo
,
true
);
end
if
(
isfield
(
fedpars
,
'ref_omega'
)
&&
~
isempty
(
fedpars
.
ref_omega
))
if
(
isfield
(
fedpars
,
'ref_omega'
)
&&
~
isempty
(
fedpars
.
ref_omega
))
ref_oms
=
fedpars
.
ref_omega
(
ref_sel
);
ref_oms
=
fedpars
.
ref_omega
(
ref_sel
);
else
else
ref_oms
=
grain
.
allblobs
(
det_ind
)
.
omega
(
ref_sel
);
ref_oms
=
grain
.
allblobs
(
det_ind
)
.
omega
(
ref_sel
);
end
end
w_shifts
=
round
(
ref_oms
.
/
om_step
.
/
blobs_w_interp
);
w_shifts
=
round
(
ref_oms
.
/
om_step
.
/
blobs_w_interp
);
if
(
isfield
(
fedpars
,
'ref_eta'
)
&&
~
isempty
(
fedpars
.
ref_eta
))
if
(
isfield
(
fedpars
,
'ref_eta'
)
&&
~
isempty
(
fedpars
.
ref_eta
))
...
@@ -61,13 +92,8 @@ function bl = gtDefFwdProjGvdm2NW(grain, ref_sel, gv, fedpars, parameters, eta_s
...
@@ -61,13 +92,8 @@ function bl = gtDefFwdProjGvdm2NW(grain, ref_sel, gv, fedpars, parameters, eta_s
else
else
ref_ns
=
grain
.
allblobs
(
det_ind
)
.
eta
(
ref_sel
);
ref_ns
=
grain
.
allblobs
(
det_ind
)
.
eta
(
ref_sel
);
end
end
n_shifts
=
round
(
ref_ns
.
/
eta_step
);
% The plane normals need to be brought in the Lab reference where the
n_shifts
=
round
(
ref_ns
.
/
eta_step
);
% beam direction and rotation axis are defined.
% Use the Sample -> Lab orientation transformation assuming omega=0;
% (vector length preserved for free vectors)
pls_orig
=
gtGeoSam2Lab
(
pls_orig
,
eye
(
3
),
labgeo
,
samgeo
,
true
);
linear_interp
=
~
(
isfield
(
fedpars
,
'projector'
)
...
linear_interp
=
~
(
isfield
(
fedpars
,
'projector'
)
...
&&
strcmpi
(
fedpars
.
projector
,
'nearest'
));
&&
strcmpi
(
fedpars
.
projector
,
'nearest'
));
...
@@ -75,6 +101,7 @@ function bl = gtDefFwdProjGvdm2NW(grain, ref_sel, gv, fedpars, parameters, eta_s
...
@@ -75,6 +101,7 @@ function bl = gtDefFwdProjGvdm2NW(grain, ref_sel, gv, fedpars, parameters, eta_s
gvpow
=
gv
.
pow
(
1
,
uinds
);
gvpow
=
gv
.
pow
(
1
,
uinds
);
gvd
=
gv
.
d
(:,
uinds
);
gvd
=
gv
.
d
(:,
uinds
);
% Deformation tensor (relative to reference state) from its components
% Deformation tensor (relative to reference state) from its components
defT
=
gtFedDefTensorFromComps
(
gvd
,
fedpars
.
dcomps
,
fedpars
.
defmethod
,
0
);
defT
=
gtFedDefTensorFromComps
(
gvd
,
fedpars
.
dcomps
,
fedpars
.
defmethod
,
0
);
...
@@ -96,16 +123,25 @@ function bl = gtDefFwdProjGvdm2NW(grain, ref_sel, gv, fedpars, parameters, eta_s
...
@@ -96,16 +123,25 @@ function bl = gtDefFwdProjGvdm2NW(grain, ref_sel, gv, fedpars, parameters, eta_s
% New deformed plane normals and relative elongations (relative to
% New deformed plane normals and relative elongations (relative to
% reference state)
% reference state)
pl_orig
=
pls_orig
(
ii_b
,
:)
'
;
% ! use plcry and not plsam to keep omega order below!
% !!! use plcry and not plsam to keep omega order below !!!
pl_orig
=
pls_orig
(
ii_b
,
:)
'
;
[
pl_samd
,
drel
]
=
gtStrainPlaneNormals
(
pl_orig
,
defT
);
% unit column vectors
[
pl_samd
,
drel
]
=
gtStrainPlaneNormals
(
pl_orig
,
defT
);
% unit column vectors
if
(
use_diffractometer
)
% The plane norma ls need to be brought in the Lab reference where the
% beam direction and rotation axis are defined.
% Use the Sample -> Lab orientation transformation assuming omega=0;
% (vector length preserved for free vectors)
pl_samd
=
gtGeoSam2Lab
(
pl_samd
', instr_t, labgeo, samgeo, true)'
;
end
% New sin(theta)
% New sin(theta)
sinth
=
sinths
(
ii_b
)
.
/
drel
;
sinth
=
sinths
(
ii_b
)
.
/
drel
;
% Predict omega angles: 4 for each plane normal
% Predict omega angles: 4 for each plane normal
[
om
,
pl_lab
]
=
gtFedPredictOmegaMultiple
(
pl_samd
,
sinth
,
labgeo
.
beamdir
'
,
...
[
om
,
pl_lab
]
=
gtFedPredictOmegaMultiple
(
...
labgeo
.
rotdir
'
,
labgeo
.
rotcomp
,
ominds
(
ii_b
));
pl_samd
,
sinth
,
labgeo
.
beamdir
'
,
rotdir
,
rotcomp
,
ominds
(
ii_b
));
valid_voxels
(:,
ii_b
)
=
~
isnan
(
om
);
valid_voxels
(:,
ii_b
)
=
~
isnan
(
om
);
...
@@ -124,9 +160,11 @@ function bl = gtDefFwdProjGvdm2NW(grain, ref_sel, gv, fedpars, parameters, eta_s
...
@@ -124,9 +160,11 @@ function bl = gtDefFwdProjGvdm2NW(grain, ref_sel, gv, fedpars, parameters, eta_s
w_bl
=
w_bl
/
blobs_w_interp
(
ii_b
);
w_bl
=
w_bl
/
blobs_w_interp
(
ii_b
);
w_bl
=
w_bl
-
w_shifts
(
ii_b
);
w_bl
=
w_bl
-
w_shifts
(
ii_b
);
n_bl
=
gtGeoEtaFromDiffVec
(
pl_lab
', parameters.labgeo)'
;
eta
=
gtGeoEtaFromDiffVec
(
pl_lab
', parameters.labgeo)'
;
n_bl
=
gtGrainAnglesTabularFix360deg
(
n_bl
,
ref_ns
(
ii_b
));
eta
=
gtGrainAnglesTabularFix360deg
(
eta
,
ref_ns
(
ii_b
));
n_bl
=
n_bl
.
/
eta_step
-
n_shifts
(
ii_b
);
n_bl
=
eta
.
/
eta_step
;
n_bl
=
n_bl
-
n_shifts
(
ii_b
);
nw
{
ii_b
}
=
[
n_bl
;
w_bl
];
nw
{
ii_b
}
=
[
n_bl
;
w_bl
];
...
...
This diff is collapsed.
Click to expand it.
zUtil_Deformation/gtDefFwdProjGvdm2W.m
+
1
−
1
View file @
4d72fb18
...
@@ -60,7 +60,7 @@ function bl = gtDefFwdProjGvdm2W(grain, ref_sel, gv, fedpars, parameters, det_in
...
@@ -60,7 +60,7 @@ function bl = gtDefFwdProjGvdm2W(grain, ref_sel, gv, fedpars, parameters, det_in
&&
~
isempty
(
fedpars
.
detector
(
det_ind
)
.
blobs_w_interp
))
&&
~
isempty
(
fedpars
.
detector
(
det_ind
)
.
blobs_w_interp
))
blobs_w_interp
=
fedpars
.
detector
(
det_ind
)
.
blobs_w_interp
;
blobs_w_interp
=
fedpars
.
detector
(
det_ind
)
.
blobs_w_interp
;
if
(
numel
(
blobs_w_interp
)
~=
nbl
)
if
(
numel
(
blobs_w_interp
)
~=
nbl
)
error
(
'gtDefFwdProjGvdm2W
:wrong_argument'
,
...
error
(
[
mfilename
'
:wrong_argument'
]
,
...
'Number of "blobs_w_interp" (%d) doesn
''
t match with the number of blobs (%d)'
,
...
'Number of "blobs_w_interp" (%d) doesn
''
t match with the number of blobs (%d)'
,
...
numel
(
blobs_w_interp
),
nbl
)
numel
(
blobs_w_interp
),
nbl
)
end
end
...
...
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