Enable time-of-flight indexing and Laue/ToF refinement#2662
Enable time-of-flight indexing and Laue/ToF refinement#2662toastisme merged 35 commits intodials:mainfrom
Conversation
…r wavelength/s0 in reflection table first.
…ategy and fix typo.
…f. Added wavelength columns to refinement output.
…thm to mcd. Fix typo when checking wavelength_strategy override.
Just to make sure, is this PR for Laue data collected with ToF detectors? In other words, we cannot use this on X-ray Laue or pink beam datasets without ToF information (i.e. unknown per-spot |
I've written it so you should be able to use this for any data where you have assigned wavelengths to observed reflections, and you have enough confidence in the assignment to minimise your model against them. All your data should need is a If you have any Laue data I could use a basis of a test that would be useful! |
|
@toastisme The only Laue dataset I found is https://zenodo.org/records/10199220. |
|
There are quite a lot of new classes added here, but no added tests.
I don't think it is necessary to write individual tests for all of these, as not all of the rotation equivalents of these classes are tested directly in a unit test like manner either. However, some of them are. For example, derivatives are tested versus finite difference approximations in places like A similar test vs finite-differences might be useful for There's also a test of the gradients of the target function The whole machinery of rotation method refinement is also tested against generated reflection positions using ideal geometry in |
Yes completely agree. Thanks for highlighting the key areas to test. I had some dials data / dials data files prs to add some neutron data to write these kind of tests that are now merged. I was hoping to have some X-ray Laue data too. |
…hreshold of test_finite_diffs slightly. Change error message when creating ExperimentsPredictor for time of flight experiments.
|
Tests have now been added for the full prediction equation parameterisation in |
dagewa
left a comment
There was a problem hiding this comment.
Thanks for adding the tests. I have no additional changes to request. Happy to see this go in to further support polychromatic experiments in DIALS 👍
* Enable time-of-flight indexing and Laue/time-of-flight refinement.
Apologies for this being a large PR - it's difficult to separate out the different components. This enables indexing for time-of-flight data, and refinement for time-of-flight data and Laue data more broadly. The main contributions are Laue specific refinement classes that also minimise degrees of freedom with respect to the calculated and observed wavelength of each reflection.
Usage:
dials.index imported.expt strong.refl reflections.weighting_strategy.override=<constant, statistical> reflections.weighting_strategy.wavelength_weight=<weight>Laue refinement refines the wavelength with respect to the crystal orientation and unit cell. Beam parameterisation is done for the beam direction only.
Background
The diffraction condition can be written
where$\mathbf{p^*_0}$ is the reciprocal lattice vector obtained from the candidate UB matrix for a given Miller index. For a rotation experiment we satisfy the condition by identifying the angle $\mathbf{p^*_0}$ must be rotated by to cross the Ewald sphere. For a Laue experiment, we can instead find the required wavelength by rearranging the diffraction condition to give
The target function to minimise during refinement is a weighted sum of squared residuals over all$n$ observed reflections
where$X, Y, \lambda$ correspond to calculated reflection centroid positions in the x, y panel positions, and a wavelength calculated as above, respectively. Likewise, $X_{obs}, Y_{obs}, \lambda_{obs}$ refer to the centroid positions obtained from spot finding. $w_{i,X}, w_{i,Y}, w_{i,\lambda}$ are weight coefficients based on the strategy selected by the user. $L$ has first derivatives
where$p$ refers to a degree of freedom of the model obtained from indexing (e.g. unit cell angles, lengths, panel positions etc.). To refine centroids with respect to their calculated wavelengths we need to calculate $\frac{\partial \lambda}{\partial p}$ .
and so
Corresponding changes for XY positions are then obtained as
where$u,v,w$ are elements of $\mathbf{v}$ [1], with the change in $\mathbf{v}$ given by
[1] D. G. Waterman, G. Winter, R. J. Gildea, J. M. Parkhurst, A. S. Brewster, N. K. Sauter, and G. Evans.
Diffraction-geometry refinement in the DIALS framework. Acta Crystallographica Section D, 72(4):558–
575, Apr 2016.
Weighting strategies
I looked at constant and statistical weighting strategies for$w_{\lambda}$ . At least for time-of-flight experiments, the variance along the wavelength direction for each spot is less obviously useful, as the spot profile typically has a long tail. Instead I used the variance in the X and Y multiplied by a constant. Results for different values are given below. exp (blue dashed line) refers to expected results for a given unit cell parameter. Looking at the average mean squared error across the datasets, statistical weighting seems generally better, with the best weighting being 1E4.
