From 2a72af0a99899a9f11413f760be043f0b83b7617 Mon Sep 17 00:00:00 2001 From: preischig <preischig@gmail.com> Date: Tue, 13 Jan 2015 13:06:33 +0100 Subject: [PATCH] Added theta update according to beam energy. Signed-off-by: preischig <preischig@gmail.com> --- 1_preprocessing/gtFillCrystFields.m | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/1_preprocessing/gtFillCrystFields.m b/1_preprocessing/gtFillCrystFields.m index 8234d39b..b4a62ee0 100644 --- a/1_preprocessing/gtFillCrystFields.m +++ b/1_preprocessing/gtFillCrystFields.m @@ -52,6 +52,11 @@ while (~phase_ok) if (ismember(lower(test), {'y', 'yes'})) %%%% get complete information from another parameters file %%%%% parameters = sfGetInfoFromParameters(parameters, phase_ndx); + + % Update reflections for actual photon energy + % !!! intensity missing, but it is not yet used in the processing + parameters.cryst = sfUpdateReflections(parameters.cryst, parameters.acq.energy); + % this is a "new" experiment, set up the names and read from the datafile fprintf('Please modify the description for this phase (%d)\n', phase_ndx); parameters = sfModifyMaterialDescription(parameters, phase_ndx); @@ -356,4 +361,20 @@ function parameters = sfGetSymmCrystInfo(parameters, phase_id) end % end of sfGetSymmCrystInfo +function cryst = sfUpdateReflections(cryst, energy) +% Updates the reflection data according to a new photon energy + % Update the d-spacing info in cryst according to new lattice parameters. + % Bmat = gtCrystHKL2CartesianMatrix(cryst.latticepar); + % cryst.dspacing = gtCrystDSpacing(cryst.hkl, Bmat); + % cryst.dspacingsp = gtCrystDSpacing(cryst.hklsp, Bmat); + + % Update the theta info according to new photon energy + lambda = gtConvEnergyToWavelength(energy); + cryst.theta = asind(0.5*lambda./cryst.dspacing); + cryst.thetasp = asind(0.5*lambda./cryst.dspacingsp); + + % Update the intensity info: MISSING ! + cryst.int = []; + cryst.intsp = []; +end -- GitLab