praxes / hexrd

Legacy hexrd repository (python2.7)
http://hexrd.readthedocs.org
14 stars 42 forks source link

strain calculation in the ipython notebook #69

Closed ddale closed 9 years ago

ddale commented 9 years ago

@joelvbernier

Nice job merging changes in the notebook.

I just ran the new version on the Clausen ruby data, and got a factor of 10 higher strains than with the version I worked with yesterday. I tracked it down to this change:

# first, kick out omegas that are too far away
x_diff = abs(gtable[idx_0, -3] - xyo_f[:, 0])
y_diff = abs(gtable[idx_0, -2] - xyo_f[:, 1])
ome_diff = r2d*xf.angularDifference(gtable[idx_0, -1], xyo_f[:, 2])
idx_1 = np.logical_and(x_diff <= 0.2, np.logical_and(y_diff <= 0.2, ome_diff <= 0.25))
Review of ssq values:
    Initial     Detector only   Strain fit

    -------     -------------   ----------
    5.3270e+00  4.2878e+00  4.2494e+00

Calibrant Hencky Strain Tensor (sample frame):

[[  1.16111692e-04  -1.24410237e-05   6.44786636e-05]
 [ -1.24410237e-05  -2.79076151e-05   1.07704621e-05]
 [  6.44786636e-05   1.07704621e-05  -1.22952652e-04]]

If I use the old version instead:

ome_diff = r2d*xf.angularDifference(gtable[idx_0, -1], xyo_f[:, 2])
idx_1 = abs(ome_diff) <= 0.25
Review of ssq values:
    Initial     Detector only   Strain fit

    -------     -------------   ----------
    5.6061e+00  5.3538e+00  5.2880e+00

Calibrant Hencky Strain Tensor (sample frame):

[[  2.59835835e-05  -2.40768962e-06   3.08130932e-05]
 [ -2.40768962e-06  -9.66600142e-06   1.02573342e-05]
 [  3.08130932e-05   1.02573342e-05  -1.75768683e-05]]

Any thoughts?

joelvbernier commented 9 years ago

Now kicking out outliers in x-y too that might be dragging the solution around... The least squares is sensitive. That is ruby data? Are you refining the same parameters?

Sent from my iPhone

On Nov 18, 2014, at 7:19 AM, Darren Dale notifications@github.com wrote:

@joelvbernier

Nice job merging changes in the notebook.

I just ran the new version on the Clausen ruby data, and got a factor of 10 higher strains than with the version I worked with yesterday. I tracked it down to this change:

first, kick out omegas that are too far away

x_diff = abs(gtable[idx_0, -3] - xyo_f[:, 0]) y_diff = abs(gtable[idx_0, -2] - xyo_f[:, 1]) ome_diff = r2d*xf.angularDifference(gtable[idx_0, -1], xyo_f[:, 2]) idx_1 = np.logical_and(x_diff <= 0.2, np.logical_and(y_diff <= 0.2, ome_diff <= 0.25)) Review of ssq values: Initial Detector only Strain fit

-------     -------------   ----------
5.3270e+00  4.2878e+00  4.2494e+00

Calibrant Hencky Strain Tensor (sample frame):

[[ 1.16111692e-04 -1.24410237e-05 6.44786636e-05] [ -1.24410237e-05 -2.79076151e-05 1.07704621e-05] [ 6.44786636e-05 1.07704621e-05 -1.22952652e-04]] If I use the old version instead:

ome_diff = r2d*xf.angularDifference(gtable[idx_0, -1], xyo_f[:, 2]) idx_1 = abs(ome_diff) <= 0.25 Review of ssq values: Initial Detector only Strain fit

-------     -------------   ----------
5.6061e+00  5.3538e+00  5.2880e+00

Calibrant Hencky Strain Tensor (sample frame):

[[ 2.59835835e-05 -2.40768962e-06 3.08130932e-05] [ -2.40768962e-06 -9.66600142e-06 1.02573342e-05] [ 3.08130932e-05 1.02573342e-05 -1.75768683e-05]] Any thoughts?

— Reply to this email directly or view it on GitHub.

ddale commented 9 years ago

Yes, it is ruby data. I'm refining the exact same data with the same parameters, just using the old or new method for rejecting outliers. Tried running through three times in a row with the new approach, always get the same ~1e-4 results, changing to the old method immediately yields 1e-5 results. Switch back to the new version, and it yields 1e-4 again.

joelvbernier commented 9 years ago

How is the number of spots fit changing between the two?

Sent from my iPhone

On Nov 18, 2014, at 10:17 AM, Darren Dale notifications@github.com wrote:

