Skip to content
Snippets Groups Projects
Commit f1f67516 authored by Zheheng Liu's avatar Zheheng Liu
Browse files

some changes for gtCrystComputeExperimentalFamilyIntensities_v2


Signed-off-by: default avatarZheheng Liu <zheheng.liu@esrf.fr>
parent 814e27b9
No related branches found
No related tags found
No related merge requests found
function [fams_ints, fams_ints_raw, usable, fams_counts, gr_vols] = gtCrystComputeExperimentalFamilyIntensities_v2(phase_id, p, det_ind, varargin)
function [fams_ints, fams_intsp, fams_ints_raw, usable, fams_counts, gr_vols] = gtCrystComputeExperimentalFamilyIntensities_v2(phase_id, p, det_ind, varargin)
% FUNCTION GTCRYSTCOMPUTEEXPERIMENTALFAMILYINTENSITIES_V2
% [fams_ints, fams_intsp, usable, fams_counts] = gtCrystComputeExperimentalFamilyIntensities_v2(phase_id, p, det_ind, varargin)
% [fams_ints, fams_intsp, fams_ints_raw, usable, fams_counts, gr_vols] = gtCrystComputeExperimentalFamilyIntensities_v2(phase_id, p, det_ind, varargin)
% INPUTS:
% phase_id = <int> Phase ID. The default is 1.
% p = <struct> The parameter structure.
% det_ind = <int> Detector index. The default is 1.
% OPTIONAL INPUTS:
% only_selected = <bool> If true, only selected spots will be
% considered. (The default is false)
% deselect_annealing_twin_shared_spots
% = <bool> If true, the spots shared by
% annealing twins will be deselected.
% fams_ints_norm = <int> Estimate the intensity of each hkl
% family by [1]: median spot intensity,
% or 2: average spot intensity.
% only_selected = <bool> [true]: only use selected spots;
% false: use all the included spots.
% use_spot2grain = <bool> [true]: deselect the shared spots
% indicated by spot2grain.mat;
% mu_att = <double> Attenuation coefficient. If empty,
% absorption volume will be used.
% flat_image = Flat image used for direct beam profile.
% If empty, it will be generated automatically.
% gr_ids = <int> ID of used grains.
% usedfam = <bool> Used hkl families.
% fams_counts_thres = <int> For each grain, only if the spots are
% more than this threshold, the hkl
% family will be used. Default: 4
% abs_vol = Absorption volume.
%
% 06-09-2021 by Zheheng. (based on Nicola's function gtCrystComputeExperimentalFamilyIntensities)
if (~exist('phase_id', 'var') || isempty(phase_id))
......@@ -25,11 +37,9 @@ function [fams_ints, fams_ints_raw, usable, fams_counts, gr_vols] = gtCrystCompu
conf = struct(...
'fams_ints_norm', 1, ... % 0 and 1 are median, 2 is average
'use_nullspace', true, ...
'only_selected', true, ... % To use included spots or only use selected spots
'use_spot2grain', true, ... % deselect the shared spots indicated by spot2grain.mat
'mu_att', [], ... % 32.2686 cm^-1 43.57keV Ni
'verbose', false, ...
'flat_image', [], ...
'gr_ids', [], ...
'usedfam', [], ...
......@@ -47,12 +57,6 @@ function [fams_ints, fams_ints_raw, usable, fams_counts, gr_vols] = gtCrystCompu
num_grains = numel(conf.gr_ids);
end
% if conf.deselect_annealing_twin_shared_spots
% clusters = sfTwinClusters(conf.gr_ids, tot_grains, sample.phases{phase_id}.clusters);
% else
% clusters = num2cell(conf.gr_ids);
% end
fams_ints = nan(num_grains, numel(p.cryst(phase_id).int));
fams_counts = zeros(num_grains, numel(p.cryst(phase_id).int));
......@@ -150,6 +154,7 @@ function [fams_ints, fams_ints_raw, usable, fams_counts, gr_vols] = gtCrystCompu
[fams_ints, gr_vols] = gtMathsEstimateCoefVecFromIncompDataMatByNullSpace(fams_ints');
% fams_ints contain 1/sin(2theta), which is part of Lorentz factor.
fams_ints = fams_ints' ./ sind(2 * p.cryst(phase_id).theta(1:numel(fams_ints)));
fams_intsp = fams_ints(p.cryst(phase_id).thetatypesp);
fprintf('Theoretical Intensities:\n');
disp(p.cryst(phase_id).int / norm(p.cryst(phase_id).int));
......
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