コード例 #1
0
def test_error_positional_parameters(cal_spec):
    """Test errors when to many positional parameters are provided"""

    with pytest.raises(bq.PlottingError):
        cal_spec.plot('x', 'x')
    with pytest.raises(bq.PlottingError):
        sp(cal_spec).plot('x', 'x')
コード例 #2
0
def test_kwargs_SpectrumPlotter(uncal_spec):
    """Test kwargs, color and fmt in this case"""

    sp(uncal_spec).plot('--', color='#ffffff')
    assert plt.gca().get_lines()[0].get_linestyle() == '--'
    assert plt.gca().get_lines()[0].get_color() == '#ffffff'
    plt.close("all")
コード例 #3
0
def test_kwargs_SpectrumPlotter(uncal_spec):
    """Test kwargs, color and fmt in this case"""

    sp(uncal_spec).plot("--", color="#ffffff")
    assert plt.gca().get_lines()[0].get_linestyle() == "--"
    assert plt.gca().get_lines()[0].get_color() == "#ffffff"
    plt.close("all")
コード例 #4
0
def test_error_modes_cpskev(cal_spec):
    """Test error mode for cps mode"""

    cal_spec.livetime = 200
    tsp = sp(cal_spec, ymode='cpskev')
    assert np.allclose(tsp.yerror, cal_spec.cpskev_uncs)
コード例 #5
0
def test_error_modes_counts(uncal_spec):
    """Test error mode for counts mode"""

    tsp = sp(uncal_spec, ymode='counts')
    assert np.allclose(tsp.yerror, uncal_spec.counts_uncs)
コード例 #6
0
def test_get_linthreshy(cal_spec_cps):
    """Test get linthreshy function"""

    tsp = sp(cal_spec_cps, linthreshy=1)
    assert tsp.linthreshy == 1
コード例 #7
0
def test_get_xlim(cal_spec_cps):
    """Test get xlim function"""

    tsp = sp(cal_spec_cps, xlim='default')
    assert tsp.xlim == (cal_spec_cps.bin_edges_kev[0],
                        cal_spec_cps.bin_edges_kev[-1])
コード例 #8
0
def test_get_ylabel(cal_spec_cps):
    """Test get ylabel function"""

    tsp = sp(cal_spec_cps)
    assert tsp.ylabel == 'Countrate [1/s]'
コード例 #9
0
def test_get_xlabel(cal_spec_cps):
    """Test get xlabel function"""

    tsp = sp(cal_spec_cps)
    assert tsp.xlabel == 'Energy [keV]'
コード例 #10
0
def test_get_ymode(cal_spec_cps):
    """Test get ymode function"""

    tsp = sp(cal_spec_cps)
    assert tsp.ymode == 'cps'
コード例 #11
0
def test_get_xmode(cal_spec_cps):
    """Test get xmode function"""

    tsp = sp(cal_spec_cps)
    assert tsp.xmode == 'energy'