Plotting Module

The classes and methods in gbm.plot are for plotting and visualizing the GBM science and auxiliary data.

Base Classes

These base classes define specialized plot element and a collection of various plot elements (forming a plot), respectively.

GbmPlotElement

class gbm.plot.gbmplot.GbmPlotElement(color=None, alpha=None)[source]

Bases: object

A base class representing a plot element. A plot element can be a complex collection of more primitive matplotlib plot elements, but are treated as a single element.

Note

This class is not intended to be instantiated directly by the user, rather it is inherited by child plot element objects.

Parameters
  • alpha (float) – The alpha opacity value, between 0 and 1.

  • color (str) – The color of the plot element

Attributes
  • alpha (float) – The alpha opacity value, between 0 and 1.

  • color (str) – The color of the plot element.

    Note

    Inherited classes may have sub-elements that can have different colors (and alphas). For those classes, refer to their specifications as to the definition of color.

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()[source]

Hide the plot element

remove()[source]

Remove the plot element

show()[source]

Show the plot element

toggle()[source]

Toggle the visibility of the plot element


GbmPlot

class gbm.plot.gbmplot.GbmPlot(figsize=None, dpi=100, canvas=None, interactive=True, axis=None, **kwargs)[source]

Bases: object

Base for plots of GBM data.

Note

This class is not intended to be instantiated directly by the user, rather it is inherited by different plot classes.

Parameters
  • figsize ((float, float), optional) – The figure size (width, height)

  • dpi (int, optional) – The resolution of the plot. Default is 100

  • canvas (Canvas Backend object, optional) – If interfacing with a backend (e.g. Tk), pass the relavant Canvas Backend object and the master widget window. If not set, uses the default the matplotlib backend.

  • interactive (bool, optional) – If True, then enables interactive plotting (python environment is available while plot is displayed). Default is True. This is overriden if canvas is set.

  • axis (matplotlib.axes, optional) – An existing axes object to plot to. If not set, will create a new axes object.

  • **kwargs – Additional options for Figure.add_subplot.

Attributes
  • ax (matplotlib.axes) – The matplotlib axes object for the plot

  • canvas (Canvas Backend object) – The plotting canvas, if set upon initialization.

  • fig (matplotlib.figure) – The matplotlib figure object

  • xlim (float, float) – The plotting range of the x axis. This attribute can be set.

  • xscale (str) – The scale of the x axis, either ‘linear’ or ‘log’. This attribute can be set.

  • ylim (float, float) – The plotting range of the y axis. This attribute can be set.

  • yscale (str) – The scale of the y axis, either ‘linear’ or ‘log’. This attribute can be set.


GBM Plot Classes

These classes inherit from GbmPlot and represent standard visualizations of GBM science data and auxiliary data.

Lightcurve

