analysis — Analysis facilities#
Module documentation#
Analysis facilities.
- hexsample.analysis.create_histogram(input_file: InputFileBase, column_name: str, mc: bool = False, binning: ndarray = None, mask: ndarray = None) Histogram1d[source]#
Create a histogram from the values in the given column of the input file.
This takes either a digi or a recon file as an input and create a one-dimensional histogram of the values in a given column.
Arguments#
- input_fileDigiInputFile
The input (digi or recon) file.
- column_namestr
The name of the column to be histogrammed.
- mcbool
If True, histogram a quanity in the MonteCarlo extension of the file. Note this must be specified by the user, as the Recon and MonteCarlo tables share some of the column names, so that one needs to actively pick one or the other.
- binningarray_like or int, optional
This is following the matplotlib convention, where if
binningis an integer, it defines the number of equal-width bins in the range, while if it is a sequence, it defines the bin edges, including the left edge of the first bin and the right edge of the last bin.- maskarray_like, optional
An optional mask on the input values. The length of the mask must match that of the values in the input column.
- hexsample.analysis.double_heatmap(column_vals: array, row_vals: array, heatmap_values1: array, heatmap_values2: array)[source]#
Creates a figure containing two different heatmaps (with the same size) constructed row by row.
Even rows (counting from 0) are the rows of the heatmap1 heatmap, odd rows are the rows of the heatmap2 heatmap. heatmap_values1 and heatmap_values2 must have the same size and share the same axes. The resulting figure will have the following dimensions: 2*len(row_vals) x len(column_vals).
Arguments#
- column_valsnp.array
Values relative to the columns of the heatmaps.
- row_valsnp.array
Values relative to the row of the heatmaps.
- heatmap_values1np.array
A flatten array containing the values of every cell of the first heatmap.
- heatmap_values1np.array
A flatten array containing the values of every cell of the second heatmap.
Return#
- figmatplotlib.figure.Figure
Figure contaning the heatmap.
- axmatplotlib.axes._axes.Axes
Axes of fig.
- hexsample.analysis.heatmap_with_labels(column_vals: array, row_vals: array, heatmap_values: array)[source]#
Creates a figure containing an heatmap having in every cell printed the value of the cell itself.
Arguments#
- column_valsnp.array
Values relative to the columns of the heatmaps.
- row_valsnp.array
Values relative to the row of the heatmaps.
- heatmap_valuesnp.array
Values of the heatmap
Return#
- figmatplotlib.figure.Figure
Figure contaning the heatmap.
- axmatplotlib.axes._axes.Axes
Axes of fig.