Plot¶
- class listmode.plot.Axis(axis_info, det_cfg, time_slice=None)[source]¶
Axis info is a class handling a single data axis in a plot. Axis takes care of binning, calibration, tick spacing and labeling of the plot. For this to happen, Axis needs not only axis configuration but also detector configuration to know about the data it is showing.
Axis is not meant to be used directly. It is a part of Plot.
- class listmode.plot.Filter1d(axes)[source]¶
Filter collects the histogram. It defines its range by the axes.
- class listmode.plot.Filter2d(axes)[source]¶
In 2d-filter the __init__ and _build are overridden to handle two axes.
- class listmode.plot.Gate(gate_info, det_cfg, cal, bitmask=False)[source]¶
Gate is a simple class defining a single filter for data streamed through it’s update method. It is defined by gate_info dictionary with following keys: “channel”: The channel the gate is for. “dtype”: The data type the gate is for. “range”: A list of ranges defining where the gate is passing through (if null or coincident) or blocking (if
anticoincident). Each range is a list of start and stop values in calibrated units.
- “coinc”: Defines coincidence (positive integer), anticoincidence (negative integer) or null coincidence. A null
gate will still limit the plot axis and is thus implicitly handled as coincident if it is defined for one of the plot axes.
- class listmode.plot.Plot(canvas_cfg, det_cfg, time_slice=None, plot_idx=0)[source]¶
Plot is a manager class for handling a histogram to plot. A plot itself is a combination of its axes and its filter. Axes objects are responsible for the calibration, limits and unit labels of the plot. A plot is filled by feeding it with data chunks via its update-method. Filter is the actual histogramming function collecting output of each chunk. Plot class can return the data and axes information as numpy array via get_data-method and title, legend and axis label strings via its get_plot_labels-method.
Plot configuration dictionary defines the data in the plot as well as the plotting parameters, such as labels, scales etc. The Plot class uses only the information in plot_cfg list and the name of the config. Only one plot can be defined per Plot object. However multiple plots can be stacked into the plot_cfg list of the plot configuration. If all of the plots are 1d and have same axes they can be plotted into a single figure.
Creating figures and handling how to stack plots into figures is done explicitly by the user. Two Plot instances can be compared for equality to help with stacking. The comparison returns True only if the two plots can be shown in the same axes.
- get_data(calibrate=True)[source]¶
Returns the histogram as numpy array along with bins for each axis and text for legend/export filename.
- Parameters
calibrate – Return calibrated bins
- Returns