From 510f740281ead37b1ee4abac0d59cf8088e47c72 Mon Sep 17 00:00:00 2001 From: Nicola Vigano <nicola.vigano@esrf.fr> Date: Thu, 18 Feb 2016 18:00:24 +0100 Subject: [PATCH] GtOrientationSampling: fixed small bugs Signed-off-by: Nicola Vigano <nicola.vigano@esrf.fr> --- 4_grains/gtGrainAnglesTabularFix360deg.m | 15 +++++++++++++++ zUtil_Deformation/GtOrientationSampling.m | 6 ++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 4_grains/gtGrainAnglesTabularFix360deg.m diff --git a/4_grains/gtGrainAnglesTabularFix360deg.m b/4_grains/gtGrainAnglesTabularFix360deg.m new file mode 100644 index 00000000..9d8355dc --- /dev/null +++ b/4_grains/gtGrainAnglesTabularFix360deg.m @@ -0,0 +1,15 @@ +function w_tab = gtGrainAnglesTabularFix360deg(w_tab, ref_int_ws, parameters) + num_images = gtGetTotNumberOfImages(parameters); + + % Let's treat those blobs at the w edge 360->0 + % (from the sampled orientations perspective) + opposite_int_ws = mod(ref_int_ws + num_images / 2, num_images); + gt_ref_int = opposite_int_ws > num_images / 2; + lt_ref_int = ~gt_ref_int; + opposite_int_ws_repmat = opposite_int_ws(:, ones(1, size(w_tab, 2))); + + w_tab(gt_ref_int, :) = w_tab(gt_ref_int, :) ... + - num_images .* (w_tab(gt_ref_int, :) > opposite_int_ws_repmat(gt_ref_int, :)); + w_tab(lt_ref_int, :) = w_tab(lt_ref_int, :) ... + + num_images .* (w_tab(lt_ref_int, :) < opposite_int_ws_repmat(lt_ref_int, :)); +end \ No newline at end of file diff --git a/zUtil_Deformation/GtOrientationSampling.m b/zUtil_Deformation/GtOrientationSampling.m index b1e839f1..b7dbb170 100644 --- a/zUtil_Deformation/GtOrientationSampling.m +++ b/zUtil_Deformation/GtOrientationSampling.m @@ -542,8 +542,10 @@ classdef GtOrientationSampling < handle function delta_omegas = get_omega_deviations(self) grs = [self.lattice(1).gr{:}]; ab = [grs(:).allblobs]; - w_tab = [ab(:).omega] / gtGetOmegaStepDeg(self.parameters); - ref_int_ws = self.ref_gr.allblobs.omega(self.ondet(self.included)); + w_tab = [ab(:).omega] / gtGetOmegaStepDeg(self.parameters, self.detector_index); + + ref_int_ws = self.ref_gr.allblobs.detector(self.detector_index).uvw(self.ondet(self.included), 3); + w_tab = gtGrainAnglesTabularFix360deg(w_tab, ref_int_ws, self.parameters); delta_omegas = ceil(max(w_tab, [], 2) - min(w_tab, [], 2)); -- GitLab