We cannot pass a 3-component projection center (PC) array with more than one dimension to EBSD.hough_indexing_optimize_pc(). This PR fixes this. Since it's a bug, I'll release the fix as a patch release 0.8.7 tomorrow Monday 24 July.
The previousy failing behavior is now tested.
The error raised is:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[10], line 1
----> 1 det_ref = s_in.hough_indexing_optimize_pc(pc0=det.pc, indexer=indexer)
3 print(det.pc - det_ref.pc)
File ~/checkouts/readthedocs.org/user_builds/kikuchipy/envs/646/lib/python3.11/site-packages/kikuchipy/signals/ebsd.py:1803, in EBSD.hough_indexing_optimize_pc(self, pc0, indexer, batch, method)
1800 if self._lazy: # pragma: no cover
1801 patterns = patterns.rechunk({0: "auto", 1: -1, 2: -1})
-> 1803 pc = _optimize_pc(
1804 pc0=pc0, patterns=patterns, indexer=indexer, batch=batch, method=method
1805 )
1807 if batch:
1808 pc = pc.reshape(nav_shape + (3,))
File ~/checkouts/readthedocs.org/user_builds/kikuchipy/envs/646/lib/python3.11/site-packages/kikuchipy/indexing/_hough_indexing.py:411, in _optimize_pc(pc0, patterns, indexer, batch, method)
409 else:
410 from pyebsdindex.pcopt import optimize as optimize_func
--> 411 return optimize_func(pats=patterns, indexer=indexer, PC0=pc0, batch=batch)
File ~/checkouts/readthedocs.org/user_builds/kikuchipy/envs/646/lib/python3.11/site-packages/pyebsdindex/pcopt.py:119, in optimize(pats, indexer, PC0, batch)
116 PC0 = PCtemp
118 if not batch:
--> 119 PCopt = opt.minimize(
120 _optfunction,
121 PC0,
122 args=(indexer, banddat),
123 method="Nelder-Mead",
124 options={"fatol": 0.00001}
125 )
126 PCoutRet = PCopt['x']
127 else:
File ~/checkouts/readthedocs.org/user_builds/kikuchipy/envs/646/lib/python3.11/site-packages/scipy/optimize/_minimize.py:533, in minimize(fun, x0, args, method, jac, hess, hessp, bounds, constraints, tol, callback, options)
530 x0 = np.atleast_1d(np.asarray(x0))
532 if x0.ndim != 1:
--> 533 raise ValueError("'x0' must only have one dimension.")
535 if x0.dtype.kind in np.typecodes["AllInteger"]:
536 x0 = np.asarray(x0, dtype=float)
ValueError: 'x0' must only have one dimension.
Description of the change
We cannot pass a 3-component projection center (PC) array with more than one dimension to
EBSD.hough_indexing_optimize_pc()
. This PR fixes this. Since it's a bug, I'll release the fix as a patch release 0.8.7 tomorrow Monday 24 July.The previousy failing behavior is now tested.
The error raised is:
It is seen in the docs built from #646: https://kikuchipy--646.org.readthedocs.build/en/646/tutorials/pc_calibration_moving_screen_technique.html.
Progress of the PR
For reviewers
__init__.py
.CHANGELOG.rst
.release.py
,.zenodo.json
and.all-contributorsrc
with the table regenerated.