display — Display facilities#
Module documentation#
Display facilities.
- class hexsample.display.HexagonCollection(x, y, radius: float, orientation: float = 0.0, **kwargs)[source]#
Collection of native matplotlib hexagon patches.
Arguments#
- xarray_like
The x coordinates of the hexagon centers.
- yarray_like
The y coordinates of the hexagon centers.
- radiusfloat
The distance from the center to each of the hexagon vertices.
- orientation: float
The hexagon orientation in radians—zero means pointy topped.
- set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, hatch_linewidth=<UNSET>, hatchcolor=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<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: array-like or float or None animated: bool antialiased or aa or antialiaseds: bool or list of bools array: array-like or None capstyle: .CapStyle or {‘butt’, ‘projecting’, ‘round’} clim: (vmin: float, vmax: float) clip_box: ~matplotlib.transforms.BboxBase or None clip_on: bool clip_path: Patch or (Path, Transform) or None cmap: .Colormap or str or None color: :mpltype:`color` or list of RGBA tuples edgecolor or ec or edgecolors: :mpltype:`color` or list of :mpltype:`color` or ‘face’ facecolor or facecolors or fc: :mpltype:`color` or list of :mpltype:`color` figure: ~matplotlib.figure.Figure or ~matplotlib.figure.SubFigure gid: str hatch: {‘/’, ‘\’, ‘|’, ‘-’, ‘+’, ‘x’, ‘o’, ‘O’, ‘.’, ‘*’} hatch_linewidth: unknown hatchcolor: :mpltype:`color` or list of :mpltype:`color` or ‘edge’ in_layout: bool joinstyle: .JoinStyle or {‘miter’, ‘round’, ‘bevel’} label: object linestyle or dashes or linestyles or ls: {‘-’, ‘–’, ‘-.’, ‘:’, ‘’, …} or (offset, on-off-seq) or list thereof linewidth or linewidths or lw: float or list of floats mouseover: bool norm: .Normalize or str or None offset_transform or transOffset: .Transform offsets: (N, 2) or (2,) array-like path_effects: list of .AbstractPathEffect paths: unknown picker: None or bool or float or callable pickradius: float rasterized: bool sketch_params: (scale: float, length: float, randomness: float) snap: bool or None transform: ~matplotlib.transforms.Transform url: str urls: list of str or None visible: bool zorder: float
- class hexsample.display.HexagonalGridDisplay(grid: HexagonalGrid, zero_sup_threshold: float = 0.0, **kwargs)[source]#
Display for an HexagonalGrid object.
- draw(offset: Tuple[float, float] = (0.0, 0.0), pixel_labels: bool = False, **kwargs) HexagonCollection[source]#
Draw the full grid display.
- draw_roi(roi: RegionOfInterest, offset: Tuple[float, float] = (0.0, 0.0), indices: bool = True, padding: bool = True, **kwargs) HexagonCollection[source]#
Draw a given ROI.
- draw_digi_event_rectangular(event: DigiEventRectangular, offset: Tuple[float, float] = (0.0, 0.0), indices: bool = True, padding: bool = True, zero_sup_threshold: float = 0.0, values: bool = True, **kwargs) HexagonCollection[source]#
Draw an actual event int the parent hexagonal grid.
This is taking over where the draw_roi() hook left, and adding the event part.
- draw_digi_event_circular(event: DigiEventCircular, offset: Tuple[float, float] = (0.0, 0.0), zero_sup_threshold: float = 0.0, values: bool = True, **kwargs) HexagonCollection[source]#
Display a digi event with circular readout.
- draw_digi_event(event: DigiEventBase, zero_sup_threshold: int) HexagonCollection[source]#
Draw a digi event.
This is just dispatching the call to the proper method depending on the event type.
- draw_positions(mc_event: MonteCarloEvent, digi_event: DigiEventBase, readout: HexagonalReadoutBase, zero_sup_threshold: int) None[source]#
Draw the Monte Carlo truth position and the reconstructed positions on top of the digi event.
- class hexsample.display.EventDisplay(input_file: DigiInputFileBase, grid: HexagonalGrid, **kwargs)[source]#
Class to display events from a Digi input file.
If the keyword argument recon_pars is provided, the display will also show the reconstructed positions and the Monte Carlo truth position (if available) on top of the digi event.
Arguments#
- input_file: DigiInputFileBase
The input file to read the events from.
- grid: HexagonalGrid
The grid to use for the display.
- setup_gca()[source]#
Setup the current axes object to make the display work. Includes a modified axes adding a text box for event ID input.
- current_zero_sup_threshold() int[source]#
Convenience method to get the current zero suppression threshold.
- _draw(event: DigiEventBase) None[source]#
Complete draw method for an event.
This is a private hook that is called by the event navigation methods (next, prev, pick_event) to redraw the underlying digi event, as well as the relevant reconstructed quantities.
- next(_) DigiEventBase[source]#
Convenience method to get the next event from the input file.
- prev(_) DigiEventBase[source]#
Convenience method to get the previous event from the input file.
- pick_event(_) DigiEventBase[source]#
Convenience method to get a specific event from the input file.
- update_zero_sup(_) DigiEventBase[source]#
Convenience method to update the zero suppression threshold and re-plot the event.