The widgets.silx_plot sub-package#

Package with subclassed silx widgets and actions.

class pydidas.widgets.silx_plot.PydidasMaskToolsWidget(parent: None | QWidget = None, plot: None | QWidget = None, **kwargs: dict)#

Bases: MaskToolsWidget

A customized silx.gui.plot.MaskToolsWidget with larger buttons.

class pydidas.widgets.silx_plot.PydidasPlot1D(**kwargs: dict)#

Bases: Plot1D

A customized silx.gui.plot.Plot1D with an additional configuration.

clear_plot(clear_data: bool = True)#

Clear the plot and remove all items.

Parameters:

clear_data (bool, optional) – Flag to remove all items from the stored data dictionary as well.

plot_pydidas_dataset(data: Dataset, **kwargs: dict)#

Plot a pydidas dataset.

Parameters:
  • data (pydidas.core.Dataset) – The data to be plotted.

  • **kwargs (dict) – Additional keyword arguments to be passed to the silx plot method.

update_mpl_fonts()#

Update the plot’s fonts.

class pydidas.widgets.silx_plot.PydidasPlot2D(**kwargs: dict)#

Bases: Plot2D, PydidasQsettingsMixin

A customized silx.gui.plot.Plot2D with an additional features.

Additional features are implemented through additional SilxActions which are added to the toolbar.

addImage(data: Dataset | ndarray, **kwargs: dict)#

Add an image to the plot.

This method implements an additional dimensionality check before passing the image to the Plot2d.addImage method.

Parameters:
  • data (Union[Dataset, np.ndarray]) – The input data to be displayed.

  • **kwargs (dict) – Any supported Plot2d.addImage keyword arguments.

addNonUniformImage(data: Dataset, **kwargs: dict)#

Add a non-uniform image to the plot.

This method implements an additional dimensionality check before passing the image to the Plot2d.addImage method.

Parameters:
  • data (Dataset) – The input data to be displayed.

  • **kwargs (dict) – Any supported Plot2d.addImage keyword arguments.

clear_plot()#

Clear the plot and remove all items.

enable_cs_transform()#

Enable or disable the coordinate system transformations.

The CS transform is enabled if the image has the same shape as the detector configured in the DiffractionExperimentContext.

plot_pydidas_dataset(data: Dataset, **kwargs: dict)#

Plot a pydidas Dataset.

Parameters:
  • data (pydidas.core.Dataset) – The data to be plotted.

  • **kwargs (dict) – Additional keyword arguments to be passed to the silx plot method.

update_cs_units(x_unit: str, y_unit: str)#

Update the coordinate system units.

Note: Any changes to the CS transform will overwrite these settings.

Parameters:
  • x_unit (str) – The unit for the data x-axis.

  • y_unit (str) – The unit for the data y-axis

update_exp_setup_params()#

Check that the detector is valid for a CS transform.

update_mpl_fonts()#

Update the plot’s fonts.

user_config_update(key: str, value: str)#

Handle a user config update.

Parameters:
  • key (str) – The name of the updated key.

  • value – The new value of the updated key.

class pydidas.widgets.silx_plot.PydidasPlot2DwithIntegrationRegions(**kwargs: dict)#

Bases: PydidasPlot2D

An extended PydidasPlot2D which allows to show integration regions.

draw_circle(radius: float, legend: str, center: None | Tuple[float, float] = None)#

Draw a circle with the given radius and store it as the given legend.

Parameters:
  • radius (float) – The circle radius in pixels.

  • legend (str) – The shape’s legend for referencing it in the plot.

  • center (Union[None, Tuple[float, float]], optional) – The center of the circle. If None, this defaults to the DiffractionExperiment beamcenter. The default is None.

draw_integration_region(radial: None | Tuple[float, float], azimuthal: None | Tuple[float, float])#

Draw the given integration region.

Parameters:
  • radial (Union[None, Tuple[float, float]]) – The radial integration region. Use None for the full detector or a tuple with (r_inner, r_outer) in pixels to select a region.

  • azimuthal (Union[None, Tuple[float, float]]) – The azimuthal integration region. Use None for the full detector or a tuple with (azi_start, azi_end) in radians for a region.

draw_line_from_beamcenter(chi: float, legend: str)#

Draw a line from the beamcenter in the direction given by the angle chi.

Parameters:
  • chi (float) – The pointing angle, given in rad.

  • legend (str) – The reference legend entry for this line.

set_marker_color(color: str)#

Set the new marker color.

Parameters:

color (str) – The marker color name.

class pydidas.widgets.silx_plot.PydidasPlotStack(**kwargs: dict)#

Bases: QStackedWidget

A stack with two plots for 1d and 2d data which selects the correct to display.

Parameters:

**kwargs (dict) –

Supported keyword arguments are:

parentUnion[QtWidgets.QWidget, None]

The parent widget.

use_data_info_actionbool, optional

Flag to use the PydidasGetDataInfoAction to display information about a result datapoint. The default is False.

diffraction_expDiffractionExperiment, optional

The DiffractionExperiment instance to be used in the PydidasPlot2D for the coordinate system. The default is the generic DiffractionExperimentContext.

cs_transformbool, optional

Flag to enable coordinate system transformations.

clear_plots()#

Clear all plots.

plot_data(data: Dataset, **kwargs: dict)#

Plot the given data.

Parameters:
  • data (pydidas.core.Dataset) – The data to be plotted.

  • **kwargs (dict) – Any additional keywords to be passed to the plot.

class pydidas.widgets.silx_plot.SilxDataViewer(parent=None)#

Bases: DataViewerFrame

A subclass of the DataViewerFrame to use custom Pydidas 2d data view.