Spectrum¶
- class gdt.core.plot.spectrum.Spectrum(data=None, background=None, canvas=None, **kwargs)[source]¶
Bases:
GdtPlotClass for plotting count spectra and count spectra paraphernalia.
This class can plot differential count spectra using energy information, or can plot a count spectrum based on raw energy channel.
- Parameters:
data (
EnergyBins, optional) – The count spectrum data to plotbackground (
BackgroundSpectrum, optional) – The background spectrum to plot**kwargs – Options to pass to
GdtPlot
Attributes Summary
The matplotlib axes object for the plot
The count spectrum background plot element
The plotting canvas, if set upon initialization.
The error bars plot element
The matplotlib figure object
The count spectrum selection plot element
The count spectrum plot element
The plotting range of the x axis
The scale of the x axis, either 'linear' or 'log'.
The plotting range of the y axis.
The scale of the y axis, either 'linear' or 'log'.
Methods Summary
add_selection(data)Add a selection to the plot.
Remove the background from the plot.
Remove the count spectrum from the plot.
Remove the count spectrum errorbars from the plot.
Remove the selections from the plot.
set_background(background)Set the background plotting data.
set_data(data)Set the count spectrum plotting data.
Attributes Documentation
- ax¶
The matplotlib axes object for the plot
- Type:
(
matplotlib.axes)
- background¶
The count spectrum background plot element
- Type:
- canvas¶
The plotting canvas, if set upon initialization.
- Type:
(Canvas Backend object)
- errorbars¶
The error bars plot element
- Type:
- fig¶
The matplotlib figure object
- Type:
(
matplotlib.figure)
- selections¶
The count spectrum selection plot element
- Type:
(list of
HistoFilled)
- xlim¶
The plotting range of the x axis
- Type:
(float, float)
- xscale¶
The scale of the x axis, either ‘linear’ or ‘log’.
- Type:
(str)
- ylim¶
The plotting range of the y axis.
- Type:
(float, float)
- yscale¶
The scale of the y axis, either ‘linear’ or ‘log’.
- Type:
(str)
Methods Documentation
- add_selection(data)[source]¶
Add a selection to the plot. This adds a new selection to a list of existing selections.
- Parameters:
data (
EnergyBins) – The count spectrum data selections to plot
- set_background(background)[source]¶
Set the background plotting data. If a background already exists, this triggers a replot of the background.
- Parameters:
background (
BackgroundSpectrum) – The background spectrum to plot
- set_data(data)[source]¶
Set the count spectrum plotting data. If a count spectrum already exists, this triggers a replot of the count spectrum.
If an EnergyBins object is used, this will plot a differential energy spectrum (count/s/keV), and if a ChannelBins object is used (i.e. no energy information), the count spectrum per channel is plotted.
:param data (
EnergyBinsor:ChannelBins): The data