ModelFit¶
- class gdt.core.plot.model.ModelFit(fitter=None, canvas=None, view='counts', resid=True, interactive=True)[source]¶
Bases:
GdtPlotClass for plotting spectral fits.
- Parameters:
fitter (
SpectralFitter, optional) – The spectral fitterview (str, optional) – The plot view, one of ‘counts’, ‘photon’, ‘energy’ or ‘nufnu’. Default is ‘counts’
resid (bool, optional) – If True, plots the residuals in counts view. Default is True.
**kwargs – Options to pass to
GdtPlot
Attributes Summary
The matplotlib axes object for the plot
The plotting canvas, if set upon initialization.
A list of default plotting colors to cycle through
(
PlotElementCollectionofModelData): The count data plot elements(
PlotElementCollectionofHisto): The count model plot elementsThe matplotlib figure object
(
PlotElementCollectionofModelData): The fit residual plot elements(
PlotElementCollectionofModelSamples): The model spectrum sample elementsThe current plot view
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
Plot the count spectrum fit.
energy_spectrum(**kwargs)Plot the energy spectrum model.
Hide the fit residuals.
nufnu_spectrum(**kwargs)Plot the nuFnu spectrum model.
photon_spectrum(**kwargs)Plot the photon spectrum model.
set_fit(fitter[, resid])Set the fitter.
show_residuals([sigma])Show the fit residuals.
Attributes Documentation
- ax¶
The matplotlib axes object for the plot
- Type:
(
matplotlib.axes)
- canvas¶
The plotting canvas, if set upon initialization.
- Type:
(Canvas Backend object)
- colors = ['#7F3C8D', '#11A579', '#3969AC', '#F2B701', '#E73F74', '#80BA5A', '#E68310', '#008695', '#CF1C90', '#f97b72', '#4b4b8f', '#A5AA99']¶
A list of default plotting colors to cycle through
- Type:
(list)
- count_data¶
(
PlotElementCollectionofModelData): The count data plot elements
- count_models¶
(
PlotElementCollectionofHisto): The count model plot elements
- fig¶
The matplotlib figure object
- Type:
(
matplotlib.figure)
- residuals¶
(
PlotElementCollectionofModelData): The fit residual plot elements
- spectrum_model¶
(
PlotElementCollectionofModelSamples): The model spectrum sample elements
- view¶
The current plot view
- Type:
(str)
- 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
- energy_spectrum(**kwargs)[source]¶
Plot the energy spectrum model.
- Parameters:
num_samples (int, optional) – The number of sample spectra. Default is 100.
plot_components (bool, optional) – Set to False to only plot the overall model, not each component. Default is False.
- nufnu_spectrum(**kwargs)[source]¶
Plot the nuFnu spectrum model.
- Parameters:
num_samples (int, optional) – The number of sample spectra. Default is 100.
plot_components (bool, optional) – Set to False to only plot the overall model, not each component. Default is False.
- photon_spectrum(**kwargs)[source]¶
Plot the photon spectrum model.
- Parameters:
num_samples (int, optional) – The number of sample spectra. Default is 10.
plot_components (bool, optional) – Set to False to only plot the overall model, not each component. Default is False.