hexrd.fitgrains module

Created on Wed Mar 22 19:04:10 2017

@author: bernier2

hexrd.fitgrains.fit_grain_FF_cleanup()[source]

Tears down the global fitting parameters.

hexrd.fitgrains.fit_grain_FF_init(params)[source]

Broadcast the fitting parameters as globals for multiprocessing

Parameters

paramsdict

The dictionary of fitting parameters.

Returns

None.

Notes

See fit_grain_FF_reduced for specification.

hexrd.fitgrains.fit_grain_FF_reduced(grain_id)[source]

Perform non-linear least-square fit for the specified grain.

Parameters

grain_idint

The grain id.

Returns

grain_idint

The grain id.

completenessfloat

The ratio of predicted to measured (observed) Bragg reflections.

chisq: float

Figure of merit describing the sum of squared residuals for each Bragg reflection in the form (x, y, omega) normalized by the total number of degrees of freedom.

grain_paramsarray_like

The optimized grain parameters [<orientation [3]>, <centroid [3]> <inverse stretch [6]>].

Notes

input parameters are [plane_data, instrument, imgser_dict, tth_tol, eta_tol, ome_tol, npdiv, threshold]

hexrd.fitgrains.fit_grains(cfg, grains_table, show_progress=False, ids_to_refine=None, write_spots_files=True, check_if_canceled_func=None)[source]

Performs optimization of grain parameters.

operates on a single HEDM config block

The check_if_canceled_func has the following signature:

check_if_canceled_func() -> bool

If it returns True, it indicates that fit_grains should be canceled. This is done by terminating the multiprocessing processes.

If check_if_canceled_func is set, multiprocessing will be performed, even if there is only one grain or one process, so that it will be cancelable.