# Path: sherpa_contrib/chart.py
# def _get_chart_spectrum(id=None, elow=None, ehigh=None, ewidth=None,
#                         norm=None):
# def get_chart_spectrum(id=None, elow=None, ehigh=None, ewidth=None,
#                        norm=None):
# def save_chart_spectrum(outfile, clobber=True, verbose=True,
#                         format='text',
#                         id=None, elow=None, ehigh=None, ewidth=None,
#                         norm=None):
# def plot_chart_spectrum(id=None, elow=None, ehigh=None, ewidth=None,
#                         norm=None, overplot=False, clearwindow=True):


import unittest
import numpy as np
import sys
from sherpa.astro import ui
from sherpa.utils.err import IdentifierErr
from sherpa.astro.data import DataARF, DataPHA
from sherpa_contrib import chart
                          'nonsense')

    def test_no_source(self):
        self.assertRaises(IdentifierErr, chart.get_chart_spectrum,
                          id='not-used')

    def test_no_arf(self):
        self.assertRaises(TypeError, chart.get_chart_spectrum,
                          id='no-arf')

    def check_spacing(self, res, nbins, lo, hi, step):
        xlo = res["xlo"]
        xhi = res["xhi"]
        xmid = res["x"]
        self.assertEqual(nbins, xlo.size)
        self.assertEqual(xlo.size, xhi.size)
        self.assertEqual(xlo.size, xmid.size)
        self.assertAlmostEqual(lo, xlo[0])
        self.assertAlmostEqual(hi, xhi[-1])
        self.assertAlmostEqual(step, (xmid[-1] - xmid[0]) /
                               (xlo.size - 1))

    def test_grid1(self):
        elo, ehi, de = self.grid[1]
        res = chart._get_chart_spectrum(elow=elo, ehigh=ehi,
                                        ewidth=de)
        self.check_spacing(res, self.nbins[1], elo, ehi, de)

    def test_gridtst(self):
        elo, ehi, de = self.grid['tst']

# Path: sherpa_contrib/chart.py
# def _get_chart_spectrum(id=None, elow=None, ehigh=None, ewidth=None,
#                         norm=None):
# def get_chart_spectrum(id=None, elow=None, ehigh=None, ewidth=None,
#                        norm=None):
# def save_chart_spectrum(outfile, clobber=True, verbose=True,
#                         format='text',
#                         id=None, elow=None, ehigh=None, ewidth=None,
#                         norm=None):
# def plot_chart_spectrum(id=None, elow=None, ehigh=None, ewidth=None,
#                         norm=None, overplot=False, clearwindow=True):


# Path: sherpa_contrib/tests/test_chart.py
import unittest
import numpy as np
import sys
from sherpa.astro import ui
from sherpa.utils.err import IdentifierErr
from sherpa.astro.data import DataARF, DataPHA
from sherpa_contrib import chart

                          'nonsense')

    def test_no_source(self):
        self.assertRaises(IdentifierErr, chart.get_chart_spectrum,
                          id='not-used')

    def test_no_arf(self):
        self.assertRaises(TypeError, chart.get_chart_spectrum,
                          id='no-arf')

    def check_spacing(self, res, nbins, lo, hi, step):
        xlo = res["xlo"]
        xhi = res["xhi"]
        xmid = res["x"]
        self.assertEqual(nbins, xlo.size)
        self.assertEqual(xlo.size, xhi.size)
        self.assertEqual(xlo.size, xmid.size)
        self.assertAlmostEqual(lo, xlo[0])
        self.assertAlmostEqual(hi, xhi[-1])
        self.assertAlmostEqual(step, (xmid[-1] - xmid[0]) /
                               (xlo.size - 1))

    def test_grid1(self):
        elo, ehi, de = self.grid[1]
        res = chart._get_chart_spectrum(elow=elo, ehigh=ehi,
                                        ewidth=de)
        self.check_spacing(res, self.nbins[1], elo, ehi, de)

    def test_gridtst(self):
        elo, ehi, de = self.grid['tst']

        res = chart._get_chart_spectrum(elow=elo, ehigh=ehi,