Yes, it is ruby data. I'm refining the exact same data with the same parameters, just using the old or new method for rejecting outliers. Tried running through three times in a row with the new approach, always get the same ~1e-4 results, changing to the old method immediately yields 1e-5 results. Switch back to the new version, and it yields 1e-4 again.

— Reply to this email directly or view it on GitHub.

joelvbernier commented 9 years ago

Those also seem like large residuals... Are the tolerances for spot fitting big enough in two theta? Is wavelength accurate?

Sent from my iPhone

On Nov 18, 2014, at 7:19 AM, Darren Dale notifications@github.com wrote:

@joelvbernier

Nice job merging changes in the notebook.

I just ran the new version on the Clausen ruby data, and got a factor of 10 higher strains than with the version I worked with yesterday. I tracked it down to this change:

first, kick out omegas that are too far away

x_diff = abs(gtable[idx_0, -3] - xyo_f[:, 0]) y_diff = abs(gtable[idx_0, -2] - xyo_f[:, 1]) ome_diff = r2d*xf.angularDifference(gtable[idx_0, -1], xyo_f[:, 2]) idx_1 = np.logical_and(x_diff <= 0.2, np.logical_and(y_diff <= 0.2, ome_diff <= 0.25)) Review of ssq values: Initial Detector only Strain fit

-------     -------------   ----------
5.3270e+00  4.2878e+00  4.2494e+00

Calibrant Hencky Strain Tensor (sample frame):

[[ 1.16111692e-04 -1.24410237e-05 6.44786636e-05] [ -1.24410237e-05 -2.79076151e-05 1.07704621e-05] [ 6.44786636e-05 1.07704621e-05 -1.22952652e-04]] If I use the old version instead:

ome_diff = r2d*xf.angularDifference(gtable[idx_0, -1], xyo_f[:, 2]) idx_1 = abs(ome_diff) <= 0.25 Review of ssq values: Initial Detector only Strain fit

-------     -------------   ----------
5.6061e+00  5.3538e+00  5.2880e+00

Calibrant Hencky Strain Tensor (sample frame):

[[ 2.59835835e-05 -2.40768962e-06 3.08130932e-05] [ -2.40768962e-06 -9.66600142e-06 1.02573342e-05] [ 3.08130932e-05 1.02573342e-05 -1.75768683e-05]] Any thoughts?

— Reply to this email directly or view it on GitHub.

joelvbernier commented 9 years ago

Can you bzip the image stack and send me the config file, wavelength and instrument file (old one) on Google drive?

Sent from my iPhone

On Nov 18, 2014, at 7:19 AM, Darren Dale notifications@github.com wrote:

@joelvbernier

Nice job merging changes in the notebook.

I just ran the new version on the Clausen ruby data, and got a factor of 10 higher strains than with the version I worked with yesterday. I tracked it down to this change:

first, kick out omegas that are too far away

x_diff = abs(gtable[idx_0, -3] - xyo_f[:, 0]) y_diff = abs(gtable[idx_0, -2] - xyo_f[:, 1]) ome_diff = r2d*xf.angularDifference(gtable[idx_0, -1], xyo_f[:, 2]) idx_1 = np.logical_and(x_diff <= 0.2, np.logical_and(y_diff <= 0.2, ome_diff <= 0.25)) Review of ssq values: Initial Detector only Strain fit

-------     -------------   ----------
5.3270e+00  4.2878e+00  4.2494e+00

Calibrant Hencky Strain Tensor (sample frame):

[[ 1.16111692e-04 -1.24410237e-05 6.44786636e-05] [ -1.24410237e-05 -2.79076151e-05 1.07704621e-05] [ 6.44786636e-05 1.07704621e-05 -1.22952652e-04]] If I use the old version instead:

ome_diff = r2d*xf.angularDifference(gtable[idx_0, -1], xyo_f[:, 2]) idx_1 = abs(ome_diff) <= 0.25 Review of ssq values: Initial Detector only Strain fit

-------     -------------   ----------
5.6061e+00  5.3538e+00  5.2880e+00

Calibrant Hencky Strain Tensor (sample frame):

[[ 2.59835835e-05 -2.40768962e-06 3.08130932e-05] [ -2.40768962e-06 -9.66600142e-06 1.02573342e-05] [ 3.08130932e-05 1.02573342e-05 -1.75768683e-05]] Any thoughts?

— Reply to this email directly or view it on GitHub.

ddale commented 9 years ago

What should the residuals look like?

I think the wavelength is accurate. I just ran the notebook through several times, tweaking the wavelength, and got the best results with the expected wavelength