optimize_pso#

pyebsdindex.pcopt.optimize_pso(pats, indexer, PC0=None, batch=False, search_limit=0.2, nswarmparticles=30, pswarmpar=None, niter=50, verbose=1)[source]#

Optimize pattern center (PC) (PCx, PCy, PCz) in the convention of the indexer.vendor with particle swarms.

Parameters:
patsnumpy.ndarray

EBSD pattern(s), of shape (n detector rows, n detector columns), or (n patterns, n detector rows, n detector columns).

indexerpyebsdindex.ebsd_index.EBSDIndexer

EBSD indexer instance storing all relevant parameters for band detection.

PC0list, optional

Initial guess of PC. If not given, indexer.PC is used. If indexer.vendor is "EMSOFT", the PC must be four numbers, the final number being the pixel size.

batchbool, optional

Default is False which indicates the fit for a set of patterns should be optimized using the cumulative fit for all the patterns, and one PC will be returned. If True, then an optimization is run for each individual pattern, and an array of PC values is returned.

search_limitfloat, optional

Default is 0.2 for all PC values, and sets the +/- limit for the optimization search.

nswarmparticlesint, optional

Number of particles in a swarm. Default is 30.

pswarmpardict, optional

Particle swarm parameters “c1”, “c2”, and “w” with defaults 3.5, 3.5, and 0.8, respectively.

niterint, optional

Number of iterations. Default is 50.

verboseint, optional

Whether to print the parameters and progress of the optimization (>= 1) or not (< 1). Default is to print.

Returns:
numpy.ndarray

Optimized PC.