diff --git a/1_preprocessing/gtFillCrystFields.m b/1_preprocessing/gtFillCrystFields.m index 8234d39b226a9c3ec1f60ba0654ef7c2553a5571..b4a62ee0a68da4d7bcc256d9674b786e8add2f75 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