RMFPlot

class sherpa.astro.plot.RMFPlot[source] [edit on github]

Bases: HistogramPlot

Create plots of the ancillary response file (RMF).

A full RMF is a matrix that is hard to visualize. Here, we select a few specific energies and show the response function for those energies as histograms.

Changed in version 4.16.1: The plot will now display with the analysis setting of the data argument sent to prepare. Previously it would always use energies for the X axis. The energies setting can be used to control what energies are chosen for the plot.

Attributes Summary

energies

The energies at which to draw the response (in keV).

histo_prefs

The preferences for the plot.

labels

The labels for each line.

n_lines

The number of lines to draw (only used when energies is None).

rmf_plot_prefs

Plot preferences

title

Title of plot

x

Return (xlo + xhi) / 2

xhi

The upper edges of each bin.

xlabel

Label for X axis

xlo

The lower edges of each bin.

y

The response for a specific energy or channel.

ylabel

Label for Y axis

Methods Summary

hline(y[, xmin, xmax, linecolor, linestyle, ...])

Draw a line at constant y, extending over the plot.

overplot(*args, **kwargs)

plot([overplot, clearwindow])

Plot the data.

prepare(rmf[, data])

Fill the fields given the RMF.

vline(x[, ymin, ymax, linecolor, linestyle, ...])

Draw a line at constant x, extending over the plot.

Attributes Documentation

energies = None

The energies at which to draw the response (in keV).

If set to None then n_lines energies will be selected to span the energy range of the response.

histo_prefs = {'alpha': None, 'capsize': None, 'color': None, 'ecolor': None, 'label': None, 'linestyle': 'solid', 'linewidth': None, 'marker': 'None', 'markerfacecolor': None, 'markersize': None, 'xerrorbars': False, 'xlog': False, 'yerrorbars': False, 'ylog': False}

The preferences for the plot.

labels = None

The labels for each line.

Type:

List of strings

n_lines = 5

The number of lines to draw (only used when energies is None).

rmf_plot_prefs = {'alpha': None, 'capsize': None, 'color': None, 'ecolor': None, 'label': None, 'linestyle': 'solid', 'linewidth': None, 'marker': 'None', 'markerfacecolor': None, 'markersize': None, 'xerrorbars': False, 'xlog': True, 'yerrorbars': False, 'ylog': True}

Plot preferences

title = ''

Title of plot

x

Return (xlo + xhi) / 2

This is intended to make it easier to swap between plot- and histogram-style plots by providing access to an X value.

xhi = None

The upper edges of each bin.

Type:

array_like

xlabel = ''

Label for X axis

xlo = None

The lower edges of each bin.

Type:

array_like

y = None

The response for a specific energy or channel.

Type:

array_like

ylabel = ''

Label for Y axis

Methods Documentation

static hline(y, xmin=0, xmax=1, linecolor=None, linestyle=None, linewidth=None, overplot=False, clearwindow=True) [edit on github]

Draw a line at constant y, extending over the plot.

overplot(*args, **kwargs) [edit on github]
plot(overplot=False, clearwindow=True, **kwargs)[source] [edit on github]

Plot the data.

This will plot the data sent to the prepare method.

Parameters:
  • overplot (bool, optional) – If True then add the data to an existing plot, otherwise create a new plot.

  • clearwindow (bool, optional) – Should the existing plot area be cleared before creating this new plot (e.g. for multi-panel plotcs)?

  • **kwargs – These values are passed on to the plot backend, and must match the names of the keys of the object’s plot_prefs dictionary.

See also

prepare, overplot

prepare(rmf, data=None)[source] [edit on github]

Fill the fields given the RMF.

The n_lines and energies fields can be set to control what lines are shown.

Changed in version 4.16.1: The energies field, when set, is used to select the energies to display (if left as None then n_lines energies are chosen automatically).

Parameters:
  • RMF – The RMF to plot

  • data (DataPHA instance, optional) – The units attribute of this object is used to determine whether the X axis should be in Angstrom or channels, instead of KeV (the default).

static vline(x, ymin=0, ymax=1, linecolor=None, linestyle=None, linewidth=None, overplot=False, clearwindow=True) [edit on github]

Draw a line at constant x, extending over the plot.