class gbm.plot.Lightcurve(data=None, background=None, canvas=None, axis=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlot

Class for plotting lightcurves and lightcurve paraphernalia.

Parameters
  • data (TimeBins, optional) – The lightcurve data to plot

  • background (BackgroundRates, optional) – The background rates to plot

  • **kwargs – Options to pass to GbmPlot

Attributes
  • ax (matplotlib.axes) – The matplotlib axes object for the plot

  • background (LightcurveBackground) – The background plot element

  • canvas (Canvas Backend object) – The plotting canvas, if set upon initialization.

  • errorbars (HistoErrorbars) – The error bars plot element

  • fig (matplotlib.figure) – The matplotlib figure object

  • lightcurve (Histo) – The lightcurve plot element

  • selections (list of HistoFilled) – The list of selection plot elements

  • xlim (float, float) – The plotting range of the x axis. This attribute can be set.

  • xscale (str) – The scale of the x axis, either ‘linear’ or ‘log’. This attribute can be set.

  • ylim (float, float) – The plotting range of the y axis. This attribute can be set.

  • yscale (str) – The scale of the y axis, either ‘linear’ or ‘log’. This attribute can be set.

add_selection(data)[source]

Add a selection to the plot. This adds a new selection to a list of existing selections.

Parameters

data (TimeBins) – The lightcurve data selection to plot

remove_background()[source]

Remove the background from the plot.

remove_data()[source]

Remove the lightcurve from the plot.

remove_errorbars()[source]

Remove the lightcurve error bars from the plot.

remove_selections()[source]

Remove the selections from the plot.

set_background(background)[source]

Set the background plotting data. If a background already exists, this triggers a replot of the background.

Parameters

background (BackgroundRates) – The background model to plot

set_data(data)[source]

Set the lightcurve plotting data. If a lightcurve already exists, this triggers a replot of the lightcurve.

Parameters

data (TimeBins) – The lightcurve data to plot


Spectrum

class gbm.plot.Spectrum(data=None, background=None, canvas=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlot

Class for plotting count spectra and count spectra paraphernalia.

Parameters
  • data (EnergyBins, optional) – The count spectrum data to plot

  • background (BackgroundSpectrum, optional) – The background spectrum to plot

  • **kwargs – Options to pass to GbmPlot

Attributes
  • ax (matplotlib.axes) – The matplotlib axes object for the plot

  • background (SpectrumBackground) – The count spectrum background plot element

  • canvas (Canvas Backend object) – The plotting canvas, if set upon initialization.

  • errorbars (HistoErrorbars) – The error bars plot element

  • fig (matplotlib.figure) – The matplotlib figure object

  • selections (HistoFilled) – The count spectrum selection plot element

  • spectrum (Histo) – The count spectrum plot element

  • xlim (float, float) – The plotting range of the x axis. This attribute can be set.

  • xscale (str) – The scale of the x axis, either ‘linear’ or ‘log’. This attribute can be set.

  • ylim (float, float) – The plotting range of the y axis. This attribute can be set.

  • yscale (str) – The scale of the y axis, either ‘linear’ or ‘log’. This attribute can be set.

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

remove_background()[source]

Remove the background from the plot.

remove_data()[source]

Remove the count spectrum from the plot.

remove_errorbars()[source]

Remove the count spectrum errorbars from the plot.

remove_selections()[source]

Remove the selections from the 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.

Parameters

data (EnergyBins) – The count spectrum data to plot


ModelFit

class gbm.plot.ModelFit(fitter=None, canvas=None, view='counts', resid=True, interactive=True)[source]

Bases: gbm.plot.gbmplot.GbmPlot

Class for plotting spectral fits.

Parameters
  • fitter (SpectralFitter, optional) – The spectral fitter

  • view (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 GbmPlot

Attributes
  • ax (matplotlib.axes) – The matplotlib axes object for the plot

  • canvas (Canvas Backend object) – The plotting canvas, if set upon initialization.

  • count_data (Collection of ModelData) – The count data plot elements

  • count_models (Collection of Histo) – The count model plot elements

  • fig (matplotlib.figure) – The matplotlib figure object

  • model_spectrum (Collection of ModelSamples) – The model spectrum sample elements

  • residuals (Collection of ModelData) – The fit residual plot elements

  • view (str) – The current plot view

  • xlim (float, float) – The plotting range of the x axis. This attribute can be set.

  • xscale (str) – The scale of the x axis, either ‘linear’ or ‘log’. This attribute can be set.

  • ylim (float, float) – The plotting range of the y axis. This attribute can be set.

  • yscale (str) – The scale of the y axis, either ‘linear’ or ‘log’. This attribute can be set.

count_spectrum()[source]

Plot the count spectrum fit

energy_spectrum(**kwargs)[source]

Plot the energy spectrum model

Parameters

num_samples (int, optional) – The number of sample spectra. Default is 100.

hide_residuals()[source]

Hide the fit residuals

nufnu_spectrum(**kwargs)[source]

Plot the nuFnu spectrum model

Parameters

num_samples (int, optional) – The number of sample spectra. Default is 100.

photon_spectrum(**kwargs)[source]

Plot the photon spectrum model

Parameters

num_samples (int, optional) – The number of sample spectra. Default is 10.

set_fit(fitter, resid=False)[source]

Set the fitter. If a fitter already exists, this triggers a replot of the fit.

Parameters
  • fitter (SpectralFitter) – The spectral fitter for which a fit has been performed

  • resid (bool, optional) – If True, plot the fit residuals

show_residuals(sigma=True)[source]

Show the fit residuals

Parameters

sigma (bool, optional) – If True, plot the residuals in units of model sigma, otherwise in units of counts. Default is True.


ResponseMatrix

class gbm.plot.ResponseMatrix(data=None, colorbar=True, multi=False, canvas=None, axis=None, num_contours=100, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlot

Class for plotting a response matrix.

Parameters
  • data (RSP, optional) – The response object

  • colorbar (bool, optional) – If True, plot the colorbar for the effective area scale. Default is True.

  • multi (bool, optional) – If True, plots a multiplot window showing the matrix and the integrated effective area as a function of incident energy and recorded energy

  • num_contours (int, optional) – Number of contours to plot. Default is 100

  • **kwargs – Options to pass to GbmPlot

Attributes
  • ax (matplotlib.axes) – The matplotlib axes object for the plot

  • canvas (Canvas Backend object) – The plotting canvas, if set upon initialization.

  • data ( – class:`~gbm.plot.gbmplot.HeatMap’): The matrix plot object

  • fig (matplotlib.figure) – The matplotlib figure object

  • xlim (float, float) – The plotting range of the x axis. This attribute can be set.

  • xscale (str) – The scale of the x axis, either ‘linear’ or ‘log’. This attribute can be set.

  • ylim (float, float) – The plotting range of the y axis. This attribute can be set.

  • yscale (str) – The scale of the y axis, either ‘linear’ or ‘log’. This attribute can be set.

set_response(data, index=None, atime=None, **kwargs)[source]

Set the response data.

Parameters
  • data (RSP) – The response object

  • index (int, optional) – The index of the DRM to display

  • atime (float, optional) – The time corresponding to a DRM

  • **kwargs – Arguments to pass to HeatMap


PhotonEffectiveArea

class gbm.plot.PhotonEffectiveArea(data=None, canvas=None, axis=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlot

Class for plotting the incident photon effective area

Parameters
  • data (RSP, optional) – The response object

  • **kwargs – Options to pass to GbmPlot

Attributes
  • ax (matplotlib.axes) – The matplotlib axes object for the plot

  • canvas (Canvas Backend object) – The plotting canvas, if set upon initialization.

  • data (EffectiveArea) – The effective area plot object

  • fig (matplotlib.figure) – The matplotlib figure object

  • xlim (float, float) – The plotting range of the x axis. This attribute can be set.

  • xscale (str) – The scale of the x axis, either ‘linear’ or ‘log’. This attribute can be set.

  • ylim (float, float) – The plotting range of the y axis. This attribute can be set.

  • yscale (str) – The scale of the y axis, either ‘linear’ or ‘log’. This attribute can be set.

set_response(data, index=None, atime=None, **kwargs)[source]

Set the response data.

Parameters
  • data (RSP) – The response object

  • index (int, optional) – The index of the DRM to display

  • atime (float, optional) – The time corresponding to a DRM

  • **kwargs – Arguments to pass to EffectiveArea

ChannelEffectiveArea

class gbm.plot.ChannelEffectiveArea(data=None, canvas=None, axis=None, orientation='vertical', **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlot

Class for plotting the recorded channel energy effective area.

Parameters
  • data (RSP, optional) – The response object

  • **kwargs – Options to pass to GbmPlot

Attributes
  • ax (matplotlib.axes) – The matplotlib axes object for the plot

  • canvas (Canvas Backend object) – The plotting canvas, if set upon initialization.

  • data (EffectiveArea) – The effective area plot object

  • fig (matplotlib.figure) – The matplotlib figure object

  • xlim (float, float) – The plotting range of the x axis. This attribute can be set.

  • xscale (str) – The scale of the x axis, either ‘linear’ or ‘log’. This attribute can be set.

  • ylim (float, float) – The plotting range of the y axis. This attribute can be set.

  • yscale (str) – The scale of the y axis, either ‘linear’ or ‘log’. This attribute can be set.

set_response(data, index=None, atime=None, **kwargs)[source]

Set the response data.

Parameters
  • data (RSP) – The response object

  • index (int, optional) – The index of the DRM to display

  • atime (float, optional) – The time corresponding to a DRM

  • **kwargs – Arguments to pass to EffectiveArea


SkyPlot

class gbm.plot.SkyPlot(canvas=None, projection='mollweide', flipped=True, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlot

Class for plotting on the sky in equatorial coordinates

Parameters
  • projection (str, optional) – The projection of the map. Default is ‘mollweide’

  • flipped (bool, optional) – If True, the RA axis is flipped, following astronomical convention. Default is True.

  • **kwargs – Options to pass to GbmPlot

Attributes
  • ax (matplotlib.axes) – The matplotlib axes object for the plot

  • background_color (str) – The color of the plot background. This attribute can be set.

  • canvas (Canvas Backend object) – The plotting canvas, if set upon initialization.

  • canvas_color (str) – The color of the plotting canvas. This attribute can be set.

  • detectors (Collection of DetectorPointing) – The collection of detector plot elements

  • earth (SkyCircle) – The Earth plot element

  • fig (matplotlib.figure) – The matplotlib figure object

  • fontsize (int) – The font size of the text labels. This attribute can be set.

  • gc (GalacticPlane) – The reference to the galactic plane plot element

  • loc_contours – (Collection of SkyLine or SkyPolygon): The localization contour plot elements

  • loc_posterior (SkyHeatmap) – The localization gradient plot element

  • sun (Sun) – The Sun plot element

  • text_color (str) – The color of the text labels

add_healpix(hpx, gradient=True, clevels=None, sun=True, earth=True, detectors='all', galactic_plane=True)[source]

Add HealPix object to plot a localization and optionally the location of the Earth, Sun, and detector pointings

Parameters
  • hpx (HealPix) – The HealPix object

  • gradient (bool, optional) – If True, plots the posterior as a color gradient. If False, plot the posterior as color-filled confidence regions.

  • clevels (list of float, optional) – The confidence levels to plot contours. By default plots at the 1, 2, and 3 sigma level.

  • detectors ('all' or list) – A list of detectors or “all” to plot the pointings on the sky

  • earth (bool, optional) – If True, plot the Earth. Default is True.

  • sun (bool, optional) – If True, plot the Sun. Default is True.

  • galactic_plane (bool, optional) – If True, plot the Galactic plane. Default is True.

Note

Setting gradient=False when plotting an annulus may produce unexpected results at this time. It is suggested to use gradient=True for plotting annuli maps.

add_poshist(data, trigtime=None, detectors='all', geo=True, sun=True, galactic_plane=True)[source]

Add a Position History or Trigdat object to plot the location of the Earth, Sun, and detector pointings

Parameters
  • data (PosHist or Trigdat) – A Position History or Trigdat object

  • trigtime (float, optional) – If data is PosHist, set trigtime to a particular time of interest. The Trigdat trigger time overrides this

  • detectors ('all' or list) – A list of detectors or “all” to plot the pointings on the sky

  • geo (bool, optional) – If True, plot the Earth. Default is True.

  • sun (bool, optional) – If True, plot the Sun. Default is True.

  • galactic_plane (bool, optional) – If True, plot the Galactic plane. Default is True.

plot_detector(x, y, det, radius=10.0, **kwargs)[source]

Plot a detector pointing

Parameters
  • x (float) – The RA of the detector normal

  • y (float) – The Dec of the detector normal

  • det (str) – The detector name

  • radius (float, optional) – The radius of pointing, in degrees. Default is 10.0

  • **kwargs – Options to pass to SkyCircle

plot_earth(x, y, radius, **kwargs)[source]

Plot the Earth

Parameters
  • x (float) – The RA of the geocenter

  • y (float) – The Dec of the geocenter

  • radius (float) – The radius of the Earth, in degrees

  • **kwargs – Options to pass to SkyCircle

plot_galactic_plane()[source]

Plot the Galactic plane

plot_heatmap(heatmap, ra_array, dec_array, **kwargs)[source]

Plot a heatmap on the sky

Parameters
  • heatmap (np.array) – A 2D array of values

  • ra_array (np.array) – The array of RA gridpoints

  • dec_array (np.array) – The array of Dec gridpoints

  • radius (float) – The radius of pointing, in degrees

  • **kwargs – Options to pass to SkyHeatmap

plot_sun(x, y, **kwargs)[source]

Plot the sun

Parameters
  • x (float) – The RA of the Sun

  • y (float) – The Dec of the Sun

  • **kwargs – Options to pass to Sun


FermiSkyPlot

class gbm.plot.FermiSkyPlot(canvas=None, projection='mollweide', **kwargs)[source]

Bases: gbm.plot.skyplot.SkyPlot

Class for plotting in Fermi spacecraft coordinates.

Parameters
  • projection (str, optional) – The projection of the map. Default is ‘mollweide’

  • **kwargs – Options to pass to GbmPlot

Attributes
  • ax (matplotlib.axes) – The matplotlib axes object for the plot

  • background_color (str) – The color of the plot background. This attribute can be set.

  • canvas (Canvas Backend object) – The plotting canvas, if set upon initialization.

  • canvas_color (str) – The color of the plotting canvas. This attribute can be set.

  • detectors (Collection of SkyCircle) – The collection of detector plot elements

  • earth (SkyCircle) – The Earth plot element

  • fig (matplotlib.figure) – The matplotlib figure object

  • fontsize (int) – The font size of the text labels. This attribute can be set.

  • gc (GalacticPlane) – The reference to the galactic plane plot element

  • loc_contours – (Collection of SkyLine or SkyPolygon): The localization contour plot elements

  • loc_posterior (SkyHeatmap) – The localization gradient plot element

  • sun (Sun) – The Sun plot element

  • text_color (str) – The color of the text labels

add_healpix(**kwargs)[source]

Not yet implemented

add_poshist(data, trigtime=None, detectors='all', geo=True, sun=True, galactic_plane=True)[source]

Add a Position History or Trigdat object to plot the location of the Earth, Sun, and detector pointings

Parameters
  • data (PosHist or Trigdat) – A Position History or Trigdat object

  • trigtime (float, optional) – If data is PosHist, set trigtime to a particular time of interest. The Trigdat trigger time overrides this

  • detectors ('all' or list) – A list of detectors or “all” to plot the pointings on the sky

  • geo (bool, optional) – If True, plot the Earth. Default is True.

  • sun (bool, optional) – If True, plot the Sun. Default is True.

  • galactic_plane (bool, optional) – If True, plot the Galactic plane. Default is True.

plot_detector(det, radius=10.0, **kwargs)[source]

Plot a detector pointing

Parameters
  • det (str) – The detector name

  • radius (float, optional) – The radius of pointing, in degrees. Default is 10.0

  • **kwargs – Options to pass to SkyCircle

plot_earth(x, y, radius, **kwargs)[source]

Plot the Earth

Parameters
  • x (float) – The RA of the geocenter

  • y (float) – The Dec of the geocenter

  • radius (float) – The radius of the Earth, in degrees

  • **kwargs – Options to pass to SkyCircle

plot_galactic_plane(quat)[source]

Plot the Galactic plane

Parameters

quat (np.array) – The Fermi attitude quaternion

plot_heatmap(heatmap, ra_array, dec_array, **kwargs)

Plot a heatmap on the sky

Parameters
  • heatmap (np.array) – A 2D array of values

  • ra_array (np.array) – The array of RA gridpoints

  • dec_array (np.array) – The array of Dec gridpoints

  • radius (float) – The radius of pointing, in degrees

  • **kwargs – Options to pass to SkyHeatmap

plot_sun(x, y, **kwargs)[source]

Plot the sun

Parameters
  • x (float) – The RA of the Sun

  • y (float) – The Dec of the Sun

  • **kwargs – Options to pass to Sun


EarthPlot

class gbm.plot.EarthPlot(lat_range=None, lon_range=None, saa=True, mcilwain=True, canvas=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlot

Class for plotting the Earth, primarily related to Fermi’s position in orbit.

Note

This class requires installation of Matplotlib Basemap.

Parameters
  • lat_range ((float, float), optional) – The latitude range of the plot. Default value is the extent of the Fermi orbit: (-27, 27)

  • lon_range ((float, float), optional) – The longitude range of the plot. Default value is (-180, 180).

  • saa (bool, optional) – If True, display the SAA polygon. Default is True.

  • mcilwain (bool, optional) – If True, display the McIlwain L heatmap. Default is True.

  • **kwargs – Options to pass to GbmPlot

Attributes
  • ax (matplotlib.axes) – The matplotlib axes object for the plot

  • canvas (Canvas Backend object) – The plotting canvas, if set upon initialization.

  • fermi (FermiIcon) – Fermi spacecraft plot element

  • fig (matplotlib.figure) – The matplotlib figure object

  • map (mpl_toolkits.basemap.Basemap) – The Basemap object

  • mcilwainl (McIlwainL) – The McIlwain L heatmap

  • orbit (EarthLine) – The orbital path of Fermi

  • saa (SAA) – The SAA polygon

add_poshist(data, time_range=None, trigtime=None, numpts=1000)[source]

Add a Position History or Trigdat object to plot the orbital path of Fermi and optional the position of Fermi at a particular time.

Parameters
  • data (PosHist or Trigdat) – A Position History or Trigdat object

  • time_range – ((float, float), optional) The time range over which to plot the orbit. If omitted, plots the orbit over the entire time range of the file.

  • trigtime (float, optional) – If data is PosHist, set trigtime to a particular time of interest to plot Fermi’s orbital location. The Trigdat trigger time overrides this.

  • numpts (int, optional) – The number of interpolation points for plotting the orbit. Default is 1000.

standard_title()[source]

Add the standard plot title to the plot if a Trigdat object or a PosHist object + trigtime has been added.


GBM Plot Element Classes

These classes inherit from GbmPlotElemant and represent individual standard plot elements.

Histo

class gbm.plot.gbmplot.Histo(bins, ax, color=None, alpha=None, label=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot a rate histogram of either lightcurves or count spectra.

Parameters
  • bins (TimeBins or EnergyBins) – The lightcurve or count spectrum histograms

  • ax (matplotlib.axes) – The axis on which to plot

  • color (str, optional) – The color of the rate histograms

  • alpha (float, optional) – The alpha of the fill. Default is 1

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value, between 0 and 1.

  • color (str) – The color of the plot element.

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


HistoErrorbars

class gbm.plot.gbmplot.HistoErrorbars(bins, ax, color=None, alpha=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot errorbars for lightcurves or count spectra.

Parameters
  • bins (TimeBins or EnergyBins) – The lightcurve or count spectrum histograms

  • ax (matplotlib.axes) – The axis on which to plot

  • color (str, optional) – The color of the rate histograms

  • alpha (float, optional) – The alpha of the fill. Default is 1

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value

  • color (str) – The color of the plot element.

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


HistoFilled

class gbm.plot.gbmplot.HistoFilled(bins, ax, color=None, alpha=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot a filled histogram.

Parameters
  • bins (TimeBins or EnergyBins) – The lightcurve or count spectrum histograms

  • ax (matplotlib.axes) – The axis on which to plot

  • color (str, optional) – The color of the rate histograms

  • alpha (float, optional) – The alpha of the fill. Default is 1

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value

  • color (str) – The color of the plot element.

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


LightcurveBackground

class gbm.plot.gbmplot.LightcurveBackground(backrates, ax, color=None, alpha=None, cent_alpha=None, err_alpha=None, cent_color=None, err_color=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot a lightcurve background model with an error band.

Parameters
  • backrates (BackgroundRates) – The background rates object integrated over energy. If there is more than one remaining energy channel, the background will be integrated over the remaining energy channels.

  • ax (matplotlib.axes) – The axis on which to plot

  • cent_alpha (float, optional) – The alpha of the background centroid line. Default is 1

  • cent_color (str, optional) – The color of the background centroid line

  • err_alpha (float, optional) – The alpha of the background uncertainty. Default is 1

  • err_color (str, optional) – The color of the background uncertainty

  • color (str, optional) – The color of the background. If set, overrides cent_color and err_color.

  • alpha (float, optional) – The alpha of the background. If set, overrides cent_alpha and err_alpha

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value

  • cent_alpha (float) – The opacity of the centroid line

  • cent_color (str) – The color of the centroid line

  • color (str) – The color of the plot element.

  • err_alpha (float) – The opacity of the uncertainty band

  • err_color (str) – The color of the uncertainty band

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


SpectrumBackground

class gbm.plot.gbmplot.SpectrumBackground(backspec, ax, color=None, alpha=None, cent_alpha=None, err_alpha=None, cent_color=None, err_color=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot a count spectrum background model with an error band.

Parameters
  • backspec (BackgroundSpectrum) – The background sepctrum object integrated over time

  • ax (matplotlib.axes) – The axis on which to plot

  • cent_alpha (float, optional) – The alpha of the background centroid line. Default is 1

  • cent_color (str, optional) – The color of the background centroid line

  • err_alpha (float, optional) – The alpha of the background uncertainty. Default is 1

  • err_color (str, optional) – The color of the background uncertainty

  • color (str, optional) – The color of the background. If set, overrides cent_color and err_color.

  • alpha (float, optional) – The alpha of the background. If set, overrides cent_alpha and err_alpha

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value

  • cent_alpha (float) – The opacity of the centroid line

  • cent_color (str) – The color of the centroid line

  • color (str) – The color of the plot element.

  • err_alpha (float) – The opacity of the uncertainty band

  • err_color (str) – The color of the uncertainty band

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


HeatMap

class gbm.plot.gbmplot.HeatMap(x, y, heatmap, ax, colorbar=True, color='Greens', alpha=None, alpha_min=0.0, alpha_max=1.0, norm=None, num_contours=100, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot a general heatmap (color gradient). By default, the heatmap opacity will scale from 0 (fully transparent) to 1 (fully opaque) corresponding to the colormap value, creating an opacity gradient. This behavior can be adjusted by setting alpha_min and alpha_max.

Parameters
  • x (np.array) – The x-coordinate array of the heatmap grid

  • y (np.array) – The y-coordinate array of the heatmap grid

  • heatmap (np.array) – The heatmap array, of shape (x.size, y.size)

  • ax (matplotlib.axes) – The axis on which to plot

  • colorbar (bool, optional) – If True, add the colorbar scale. Default is True.

  • color (str, optional) – The colormap of the heatmap. Default is ‘Greens’

  • alpha_min (float, optional) – The alpha opacity for the minimum color value. Default is 0.

  • alpha_max (float, optional) – The alpha opacity for the maximum color value. Default is 1.

  • norm (matplotlib.colors.Normalize or similar, optional) – The normalization used to scale the colormapping to the heatmap values. This can be initialized by the defined matplotlib normalizations or a custom normalization.

  • num_contours (int, optional) – The number of contour lines to draw. Default is 100.

  • **kwargs – Other plotting options

Attributes
  • alpha_max (float) – The alpha opacity for the maximum color value

  • alpha_min (float) – The alpha opacity for the minimum color value

  • color (str) – The colormap

  • colorbar ( – class:`matplotlib.colorbar.Colorbar): The colorbar object

  • norm (matplotlib.colors.Normalize or similar) – The colormap normalization

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


EffectiveArea

class gbm.plot.gbmplot.EffectiveArea(bins, ax, color=None, alpha=None, orientation='vertical', **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot a histogram of the effective area of a detector response.

Parameters
  • bins (Bins) – The effective area histograms

  • ax (matplotlib.axes) – The axis on which to plot

  • color (str, optional) – The color of the rate histograms

  • alpha (float, optional) – The alpha of the histogram. Default is 1

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value, between 0 and 1.

  • color (str) – The color of the plot element.

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


SAA

class gbm.plot.gbmplot.SAA(m, ax, color=None, alpha=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot the SAA polygon

Parameters
  • m (mpl_toolkits.basemap.Basemap) – The basemap reference

  • ax (matplotlib.axes) – The axis on which to plot

  • color (str, optional) – The color of the SAA polygon

  • alpha (float, optional) – The alpha of the interior of the polygon

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value.

  • color (str) – The color of the polygon.

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

in_saa(lon, lat)[source]

Check if a point or points is inside the SAA

Parameters
  • lon (np.array) – longitudes

  • lat (np.array) – latitudes

Returns

np.array – Boolean array for each point where True indicates the point is in the SAA.

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


McIlwainL

class gbm.plot.gbmplot.McIlwainL(m, ax, colorbar=True, color=None, alpha=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot the McIlwain L heatmap

Parameters
  • m (mpl_toolkits.basemap.Basemap) – The basemap reference

  • ax (matplotlib.axes) – The axis on which to plot

  • colorbar (bool, optional) – If True, create a colorbar for the heatmap. Default is True

  • color (str, optional) – The colormap of the heatmap

  • alpha (float, optional) – The alpha opacity of the heatmap

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value.

  • color (str) – The colormap of the heatmap.

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


EarthLine

class gbm.plot.gbmplot.EarthLine(lat, lon, m, ax, color=None, alpha=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot a line on the Earth

Parameters
  • lat (np.array) – The latitude values of the line

  • lon (np.array) – The longitude values of the line

  • m (mpl_toolkits.basemap.Basemap) – The basemap reference

  • ax (matplotlib.axes) – The axis on which to plot

  • color (str, optional) – The color of the line

  • alpha (float, optional) – The alpha opacity of the line

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value.

  • color (str) – The color of the line.

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


EarthPoints

class gbm.plot.gbmplot.EarthPoints(lat, lon, m, ax, color=None, alpha=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot a point or set of points on the Earth.

Parameters
  • lat (np.array) – The latitude values

  • lon (np.array) – The longitude values

  • m (mpl_toolkits.basemap.Basemap) – The basemap reference

  • ax (matplotlib.axes) – The axis on which to plot

  • color (str, optional) – The color of the line

  • alpha (float, optional) – The alpha opacity of the line

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value.

  • color (str) – The color of the points.

  • coordinates (list of str) – The formatted coordinate list of the points

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


FermiIcon

class gbm.plot.gbmplot.FermiIcon(lat, lon, m, ax, color=None, alpha=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.EarthPoints

Plot a Fermi icon on the Earth.

Parameters
  • lat (np.array) – The latitude value

  • lon (np.array) – The longitude value

  • m (mpl_toolkits.basemap.Basemap) – The basemap reference

  • ax (matplotlib.axes) – The axis on which to plot

  • alpha (float, optional) – The alpha opacity of the line

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value.

  • coordinates (list of str) – The formatted coordinate list of the points

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


SkyPoints

class gbm.plot.gbmplot.SkyPoints(x, y, ax, flipped=True, fermi=False, color=None, alpha=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot a set of points on the sky in either equatorial coordinates or in spacecraft coordinates.

Parameters
  • x (float or np.array) – The azimuthal coordinate (RA or Fermi azimuth), in degrees

  • y (float or np.array) – The polar coordinate (Dec or Fermi zenith), in degrees

  • ax (matplotlib.axes) – The axis on which to plot

  • flipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention

  • fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.

  • color (str, optional) – The color of the points

  • alpha (float, optional) – The alpha opacity of the points

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value.

  • color (str) – The color of the points.

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


SkyLine

class gbm.plot.gbmplot.SkyLine(x, y, ax, flipped=True, fermi=False, color=None, alpha=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot a line on the sky in either equatorial coordinates or in spacecraft coordinates.

Parameters
  • x (np.array) – The azimuthal coordinate (RA or Fermi azimuth), in degrees

  • y (np.array) – The polar coordinate (Dec or Fermi zenith), in degrees

  • ax (matplotlib.axes) – The axis on which to plot

  • flipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention

  • fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.

  • color (str, optional) – The color of the line

  • alpha (float, optional) – The alpha opacity of the line

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value.

  • color (str) – The color of the line

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


SkyCircle

class gbm.plot.gbmplot.SkyCircle(x, y, radius, ax, flipped=True, fermi=False, color=None, alpha=None, face_color=None, face_alpha=None, edge_color=None, edge_alpha=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot a circle on the sky in either equatorial coordinates or in spacecraft coordinates.

Note

This class requires installation of Matplotlib Basemap.

Parameters
  • x (float) – The azimuthal coordinate of the center (RA or Fermi azimuth), in degrees

  • y (float) – The polar coordinate of the center (Dec or Fermi zenith), in degrees

  • radius (float) – The radius of the circle, in degrees

  • ax (matplotlib.axes) – The axis on which to plot

  • flipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention

  • fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.

  • face_color (str, optional) – The color of the circle fill

  • face_alpha (float, optional) – The alpha opacity of the circle fill

  • edge_color (str, optional) – The color of the circle edge

  • edge_alpha (float, optional) – The alpha opacity of the circle edge

  • color (str, optional) – The color of the circle. If set, overrides face_color and edge_color.

  • alpha (float, optional) – The alpha of the circle. If set, overrides face_alpha and edge_alpha.

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value.

  • color (str) – The color of the circle

  • edge_alpha (float) – The alpha opacity of the circle edge

  • edge_color (str) – The color of the circle edge

  • face_alpha (float) – The alpha opacity of the circle fill

  • face_color (str) – The color of the circle fill

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


SkyPolygon

class gbm.plot.gbmplot.SkyPolygon(x, y, ax, flipped=True, fermi=False, color=None, alpha=None, face_color=None, face_alpha=None, edge_color=None, edge_alpha=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot a polygon on the sky in either equatorial coordinates or in spacecraft coordinates.

Parameters
  • x (float) – The azimuthal coordinate (RA or Fermi azimuth), in degrees

  • y (float) – The polar coordinate (Dec or Fermi zenith), in degrees

  • ax (matplotlib.axes) – The axis on which to plot

  • flipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention

  • fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.

  • face_color (str, optional) – The color of the polygon fill

  • face_alpha (float, optional) – The alpha opacity of the polygon fill

  • edge_color (str, optional) – The color of the polygon edge

  • edge_alpha (float, optional) – The alpha opacity of the polygon edge

  • color (str, optional) – The color of the polygon. If set, overrides face_color and edge_color.

  • alpha (float, optional) – The alpha of the polygon. If set, overrides face_alpha and edge_alpha.

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value.

  • color (str) – The color of the polygon

  • edge_alpha (float) – The alpha opacity of the polygon edge

  • edge_color (str) – The color of the polygon edge

  • face_alpha (float) – The alpha opacity of the polygon fill

  • face_color (str) – The color of the polygon fill

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


SkyAnnulus

class gbm.plot.gbmplot.SkyAnnulus(x, y, radius, width, ax, flipped=True, fermi=False, color=None, alpha=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot an annulus on the sky in either equatorial coordinates or in spacecraft coordinates.

Note

This class requires installation of Matplotlib Basemap.

Parameters
  • x (float) – The azimuthal center (RA or Fermi azimuth), in degrees

  • y (float) – The polar center (Dec or Fermi zenith), in degrees

  • radius (float) – The radius in degrees, defined as the angular distance from the center to the middle of the width of the annulus band.

  • width (float) – The width onf the annulus in degrees

  • ax (matplotlib.axes) – The axis on which to plot

  • flipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention

  • fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.

  • color (str, optional) – The color of the annulus.

  • alpha (float, optional) – The opacity of the annulus.

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value.

  • color (str) – The color of the annulus

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


Sun

class gbm.plot.gbmplot.Sun(x, y, ax, flipped=True, fermi=False, alpha=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot the sun on the sky.

Parameters
  • x (float) – The azimuthal coordinate (RA or Fermi azimuth), in degrees

  • y (float) – The polar coordinate (Dec or Fermi zenith), in degrees

  • ax (matplotlib.axes) – The axis on which to plot

  • flipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention

  • fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.

  • alpha (float, optional) – The opacity of the annulus.

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value.

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


DetectorPointing

class gbm.plot.gbmplot.DetectorPointing(x, y, radius, det, ax, flipped=None, fermi=None, color='dimgray', edge_alpha=0.5, face_alpha=0.25, fontsize=10, font_alpha=0.8, **kwargs)[source]

Bases: gbm.plot.gbmplot.SkyCircle

Plot a detector pointing on the sky in either equatorial coordinates or spacecraft coordinates.

Parameters
  • x (float) – The azimuthal coordinate (RA or Fermi azimuth), in degrees

  • y (float) – The polar coordinate (Dec or Fermi zenith), in degrees

  • radius (float) – The radius of the circle, in degrees

  • ax (matplotlib.axes) – The axis on which to plot

  • flipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention

  • fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.

  • face_color (str, optional) – The color of the circle fill

  • face_alpha (float, optional) – The alpha opacity of the circle fill

  • edge_color (str, optional) – The color of the circle edge

  • edge_alpha (float, optional) – The alpha opacity of the circle edge

  • color (str, optional) – The color of the circle. If set, overrides face_color and edge_color.

  • alpha (float, optional) – The alpha of the circle. If set, overrides face_alpha and edge_alpha.

  • fontsize (float, optional) – The size of the detector label

  • font_alpha (float, optional) – The alpha opacity of the detector label

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value.

  • color (str) – The color of the circle

  • edge_alpha (float) – The alpha opacity of the circle edge

  • edge_color (str) – The color of the circle edge

  • face_alpha (float) – The alpha opacity of the circle fill

  • face_color (str) – The color of the circle fill

  • fontsize (float) – The size of the detector label

  • font_alpha (float) – The alpha opacity of the detector label

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


GalacticPlane

class gbm.plot.gbmplot.GalacticPlane(ax, flipped=True, fermi_quat=None, color=None, inner_color='black', outer_color='dimgray', alpha=None, line_alpha=0.5, center_alpha=0.75, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot the Galactic Plane in either equatorial coordinates or in spacecraft coordinates.

Parameters
  • ax (matplotlib.axes) – The axis on which to plot

  • flipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention

  • fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.

  • inner_color (str, optional) – The color of the inner line element

  • outer_color (str, optional) – The color of the outer line element

  • line_alpha (float, optional) – The alpha opacity of the line elements of the Galactic Plane

  • center_alpha (float, optional) – The alpha opacity of the Galactic center

  • color (str, optional) – The color of the Galactic plane. Overrides inner_color and outer_color.

  • alpha (float, optional) – The opacity of the Galactic plane. Overrides line_alpha and center_alpha.

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value.

  • center_alpha (float) – The alpha opacity of the Galactic plane

  • color (str) – The color of the Galactic plane

  • inner_color (str) – The color of the inner line element

  • line_alpha (float) – The alpha opacity of the line elements

  • outer_color (str) – The color of the outer line element

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


SkyHeatmap

class gbm.plot.gbmplot.SkyHeatmap(x, y, heatmap, ax, flipped=True, fermi=False, color='RdPu', alpha=None, alpha_min=0.0, alpha_max=1.0, norm=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot a heatmap on the sky. By default, the heatmap opacity will scale from 0 (fully transparent) to 1 (fully opaque) corresponding to the colormap value, creating an alpha gradient. This behavior can be adjust by setting alpha_min and alpha_max.

Parameters
  • x (np.array) – The azimuthal coordinate array of the heatmap grid

  • y (np.array) – The polar coordinate array of the heatmap grid

  • heatmap (np.array) – The heatmap array, of shape (x.size, y.size)

  • ax (matplotlib.axes) – The axis on which to plot

  • color (str, optional) – The colormap of the heatmap. Default is ‘RdPu’

  • alpha_min (float, optional) – The alpha opacity for the minimum color value. Default is 0.

  • alpha_max (float, optional) – The alpha opacity for the maximum color value. Default is 1.

  • norm (matplotlib.colors.Normalize or similar, optional) – The normalization used to scale the colormapping to the heatmap values. This can be initialized by the defined matplotlib normalizations or a custom normalization.

  • flipped (bool, optional) – If True, the azimuthal axis is flipped, following equatorial convention

  • fermi (bool, optional) – If True, plot in Fermi spacecraft coordinates, else plot in equatorial. Default is False.

  • **kwargs – Other plotting options

Attributes
  • alpha_max (float) – The alpha opacity for the maximum color value

  • alpha_min (float) – The alpha opacity for the minimum color value

  • color (str) – The colormap

  • norm (matplotlib.colors.Normalize or similar) – The colormap normalization

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


ModelData

class gbm.plot.gbmplot.ModelData(x, y, xerr, yerr, ax, ulmask=None, color=None, alpha=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot a set of data with errors derived from the model variances.

Parameters
  • x (np.array) – The x coordinates of the data plot points

  • y (np.array) – The y coordinates of the data plot points

  • xerr (np.array) – The uncertainty of the x points

  • yerr (np.array) – The uncertainty of the y points

  • ax (matplotlib.axes) – The axis on which to plot

  • ulmask (np.array(dtype=bool), optional) – A boolean array of the same size as x and y indicating which points are upper limits (True) and which are data points (False).

  • color (str, optional) – The color of the model

  • alpha (float, optional) – The alpha of the fill. Default is 1

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value, between 0 and 1.

  • color (str) – The color of the model.

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


ModelSamples

class gbm.plot.gbmplot.ModelSamples(x, y_list, ax, color=None, alpha=None, label=None, **kwargs)[source]

Bases: gbm.plot.gbmplot.GbmPlotElement

Plot a series of spectral model samples

Parameters
  • x (np.array) – The x coordinates of the model

  • y_list (list of np.array) – A list of arrays, where each element is a single spectral sample, having length equal to x

  • ax (matplotlib.axes) – The axis on which to plot

  • color (str, optional) – The color of the samples

  • alpha (float, optional) – The alpha of the fill. Default is 1

  • label (str, optional) – The label for the samples

  • **kwargs – Other plotting options

Attributes
  • alpha (float) – The alpha opacity value, between 0 and 1.

  • color (str) – The color of the model.

  • visible (bool) – True if the element is shown on the plot, False otherwise

hide()

Hide the plot element

remove()

Remove the plot element

show()

Show the plot element

toggle()

Toggle the visibility of the plot element


Collection

class gbm.plot.gbmplot.Collection[source]

Bases: object

A container for a collection of like objects. The Collection class exposes the individual objects as attributes, and it exposes the methods of the object class so that methods can be called on the collection as a whole. For that reason, each object in the Collection must be of the same type, otherwise an error is raised. The type of the Collection is set by the first object inserted into the collection.

Attributes
  • item_type (str) – The type of the items in the Collection

  • items (list) – The items in the Collection

  • size (int) – The number of items in the Collection

  • <item_name> (object) – If the item name can be converted to an attribute name, then each item name in the Collection becomes an attribute, returning the individual object

  • <item_attrib> (<attr>) – If the individual objects have public attributes, these will be made attributes of the Collection

  • <item_method> (<function>) – If the individual objects have public methods, these will be made methods of the Collection

classmethod from_list(obj_list, names)[source]

Create a Collection of objects from a list and list of corresponding names

Parameters
  • obj_list (list) – A list of objects of the same type

  • names (list of str) – A list of string names corresponding to the obj_list

Returns

Collection – The collection of objects

get(name)[source]

Retrieve an object by name

Parameters

name (str) – The name of the object

Returns

<object> – The requested object reference

insert(name, obj)[source]

Insert an object into the Collection

Parameters
  • name (str) – The name of the object

  • obj (object) – The object to insert