# Path: sherpa_contrib/marx.py
# def get_marx_spectrum(id=None, elow=None, ehigh=None, ewidth=None,
#                       norm=None):
# def save_marx_spectrum(outfile, clobber=True, verbose=True,
#                        id=None, elow=None, ehigh=None, ewidth=None,
#                        norm=None):
# def plot_marx_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_contrib import marx

"""
Test routines for the ChART code in
sherpa_contrib.chart.
"""





sys.tracebacklimit = 4


class TestSimple(unittest.TestCase):
    """Basic tests"""

    def setUp(self):
        ui.set_source('no-arf-flat', ui.const1d.c1)

    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_spec_flat(self):
        res = marx.get_marx_spectrum(elow=1., ehigh=4.,
                                     ewidth=1., id='no-arf-flat')
        self.assertTrue(np.all(res[1] == 1))

        # Different bin width

# Path: sherpa_contrib/marx.py
# def get_marx_spectrum(id=None, elow=None, ehigh=None, ewidth=None,
#                       norm=None):
# def save_marx_spectrum(outfile, clobber=True, verbose=True,
#                        id=None, elow=None, ehigh=None, ewidth=None,
#                        norm=None):
# def plot_marx_spectrum(id=None, elow=None, ehigh=None, ewidth=None,
#                        norm=None, overplot=False, clearwindow=True):


# Path: sherpa_contrib/tests/test_marx.py
import unittest
import numpy as np
import sys
from sherpa.astro import ui
from sherpa_contrib import marx


"""
Test routines for the ChART code in
sherpa_contrib.chart.
"""





sys.tracebacklimit = 4


class TestSimple(unittest.TestCase):
    """Basic tests"""

    def setUp(self):
        ui.set_source('no-arf-flat', ui.const1d.c1)

    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_spec_flat(self):
        res = marx.get_marx_spectrum(elow=1., ehigh=4.,
                                     ewidth=1., id='no-arf-flat')
        self.assertTrue(np.all(res[1] == 1))

        # Different bin width

        res = marx.get_marx_spectrum(elow=1., ehigh=4.,