hexrd.fitting.calibration.powder module

class hexrd.fitting.calibration.powder.PowderCalibrator(instr, material, img_dict, default_refinements=None, tth_tol=None, eta_tol=0.25, fwhm_estimate=None, min_pk_sep=0.001, min_ampl=0.0, pktype='pvoigt', bgtype='linear', tth_distortion=None, calibration_picks=None)[source]

Bases: Calibrator

autopick_points(fit_tth_tol=5.0, int_cutoff=0.0001)[source]

return the RHS for the instrument DOF and image dict

The format is a dict over detectors, each containing

[index over ring sets]
[index over azimuthal patch]

[xy_meas, tth_meas, hkl, dsp_ref, eta_ref]

FIXME: can not yet handle tth ranges with multiple peaks!

property calibration_picks

A way to retrieve picks in calibration format

Often, the calibrators store the picks in a different format internally. But the calibrators must have a way to set/get from the calibration_picks format. The calibration_picks format looks like this:

{
“det_key1”: {

“hkl1”: picks1, “hkl2”: picks2, …

}, “det_key2”: …

}

Where “det_key” is the detector key. “hkl” is a space-delimited string of the hkl. And “picks” are either a list of points (powder) or a single point (laue). The picks are in cartesian coordinates.

create_lmfit_params(current_params)[source]

Create lmfit parameters that this class will use and return them

current_params is passed only so that this class can ensure that it does not produce any name conflicts with existing parameters.

It is recommended to save the names of the parameters created, for example, self.param_names, to remember them when updating in the future.

For example, the powder calibrator creates lmfit parameters for the lattice parameters. The Laue calibrator creates lmfit parameters for crystal parameters.

model()[source]
property plane_data
residual()[source]

Compute a residual using the calibration data.

Calibration data may have already been stored as an attribute on the calibration class instead, in which case, calibration_data can be None.

property spectrum_kwargs
property tth_tol
type = 'powder'
update_from_lmfit_params(params_dict)[source]

Update any needed properties based on the params_dict

The entries in the params_dict should have the same names as those that were created via create_lmfit_params(). Update any local parameters based upon the new contents of the params_dict.

For example, the powder calibrator will update the lattice parameters on the material. The Laue calibrator will update crystal parameters.