pyFAI.gui package
The package pyFAI.gui contains mainly the code of the graphical user interface widgets. This code is not intended to be used by users of pyFAI as a library hence it makes little sense to document it all here. Only documentation on the Jupyter tools are exposed.
pyFAI.gui.cli_calibration module
pyFAI.gui.jupyter module
pyFAI.gui.matplotlib module
pyFAI.gui.peak_picker module
Semi-graphical tool for peak-picking and extracting visually control points from an image with Debye-Scherer rings
- class pyFAI.gui.peak_picker.PeakPicker(data, reconst=False, mask=None, pointfile=None, calibrant=None, wavelength=None, detector=None, method='massif')
Bases:
object
This class is in charge of peak picking, i.e. find bragg spots in the image Two methods can be used : massif or blob
- VALID_METHODS = ['massif', 'blob', 'watershed']
- __init__(data, reconst=False, mask=None, pointfile=None, calibrant=None, wavelength=None, detector=None, method='massif')
- Parameters:
data – input image as numpy array
reconst – shall masked part or negative values be reconstructed (wipe out problems with pilatus gaps)
mask – area in which keypoints will not be considered as valid
pointfile –
- property append_mode
- closeGUI()
- contour(data, cmap='autumn', linewidths=2, linestyles='dashed')
Overlay a contour-plot
- Parameters:
data – 2darray with the 2theta values in radians…
- display_points(minIndex=0, reset=False)
display all points and their ring annotations :param minIndex: ring index to start with :param reset: remove all point before re-displaying them
- finish(filename=None, callback=None)
Ask the ring number for the given points
- Parameters:
filename – file with the point coordinates saved
callback –
- Returns:
list of control points
- gui(log=False, maximize=False, pick=True, widget_klass=None)
Display the GUI
- Parameters:
log – show z in log scale
maximize – set to true to maximize window
pick – activate pixel picking
widget_klass – provide the MplCalibWidget (either Qt or Jupyter) to instanciate the widget
- Returns:
None
- help = ['Please select rings on the diffraction image. In parenthesis, some modified shortcuts for single button mouse (Apple):', ' * Right-click (click+n): try an auto find for a ring', ' * Right-click + Ctrl (click+b): create new group with one point', ' * Right-click + Shift (click+v): add one point to current group', ' * Right-click + m (click+m): find more points for current group', ' * Center-click or (click+d): erase current group', ' * Center-click + 1 or (click+1): erase closest point from current group']
- init(method, sync=True)
Unified initializer
- load(filename)
load a filename and plot data on the screen (if GUI)
- massif_contour(data)
Overlays a mask over a diffraction image
- Parameters:
data – mask to be overlaid
- on_minus_pts_clicked(*args)
callback function
- on_plus_pts_clicked(*args)
callback function
- onclick_append_1_point(yx, ring=None)
Right-click + Shift (click+v): add one point to current group
- Parameters:
xy – 2tuple of coordinates
- onclick_append_more_points(yx, ring)
Right-click + m (click+m): find more points for current group
- onclick_erase_1_point(yx, ring)
Center-click + 1 or (click+1): erase closest point from current group
- onclick_erase_grp(yx, ring)
Center-click or (click+d): erase current group
- onclick_new_grp(yx, ring)
new_grp Right-click (click+n): try an auto find for a ring
- onclick_option(*args)
callback function
- onclick_refine(*args)
callback function
- onclick_single_point(yx, ring)
Right-click + Ctrl (click+b): create new group with one single point
- peaks_from_area(**kwargs)
Return the list of peaks within an area
- Parameters:
mask – 2d array with mask.
Imin – minimum of intensity above the background to keep the point
keep – maximum number of points to keep
method – enforce the use of detection using “massif” or “blob” or “watershed”
ring – ring number to which assign the points
dmin – minimum distance between two peaks (in pixels)
seed – good starting points.
- Returns:
list of peaks [y,x], [y,x], …]
- remove_grp(lbl)
remove a group of points
- Parameters:
lbl – label of the group of points
- reset()
Reset control point and graph (if needed)
- sync_init()
- pyFAI.gui.peak_picker.preprocess_image(data, log=False, clip=0.001)
Preforms the pre-processing of the image
- Parameters:
data – the input image
log – set to apply logarithmic intensity scale
clip – discard pixel fraction which are too weak/intense
- Returns:
scaled image, bounds