Results#
FrameResult owns Python copies of native indexing output. A result with no
identified patterns is valid and can still contain detected peaks and frame
statistics.
Frame Result#
- class lauelab.indexing.FrameResult(peaks, patterns, threshold_used, total_sum, sum_above_threshold, num_above_threshold, peaksearch_seconds, indexing_seconds, threshold_ratio=4.0, peak_minwidth=0.0, peak_maxwidth=0.0, peak_max_cent_to_fit=0.0, peak_boxsize=0, metadata={}, input_image=None, image_shape=(0, 0), start=(0, 0), group=(1, 1), depth=None, image=None)[source]#
Self-contained result of processing one diffraction frame.
- Parameters:
peaks (numpy.ndarray) – Structured peak array with shape
(n,). Fields arefit_x,fit_y,intens,integral,hwhm_x,hwhm_y,tilt,chisq,background, and the three-componentqhatvector.patterns (tuple[lauelab.indexing.indexer.Pattern, ...]) – Crystal orientations identified in the frame.
threshold_used (float) – Intensity threshold used by peak search. This is
NaNwhen automatic thresholding receives no unmasked nonzero pixels.total_sum (float) – Sum of unmasked raw frame pixel values.
sum_above_threshold (float) – Sum of pixel values above
threshold_used.num_above_threshold (int) – Number of pixels above
threshold_used.peak_minwidth (float) – Effective fitting parameters configured by the native peak search.
peak_maxwidth (float) – Effective fitting parameters configured by the native peak search.
peak_max_cent_to_fit (float) – Effective fitting parameters configured by the native peak search.
peak_boxsize (int) – Effective fitting parameters configured by the native peak search.
peaksearch_seconds (float) – Elapsed peak-search time in seconds.
indexing_seconds (float) – Elapsed orientation-indexing time in seconds. Pixel-to-q conversion is not included in either timing field.
threshold_ratio (float) – Resolved automatic-threshold ratio supplied to native peak search, or
NaNwhen an absolute threshold made the ratio inactive.metadata (Mapping[str, object]) – Experiment metadata copied into the result.
input_image (str | None) – Source HDF5 path, or None for an in-memory frame.
image_shape (tuple[int, int]) – Frame shape as
(rows, columns).start (tuple[int, int]) – Zero-based detector
(x, y)origin of the frame.group (tuple[int, int]) – Detector-pixel grouping factors as
(x, y).depth (float | None) – Optional sample depth in micrometres passed to the geometry conversion.
image (numpy.ndarray | None) – Retained contiguous
uint16frame, or None when image retention was disabled. This array can alias a contiguous array supplied by the caller. Native smoothing uses a separate working copy.
Notes
Native result memory is released before this object is returned. The dataclass is frozen, but contained arrays and the metadata mapping may remain mutable. A result with no patterns is valid and has
indexedset to False.- property indexed_peak_indices: numpy.ndarray#
Sorted unique peak indices assigned to any pattern.
- Returns:
numpy.ndarray – One-dimensional array of zero-based indices into
peaks.
- property unindexed_peak_indices: numpy.ndarray#
Sorted peak indices not assigned to a pattern.
- Returns:
numpy.ndarray – One-dimensional array of zero-based indices into
peaks.
- write_xml(path)[source]#
Write this result in the LaueGo XML format.
- Parameters:
path (str | Path) – Destination XML file. An existing file is replaced.
- Raises:
RuntimeError – If the result was constructed manually without an XML snapshot.
OSError – If the destination cannot be written.
Indexed Pattern#
See the results guide for the reciprocal-basis convention used by Pattern.reciprocal.
- class lauelab.indexing.Pattern(euler_deg, rotation, reciprocal, goodness, rms_error_deg, hkl, pk_index, err_deg, energy_kev, pred_intens)[source]#
One crystal orientation identified in a diffraction frame.
- Parameters:
euler_deg (numpy.ndarray) – Euler angles in degrees, with shape
(3,).rotation (numpy.ndarray) – Orientation rotation matrix with shape
(3, 3).reciprocal (numpy.ndarray) – Reciprocal-lattice matrix with shape
(3, 3)in1/nm. Rows area*,b*, andc*; a Miller-index row maps to reciprocal space asq = hkl @ reciprocal.goodness (float) – Native indexer’s goodness score for the pattern.
rms_error_deg (float) – Root-mean-square angular indexing error in degrees.
hkl (numpy.ndarray) – Integer Miller indices with shape
(n, 3).pk_index (numpy.ndarray) – Zero-based indices into the frame’s peak array, with shape
(n,).err_deg (numpy.ndarray) – Per-peak angular errors in degrees, with shape
(n,).energy_kev (numpy.ndarray) – Per-peak photon energies in keV, with shape
(n,).pred_intens (numpy.ndarray) – Per-peak predicted intensities, with shape
(n,).
Notes
The dataclass is frozen, but its NumPy arrays remain mutable. Each pattern owns Python arrays copied from the native result.