pixie16.plot module¶
- pixie16.plot.CFD(events: Iterable[Event], setting: Settings, w: float = 0.3125, N: int | None = None, randomize: bool = False, persistent: bool = False, title: str | None = None, ax: matplotlib.axes.Axes | None = None, pdf: matplotlib.backends.backend_pdf.PdfPages | None = None, plot_options: str | None = None) None ¶
Plot CFD and FastFilter several traces
- Parameters:
events – List of events (perhaps already filtered) from read.read_list_mode_data() Need to be from a single channel.
setting – A read.Settings object
w – The w used for the CFD calculation
N – Number of traces to plot, if None all traces will be plotted.
randomize – if True and N is smaller than the total amount of traces, randomly pick traces
persistent – Use datashader-like plot of traces
title – Title to add to plot
ax – a matplotlib axes to plot on. If None, we create a new figure and show it at the end.
pdf – if present, we save the plot in the pdf
plot_options – only plot some type of traces. Example: “CFD,trace,FF” will plot all 3
- pixie16.plot.MCA(data: numpy.ndarray, ax: matplotlib.axes.Axes | None = None, rebin: int = 1, title: str | None = None, label: str | None = None, pdf: matplotlib.backends.backend_pdf.PdfPages | None = None, log: bool = False) None ¶
Plot MCA spectra
If pdf is given, it will save the figure inside the pdf (to be used with PdfPages) for multi page pdfs.
- Parameters:
data – Data from ReadHistogramFromModule
ax – The axis to plot on, if None, we create a new figure and axis
rebin – Rebin the data by summing over this amount of bins
title – Add this title to the plot
pdf – if present, we save the plot in the pdf
log – plot y-axis in log scale
- pixie16.plot.advindexing_roll(A: numpy.ndarray, r: numpy.ndarray) numpy.ndarray ¶
Shift trace matrix A by r indices.
Traces and r must be > 1D numpy arrays
- pixie16.plot.create_persistent_plot(traces: numpy.ndarray, x_range: Sequence[float] | None = None, ax: matplotlib.axes.Axes | None = None) None ¶
Create persistence plot
- Parameters:
traces – 2D numpy array (N, M) where N is the number of traces and M the length of the traces
x_range – desired range of time axis. If None, it goes from 0 to 2*M in ns
ax – a matplotlib axes to plot on. If None, we create a new figure and show it at the end. Otherwise this needs to be an array of matplotlib axis objects: one axis for each channel present in events.
- pixie16.plot.create_title_page(title: str | list[str], pdf: matplotlib.backends.backend_pdf.PdfPages | None = None) None ¶
Helper function to create a title page
The function will create a title centered in a plot. If pdf is given, it will save the figure inside the pdf (to be used with PdfPages) for multi page pdfs.
- Parameters:
title – The title, if a list of str, then each will be put on a single line
pdf – The pdf where the title page should be added to.
- pixie16.plot.energy_sums(events: Iterable[Event], setting: Settings, stats: Stats, N: int | None = None, randomize: bool = False, persistent: bool = True, title: str | None = None, ax: matplotlib.axes.Axes | None = None, pdf: matplotlib.backends.backend_pdf.PdfPages | None = None) None ¶
Plots traces aligned to position of the energy sums.
Plots vertical lines at the position of the energy sums only if all events are from a single channel.
- Parameters:
events – List of events (perhaps already filtered) from read.read_list_mode_data()
setting – A read.Settings object
N – Number of traces to plot, if None all traces will be plotted.
randomize – if True and N is smaller than the total amount of traces, randomly pick traces
persistent – Use datashader-like plot of traces
title – Title to add to plot
ax – a matplotlib axes to plot on. If None, we create a new figure and show it at the end.
pdf – if present, we save the plot in the pdf
- pixie16.plot.filter_events(events: Iterable[Event], N: int | None = None, randomize: bool = False) Iterable[Event] ¶
Pick N (random) events from a list of events
- pixie16.plot.find_sums(traces: numpy.ndarray, SlowLength: Iterable[int], SlowGap: Iterable[int], trailsum: Iterable[int], gapsum: Iterable[int], leadsum: Iterable[int]) tuple[numpy.ndarray, numpy.ndarray] ¶
Find the location of the 3 reported sums in a trace that are used to calculate the energy.
For this to work, bit 12 of register A (CaptureSums) needs to be set for the channel.
- Parameters:
traces – 2D numpy array (N, M) where N is the number of traces and M the length of the traces.
SlowLength – List of the length of the Ls for each trace in traces.
SlowGap – List of the length of the Gs for each trace in traces.
trailsum – Array/List of N values that contains the values of the first reported sum, which contains L values.
gapsum – Array/List of N values that contains the values of the second reported sum, which contains G values.
leadsum – Array/List of N values that contains the values of the third reported sum, which contains L values.
- Returns:
sumIDX – numpy array of position of the start of the first sumIDX
Esums – numpy array of the three sums