garnet.plots package#
Submodules#
garnet.plots.base module#
garnet.plots.colors module#
Atom color map for plotting (shared module).
garnet.plots.crystal module#
garnet.plots.monitor module#
- class SlicePlot(UB, W)[source]#
Bases:
objectPlotly version of the reciprocal-space slice plot.
This version resamples the oblique slice grid onto a rectangular display grid and draws it with a standard Plotly Heatmap.
- Parameters:
- UBndarray, shape (3, 3)
UB matrix.
- Wndarray, shape (3, 3)
Basis or transform matrix used to construct the metric tensor in the slice frame.
Methods
calculate_transforms(axes, labels, normal[, ...])Precompute the display transform and build the Plotly heatmap.
make_slice(data_signal, norm_signal, value)Update the figure to show the slice nearest the requested value.
- calculate_transforms(axes, labels, normal, oversample=1.0, interpolation='nearest')[source]#
Precompute the display transform and build the Plotly heatmap.
- Parameters:
- axessequence of ndarray
Axis arrays for the 3 dimensions.
- labelssequence of str
Axis labels for the 3 dimensions.
- normalarray-like of length 3
Slice normal selector. This follows the same convention as the original code: the dimension with value 1 is taken as the sliced dimension.
- oversamplefloat, optional
Display oversampling factor for the rectangular grid. A value of 1.0 is usually fine.
- interpolation{“nearest”, “linear”}, optional
Interpolation used when resampling onto the display grid.
- make_slice(data_signal, norm_signal, value)[source]#
Update the figure to show the slice nearest the requested value.
Counts and normalization are resampled onto the display grid separately, then divided – resampling their ratio directly produces artifacts near masked/zero-exposure bins, since a single missing/zero normalization value would otherwise corrupt the interpolated ratio in its whole interpolation neighborhood.
- Parameters:
- data_signalndarray, shape (n0, n1, n2)
3D raw-counts signal array.
- norm_signalndarray, shape (n0, n1, n2)
3D normalization signal array, matching data_signal’s shape.
- valuefloat
Requested slice coordinate.
garnet.plots.peaks module#
- class PeakCentroidPlot(c0, c1, c2, Q, r_cut, d_min)[source]#
Bases:
BasePlotMethods
save_plot(filename)Save plot.
close
- class PeakEstimatePlot(zs, ys, es)[source]#
Bases:
BasePlotMethods
save_plot(filename)Save plot.
close
plot_peak_bins
- class PeakPlot[source]#
Bases:
BasePlotMethods
add_ellipsoid(c, S)Draw ellipsoid envelopes.
add_ellipsoid_fit(xye_fit)Three-dimensional ellipsoids.
add_estimated_ellipsoid(c, S)Draw estimated ellipsoid envelopes on ROI views.
add_peak_info(hkl, d, wavelength, angles, gon)Add peak information.
add_peak_stats(reddev, intensity, sigma)Add peak statistics.
save_plot(filename)Save the current peak figure without rebuilding it.
update_envelope(x0, x1, x2, pk, bkg)Draw region-of-interest.
add_data_norm_fit
add_profile_bkg
add_profile_fit
add_profile_iterations
add_projection_fit
close
- add_ellipsoid(c, S)[source]#
Draw ellipsoid envelopes.
- Parameters:
- c1d-array
3 component center.
- S2d-array
3x3 covariance matrix.
- add_ellipsoid_fit(xye_fit)[source]#
Three-dimensional ellipsoids.
- Parameters:
- x0, x1, x2, y, e, fit3d-array
Bins, signal, error, and fit.
- add_estimated_ellipsoid(c, S)[source]#
Draw estimated ellipsoid envelopes on ROI views.
- Parameters:
- c1d-array
3 component center.
- S2d-array
3x3 covariance matrix.
- add_peak_info(hkl, d, wavelength, angles, gon)[source]#
Add peak information.
- Parameters:
- hkllist
Miller indices.
- dfloat,
Interplanar d-spacing.
- wavelengthfloat
Wavelength.
- angleslist
Scattering and azimuthal angles.
- gonlist
Goniometer Euler angles.
- add_peak_stats(reddev, intensity, sigma)[source]#
Add peak statistics.
- Parameters:
- reddevlist
Reduced Poisson deviance D/dof per mode.
- intensitylist
Integrated intensity.
- sigmalist
Integrated intensity uncertainty.
- class PeakProfilePlot(x, y, e, vol, r, r_cut)[source]#
Bases:
BasePlotMethods
save_plot(filename)Save plot.
close
draw_boundary
plot_peak_bins
plot_peaks
- class RadialProfilePlot[source]#
Bases:
BasePlotA peak’s radial profile fit: the counts along Q (summed over the disc across it) with the counts expected from the fit, and the counts across the disc with its boundary and the peak’s own transverse ellipse. The figure is built once and reused for every peak drawn. Call close when done.
Methods
draw(profile, title, filename[, containment])Draw a peak's profiles and save the figure.
save_plot(filename)Save plot.
close
- draw(profile, title, filename, containment=1.0)[source]#
Draw a peak’s profiles and save the figure.
- Parameters:
- profiledict
Profiles, as from integrate_radial_profiles.
- titlestr
Figure title.
- filenamestr
Image file.
- containmentfloat, optional
Scale of the transverse ellipse, in standard deviations. The default is 1.