Confidence2D

class sherpa.plot.Confidence2D[source] [edit on github]

Bases: DataContour, Point

The base class for 2D confidence contours.

Changed in version 4.16.1: Handling of log-scaled axes and use of the delv argument has been improved.

Attributes Summary

conf_type

The type of confidence analysis.

contour_prefs

The preferences for the plot.

point_prefs

The preferences for the plot.

Methods Summary

calc(fit, par0, par1)

Evaluate the statistic for the parameter range.

contour([overplot, clearwindow])

overcontour(*args, **kwargs)

point(x, y[, overplot, clearwindow])

Draw a point at the given location.

prepare([min, max, nloop, delv, fac, log, ...])

Set the data to plot.

Attributes Documentation

conf_type = 'unknown'

The type of confidence analysis.

contour_prefs = {'alpha': None, 'colors': None, 'label': None, 'levels': None, 'linestyles': 'solid', 'linewidths': None, 'xlog': False, 'ylog': False}

The preferences for the plot.

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

The preferences for the plot.

Methods Documentation

calc(fit, par0, par1)[source] [edit on github]

Evaluate the statistic for the parameter range.

This requires prepare to have been called, and must be called before contour is called.

Parameters:
  • fit – The Sherpa fit instance to use (defines the statistic and optimiser to use).

  • par0 – The parameters to iterate over.

  • par1 – The parameters to iterate over.

See also

contour, prepare

Notes

This method is assumed to be over-ridden in derived classes, where it will perform the statistic calculations needed to create the visualization. This version should be called from these classes as it validates the fit and par arguments.

contour(overplot=False, clearwindow=True, **kwargs)[source] [edit on github]
overcontour(*args, **kwargs) [edit on github]
point(x, y, overplot=True, clearwindow=False, **kwargs) [edit on github]

Draw a point at the given location.

Parameters:
  • x – The coordinates of the plot.

  • y – The coordinates of the plot.

  • 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 plots)?

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

prepare(min=None, max=None, nloop=(10, 10), delv=None, fac=4, log=(False, False), sigma=(1, 2, 3), levels=None, numcores=None)[source] [edit on github]

Set the data to plot.

This defines the ranges over which the statistic will be calculated, but does not perform the evaluation.

Parameters:
  • min (sequence of number or None, optional) – The minimum and maximum parameter values to used. If set then they must contain two elements, and if not then the range is calculated using the fac parameter.

  • max (sequence of number or None, optional) – The minimum and maximum parameter values to used. If set then they must contain two elements, and if not then the range is calculated using the fac parameter.

  • nloop (sequence of int, optional) – The number of points at which to evaluate the statistic, where each value must be greater than 1. This is used when delv is set to None.

  • delv (sequence of number or None, optional) – The spacing of the parameter grids, and if set it must contain two values each greater than 0. This takes precedence over nloop.

  • fac (number, optional) – Used when either min or max are not set. The parameter range in this case is taken to be fac times the separation of the covariance limits for the parameter (unless explicitly given).

  • log (sequence of bool, optional) – Should each parameter be evaluated on a logarithmically-spaced grid rather than a linearly-spaced one?

  • sigma (sequence of number, optional) – The sigma values at which to draw contours. This is only used if levels is set to None.

  • levels (sequence of number or None, optional) – The levels at which the contours are drawn. This over-rides the sigma setting.

  • numcores (int or None, optional) – Should the parameter evaluation use multiple CPU cores if available?

See also

calc