# 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
        ui.set_source(1, ui.powlaw1d.pl1)
        ui.set_source("tst", ui.powlaw1d.pltst)
        ui.set_source('no-arf', pl1)
        ui.set_source('arf1', pltst)
        ui.set_source('flatarf', pltst)
        ui.set_source('no-arf-flat', ui.const1d.c1)

        pl1.gamma = 0.0
        pl1.ampl = 1.2
        pltst.gamma = -1.0
        pltst.ampl = 2.1

        arfgrid = np.arange(0.2, 10, 0.02)
        arflo = arfgrid[:-1]
        arfhi = arfgrid[1:]
        amid = (arflo + arfhi) / 2.0

        flatarf = DataARF('flat', energ_lo=arflo, energ_hi=arfhi,
                          specresp=arflo * 0 + 10.1)
        arf = DataARF('arf', energ_lo=arflo, energ_hi=arfhi,
                      specresp=20 - (4.5 - amid)**2)
        ui.set_arf('arf1', arf)
        ui.set_arf('flatarf', flatarf)

    def tearDown(self):
        # there's an issue in CIAO 4.8 with delete_model and
        # delete_model_component, so just call clean
        ui.clean()

    def test_invalid_id(self):

# 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

        ui.set_source(1, ui.powlaw1d.pl1)
        ui.set_source("tst", ui.powlaw1d.pltst)
        ui.set_source('no-arf', pl1)
        ui.set_source('arf1', pltst)
        ui.set_source('flatarf', pltst)
        ui.set_source('no-arf-flat', ui.const1d.c1)

        pl1.gamma = 0.0
        pl1.ampl = 1.2
        pltst.gamma = -1.0
        pltst.ampl = 2.1

        arfgrid = np.arange(0.2, 10, 0.02)
        arflo = arfgrid[:-1]
        arfhi = arfgrid[1:]
        amid = (arflo + arfhi) / 2.0

        flatarf = DataARF('flat', energ_lo=arflo, energ_hi=arfhi,
                          specresp=arflo * 0 + 10.1)
        arf = DataARF('arf', energ_lo=arflo, energ_hi=arfhi,
                      specresp=20 - (4.5 - amid)**2)
        ui.set_arf('arf1', arf)
        ui.set_arf('flatarf', flatarf)

    def tearDown(self):
        # there's an issue in CIAO 4.8 with delete_model and
        # delete_model_component, so just call clean
        ui.clean()

    def test_invalid_id(self):

        self.assertRaises(IdentifierErr, chart.get_chart_spectrum,