Visualizations/Diagnostics¶
Diagnostic plots for an x-ray imager position response.
- class x_ray_imager_bagriff.response_interpolation.plot.GenericResponseDiagnostic¶
Generic class to plot position response for an x-ray imager.
It’s assumed that the imager only has four detectors and they are positioned:
+y
(2) | (1) —-+—- +x (3) | (0)
- __init__(*args, rc_params=None, **kwargs)¶
- Parameters:
figsize ((float, float) or (float, float, str), default:
rcParams[“figure.figsize”](default:[6.4, 4.8])) –The figure dimensions. This can be
a tuple
(width, height, unit), where unit is one of “in” (inch), “cm” (centimenter), “px” (pixel).a tuple
(width, height), which is interpreted in inches, i.e. as(width, height, "in").
One of width or height may be
None; the respective value is taken fromrcParams[“figure.figsize”](default:[6.4, 4.8]).dpi (float, default:
rcParams[“figure.dpi”](default:100.0)) – Dots per inch.facecolor (default:
rcParams[“figure.facecolor”](default:'white')) – The figure patch facecolor.edgecolor (default:
rcParams[“figure.edgecolor”](default:'white')) – The figure patch edge color.linewidth (float) – The linewidth of the frame (i.e. the edge linewidth of the figure patch).
frameon (bool, default:
rcParams[“figure.frameon”](default:True)) – IfFalse, suppress drawing the figure background patch.subplotpars (~matplotlib.gridspec.SubplotParams) – Subplot parameters. If not given, the default subplot parameters
rcParams[“figure.subplot.*”]are used.tight_layout (bool or dict, default:
rcParams[“figure.autolayout”](default:False)) –Whether to use the tight layout mechanism. See .set_tight_layout.
Discouraged
The use of this parameter is discouraged. Please use
layout='tight'instead for the common case oftight_layout=Trueand use .set_tight_layout otherwise.constrained_layout (bool, default:
rcParams[“figure.constrained_layout.use”](default:False)) –This is equal to
layout='constrained'.Discouraged
The use of this parameter is discouraged. Please use
layout='constrained'instead.layout ({‘constrained’, ‘compressed’, ‘tight’, ‘none’, .LayoutEngine, None}, default: None) –
The layout mechanism for positioning of plot elements to avoid overlapping Axes decorations (labels, ticks, etc). Note that layout managers can have significant performance penalties.
’constrained’: The constrained layout solver adjusts Axes sizes to avoid overlapping Axes decorations. Can handle complex plot layouts and colorbars, and is thus recommended.
See Constrained layout guide for examples.
’compressed’: uses the same algorithm as ‘constrained’, but removes extra space between fixed-aspect-ratio Axes. Best for simple grids of Axes.
’tight’: Use the tight layout mechanism. This is a relatively simple algorithm that adjusts the subplot parameters so that decorations do not overlap.
See Tight layout guide for examples.
’none’: Do not use a layout engine.
A .LayoutEngine instance. Builtin layout classes are .ConstrainedLayoutEngine and .TightLayoutEngine, more easily accessible by ‘constrained’ and ‘tight’. Passing an instance allows third parties to provide their own layout engine.
If not given, fall back to using the parameters tight_layout and constrained_layout, including their config defaults
rcParams[“figure.autolayout”](default:False) andrcParams[“figure.constrained_layout.use”](default:False).**kwargs (.Figure properties, optional) – Properties: agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: float or None animated: bool canvas: FigureCanvas clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None constrained_layout: unknown constrained_layout_pads: unknown dpi: float edgecolor: color facecolor: color figheight: float figure: unknown figwidth: float frameon: bool gid: str in_layout: bool label: object layout_engine: {‘constrained’, ‘compressed’, ‘tight’, ‘none’, .LayoutEngine, None} linewidth: number mouseover: bool path_effects: list of .AbstractPathEffect picker: None or bool or float or callable rasterized: bool size_inches: (float, float) or float sketch_params: (scale: float, length: float, randomness: float) snap: bool or None tight_layout: unknown transform: ~matplotlib.transforms.Transform url: str visible: bool zorder: float
rc_params (dict | None)
- Return type:
None
- plot_diagnostic(X, position)¶
Create axes to plot all four detectors.
Specific implementation of what to plot on each axis is handled by the _diagnostic function.
- Parameters:
X (NDArray[float64]) – Array containing the imager response to plot. Shape should be (n_x_points, n_y_points, n_detectors=4).
position (NDArray[float64]) – Array of positions where X is sampled. Shape should be (2, n_x_points, n_y_points).
- Raises:
ValueError – If X and position have mismatched shapes.
- Return type:
None
- set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, canvas=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, constrained_layout=<UNSET>, constrained_layout_pads=<UNSET>, dpi=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, figheight=<UNSET>, figwidth=<UNSET>, frameon=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, layout_engine=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, size_inches=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, tight_layout=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)¶
Set multiple properties at once.
a.set(a=A, b=B, c=C)
is equivalent to
a.set_a(A) a.set_b(B) a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2)is equivalent toset(linewidth=2), but it is an error to pass both simultaneously.The order of the individual setter calls matches the order of parameters in
set(). However, most properties do not depend on each other so that order is rarely relevant.Supported properties are
- Properties:
agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: float or None animated: bool canvas: FigureCanvas clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None constrained_layout: unknown constrained_layout_pads: unknown dpi: float edgecolor: color facecolor: color figheight: float figure: unknown figwidth: float frameon: bool gid: str in_layout: bool label: object layout_engine: {‘constrained’, ‘compressed’, ‘tight’, ‘none’, .LayoutEngine, None} linewidth: number mouseover: bool path_effects: list of .AbstractPathEffect picker: None or bool or float or callable rasterized: bool size_inches: (float, float) or float sketch_params: (scale: float, length: float, randomness: float) snap: bool or None tight_layout: unknown transform: ~matplotlib.transforms.Transform url: str visible: bool zorder: float
- class x_ray_imager_bagriff.response_interpolation.plot.GridWireframeDiagnostic¶
Wireframe 3D plot of position response for an x-ray imager.
- plot_diagnostic(X, position)¶
Create axes to plot all four detectors.
- Parameters:
X (NDArray[float64]) – Array containing the imager response to plot. Shape should be (n_detectors=4, n_x_points, n_y_points).
position (NDArray[float64]) – Array of positions where X is sampled. Shape should be (2, n_x_points, n_y_points).
- Return type:
None
- set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, canvas=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, constrained_layout=<UNSET>, constrained_layout_pads=<UNSET>, dpi=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, figheight=<UNSET>, figwidth=<UNSET>, frameon=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, layout_engine=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, size_inches=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, tight_layout=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)¶
Set multiple properties at once.
a.set(a=A, b=B, c=C)
is equivalent to
a.set_a(A) a.set_b(B) a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2)is equivalent toset(linewidth=2), but it is an error to pass both simultaneously.The order of the individual setter calls matches the order of parameters in
set(). However, most properties do not depend on each other so that order is rarely relevant.Supported properties are
- Properties:
agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: float or None animated: bool canvas: FigureCanvas clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None constrained_layout: unknown constrained_layout_pads: unknown dpi: float edgecolor: color facecolor: color figheight: float figure: unknown figwidth: float frameon: bool gid: str in_layout: bool label: object layout_engine: {‘constrained’, ‘compressed’, ‘tight’, ‘none’, .LayoutEngine, None} linewidth: number mouseover: bool path_effects: list of .AbstractPathEffect picker: None or bool or float or callable rasterized: bool size_inches: (float, float) or float sketch_params: (scale: float, length: float, randomness: float) snap: bool or None tight_layout: unknown transform: ~matplotlib.transforms.Transform url: str visible: bool zorder: float
- class x_ray_imager_bagriff.response_interpolation.plot.ColorMeshDiagnostic¶
Color mesh plot of position response for an x-ray imager.
- __init__(*args, rc_params=None, **kwargs)¶
- Parameters:
figsize ((float, float) or (float, float, str), default:
rcParams[“figure.figsize”](default:[6.4, 4.8])) –The figure dimensions. This can be
a tuple
(width, height, unit), where unit is one of “in” (inch), “cm” (centimenter), “px” (pixel).a tuple
(width, height), which is interpreted in inches, i.e. as(width, height, "in").
One of width or height may be
None; the respective value is taken fromrcParams[“figure.figsize”](default:[6.4, 4.8]).dpi (float, default:
rcParams[“figure.dpi”](default:100.0)) – Dots per inch.facecolor (default:
rcParams[“figure.facecolor”](default:'white')) – The figure patch facecolor.edgecolor (default:
rcParams[“figure.edgecolor”](default:'white')) – The figure patch edge color.linewidth (float) – The linewidth of the frame (i.e. the edge linewidth of the figure patch).
frameon (bool, default:
rcParams[“figure.frameon”](default:True)) – IfFalse, suppress drawing the figure background patch.subplotpars (~matplotlib.gridspec.SubplotParams) – Subplot parameters. If not given, the default subplot parameters
rcParams[“figure.subplot.*”]are used.tight_layout (bool or dict, default:
rcParams[“figure.autolayout”](default:False)) –Whether to use the tight layout mechanism. See .set_tight_layout.
Discouraged
The use of this parameter is discouraged. Please use
layout='tight'instead for the common case oftight_layout=Trueand use .set_tight_layout otherwise.constrained_layout (bool, default:
rcParams[“figure.constrained_layout.use”](default:False)) –This is equal to
layout='constrained'.Discouraged
The use of this parameter is discouraged. Please use
layout='constrained'instead.layout ({‘constrained’, ‘compressed’, ‘tight’, ‘none’, .LayoutEngine, None}, default: None) –
The layout mechanism for positioning of plot elements to avoid overlapping Axes decorations (labels, ticks, etc). Note that layout managers can have significant performance penalties.
’constrained’: The constrained layout solver adjusts Axes sizes to avoid overlapping Axes decorations. Can handle complex plot layouts and colorbars, and is thus recommended.
See Constrained layout guide for examples.
’compressed’: uses the same algorithm as ‘constrained’, but removes extra space between fixed-aspect-ratio Axes. Best for simple grids of Axes.
’tight’: Use the tight layout mechanism. This is a relatively simple algorithm that adjusts the subplot parameters so that decorations do not overlap.
See Tight layout guide for examples.
’none’: Do not use a layout engine.
A .LayoutEngine instance. Builtin layout classes are .ConstrainedLayoutEngine and .TightLayoutEngine, more easily accessible by ‘constrained’ and ‘tight’. Passing an instance allows third parties to provide their own layout engine.
If not given, fall back to using the parameters tight_layout and constrained_layout, including their config defaults
rcParams[“figure.autolayout”](default:False) andrcParams[“figure.constrained_layout.use”](default:False).**kwargs (.Figure properties, optional) – Properties: agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: float or None animated: bool canvas: FigureCanvas clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None constrained_layout: unknown constrained_layout_pads: unknown dpi: float edgecolor: color facecolor: color figheight: float figure: unknown figwidth: float frameon: bool gid: str in_layout: bool label: object layout_engine: {‘constrained’, ‘compressed’, ‘tight’, ‘none’, .LayoutEngine, None} linewidth: number mouseover: bool path_effects: list of .AbstractPathEffect picker: None or bool or float or callable rasterized: bool size_inches: (float, float) or float sketch_params: (scale: float, length: float, randomness: float) snap: bool or None tight_layout: unknown transform: ~matplotlib.transforms.Transform url: str visible: bool zorder: float
rc_params (dict | None)
- Return type:
None
- plot_diagnostic(X, position)¶
Create axes to plot all four detectors plus a colorbar.
- Parameters:
X (NDArray[float64]) – Array containing the imager response to plot. Shape should be (n_detectors=4, n_x_points, n_y_points).
position (NDArray[float64]) – Array of positions where X is sampled. Shape should be (2, n_x_points, n_y_points).
- Return type:
None
- set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, canvas=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, constrained_layout=<UNSET>, constrained_layout_pads=<UNSET>, dpi=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, figheight=<UNSET>, figwidth=<UNSET>, frameon=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, layout_engine=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, size_inches=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, tight_layout=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)¶
Set multiple properties at once.
a.set(a=A, b=B, c=C)
is equivalent to
a.set_a(A) a.set_b(B) a.set_c(C)
In addition to the full property names, aliases are also supported, e.g.
set(lw=2)is equivalent toset(linewidth=2), but it is an error to pass both simultaneously.The order of the individual setter calls matches the order of parameters in
set(). However, most properties do not depend on each other so that order is rarely relevant.Supported properties are
- Properties:
agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: float or None animated: bool canvas: FigureCanvas clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None constrained_layout: unknown constrained_layout_pads: unknown dpi: float edgecolor: color facecolor: color figheight: float figure: unknown figwidth: float frameon: bool gid: str in_layout: bool label: object layout_engine: {‘constrained’, ‘compressed’, ‘tight’, ‘none’, .LayoutEngine, None} linewidth: number mouseover: bool path_effects: list of .AbstractPathEffect picker: None or bool or float or callable rasterized: bool size_inches: (float, float) or float sketch_params: (scale: float, length: float, randomness: float) snap: bool or None tight_layout: unknown transform: ~matplotlib.transforms.Transform url: str visible: bool zorder: float