HEXRD / hexrdgui

Qt6 PySide6 based GUI for the HEXRD library.
Other
28 stars 13 forks source link

Tweaking fitgrains tolerance for better strain tensor/position results #955

Open minety opened 3 years ago

minety commented 3 years ago

image

I found that as I keep decreasing the tolerance for fitgrains as shown above, the chi^2 becomes smaller. (it can even reach 1e07 for certain grains.)

My question is what is the optimum fitting strategy for this, are the parameters in the image good enough?

Thanks, Tian

joelvbernier commented 3 years ago

@minety -- a few things.

  1. npdiv can usually be set to 2 (which already does 2x oversampling of the image intensities onto the local angular grids); 4 is way overkill for most samples with peaks that aren't very sharp. Setting to 2 will speed up the fitting and decrease memory usage. Diminishing returns to set > 2...
  2. there is no active_hkls parameter for fit-grains; that does nothing here. It will use all hkls generated according to the specifications in the material block (example below) subject to whatever the tth_max condition is. Furthermore, you would never do a fit with only 3 G-vector families with so much more information available in a typical HEDM measurement. You have 12 parameters to fit for each grain and it is generally best to make the fit as overdetermined as possible.
  3. I would say the best practice is 2, maybe 3 decreasing tolerance bounds on the fitting at the most. Your ranges are far too tight, and I suspect what is happening is that you are severely clipping your reflections (0.01 degree is probably <= 1 pixel at most places on the detector!). the fact that you are fitting very few pixels maybe in the middle of the peak and so few reflections is causing artificially small chi^2 values (observe that if all the pixels in the box have nearly the same intensity, then the 'fit' peak position with erroneously come back as essentially the middle of the box, which is the predicted value). For the proper fidelity fits, your boxes MUST BE LARGE ENOUGH to contain the full Bragg peak. I realize that the GUI doesn't make this that easy right now, but you can use the cursor over some unaggregated spots to get an idea of the typical size of a spot. We are working on an overlay to draw the boxes for a grain in both the unaggregated and aggregated views.

See this example for a relatively weak reflection from the NIST ruby single crystal, which has very sharp peaks. This is from the single GE example here (the montage goes from upper-left to lower-right across the rows in increasing ω). image These montage plots were generated from the HDF5 spot output (attached) as

(hexrd_0.8) PS C:\Users\berni\Documents\GitHub\hexrd-examples\NIST_ruby\single_GE\include> python .\spot_montage.py --help
usage: spot_montage.py [-h] [-t THRESHOLD] hdf5_archive gvec_id

Montage of spot data for a specifed G-vector family

positional arguments:
  hdf5_archive          hdf5 archive filename
  gvec_id               unique G-vector ID from PlaneData

optional arguments:
  -h, --help            show this help message and exit
  -t THRESHOLD, --threshold THRESHOLD
                        intensity threshold
(hexrd_0.8) PS C:\Users\berni\Documents\GitHub\hexrd-examples\NIST_ruby\single_GE\include> python -i .\spot_montage.py .\results_ruby_hexrd08_py38_scan_0\grain_00000_nearest.hdf5 1

As you can see, the tth extent of this sharp spot is still > 0.125°, and the eta extent is larger than 1° (the box sizes, for ref, are [0.25°, 3.0°, 2.0°] (with 0.25° steps in ω).

It takes some experience to understand what the various tolerances are doing, and I apologize for the delay in better documentation (I am working on it!). At least your experience is helping me to refine the sticking points!

spot_montage.zip

joelvbernier commented 3 years ago

@minety -- did this help?

minety commented 2 years ago

@joelvbernier Yes, this helped a lot. Thanks.